Python 3: Enable sm-api to work after unlock
The "min()" function works for None arguments
in Python 2 but in Python 3 raises an error.
We add a check to ensure that the function is not
called with the None argument in Python 3.
Story: 2006796
Task: 42388
Depends-On: I29a81755f732b55f67321748604b2e5d951935c9
Change-Id: I2199e0b87d342cec305edbb10483c6c038ad591c
Signed-off-by: Mihnea Saracin <Mihnea.Saracin@windriver.com>
(cherry picked from commit f2186d04c0
)
This commit is contained in:
parent
ff9e32bb80
commit
0db63883c0
|
@ -35,7 +35,9 @@ JSONPATCH_EXCEPTIONS = (jsonpatch.JsonPatchException,
|
||||||
|
|
||||||
|
|
||||||
def validate_limit(limit):
|
def validate_limit(limit):
|
||||||
if limit and limit < 0:
|
if limit is None:
|
||||||
|
return CONF.api_limit_max
|
||||||
|
elif limit < 0:
|
||||||
raise wsme.exc.ClientSideError(_("Limit must be positive"))
|
raise wsme.exc.ClientSideError(_("Limit must be positive"))
|
||||||
|
|
||||||
return min(CONF.api_limit_max, limit) or CONF.api_limit_max
|
return min(CONF.api_limit_max, limit) or CONF.api_limit_max
|
||||||
|
|
Loading…
Reference in New Issue