Fix exception msg
Missing 'limit' argument in api_common when giving exception msg
@@ -84,7 +84,7 @@ def get_limit_and_marker(request):
pagination, then return None.
"""
max_limit = _get_pagination_max_limit()
- limit = _get_limit_param(request, max_limit)
+ limit = _get_limit_param(request)
if max_limit > 0:
limit = min(max_limit, limit) or max_limit
if not limit:
@@ -108,15 +108,16 @@ def _get_pagination_max_limit():
return max_limit
-def _get_limit_param(request, max_limit):
+def _get_limit_param(request):
"""Extract integer limit from request or fail."""
+ limit = -1
try:
limit = int(request.GET.get('limit', 0))
if limit >= 0:
return limit
except ValueError:
pass
- msg = _("Limit must be an integer 0 or greater and not '%d'")
+ msg = _("Limit must be an integer 0 or greater and not '%d'") % limit
raise exceptions.BadRequest(resource='limit', msg=msg)
