diff options
| author | Mark Washenberger <mark.washenberger@rackspace.com> | 2011-03-09 15:07:38 -0500 |
|---|---|---|
| committer | Mark Washenberger <mark.washenberger@rackspace.com> | 2011-03-09 15:07:38 -0500 |
| commit | 82c4d6309909d6508df0944683ce4d3d7341de10 (patch) | |
| tree | 7a2bfe77a408081017c3dc1396c697b3a180f8f0 /nova/api | |
| parent | 2c733d5365b753989b506d82d376d980cd701547 (diff) | |
| parent | 07c6fcab721b780028aefa1062cb9e3e8805a09b (diff) | |
| download | nova-82c4d6309909d6508df0944683ce4d3d7341de10.tar.gz nova-82c4d6309909d6508df0944683ce4d3d7341de10.tar.xz nova-82c4d6309909d6508df0944683ce4d3d7341de10.zip | |
merge lp:nova
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/common.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/nova/api/openstack/common.py b/nova/api/openstack/common.py index 9f85c5c8a..f7a9cc3f0 100644 --- a/nova/api/openstack/common.py +++ b/nova/api/openstack/common.py @@ -36,15 +36,18 @@ def limited(items, request, max_limit=1000): try: offset = int(request.GET.get('offset', 0)) except ValueError: - offset = 0 + raise webob.exc.HTTPBadRequest(_('offset param must be an integer')) try: limit = int(request.GET.get('limit', max_limit)) except ValueError: - limit = max_limit + raise webob.exc.HTTPBadRequest(_('limit param must be an integer')) - if offset < 0 or limit < 0: - raise webob.exc.HTTPBadRequest() + if limit < 0: + raise webob.exc.HTTPBadRequest(_('limit param must be positive')) + + if offset < 0: + raise webob.exc.HTTPBadRequest(_('offset param must be positive')) limit = min(max_limit, limit or max_limit) range_end = offset + limit |
