summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorWilliam Wolf <throughnothing@gmail.com>2011-06-01 23:09:37 -0400
committerWilliam Wolf <throughnothing@gmail.com>2011-06-01 23:09:37 -0400
commit4fb46873ef4332c6570d3ac5559557745056dee6 (patch)
tree8306deb9a77cf82a06d9ac9d7d61658e2c6bc719 /nova/api
parentb5cc7cb35cecd0c1c4a9e56e4c21bcdb4e3d2ecd (diff)
cleanup based on waldon's comments, also caught a few other issues
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/common.py18
-rw-r--r--nova/api/openstack/images.py8
-rw-r--r--nova/api/openstack/servers.py1
3 files changed, 8 insertions, 19 deletions
diff --git a/nova/api/openstack/common.py b/nova/api/openstack/common.py
index 342cc8b2e..c9e3dbb64 100644
--- a/nova/api/openstack/common.py
+++ b/nova/api/openstack/common.py
@@ -50,7 +50,7 @@ def get_pagination_params(request):
try:
marker = int(request.GET.get('marker', 0))
except ValueError:
- raise webob.exc.HTTPBadRequest(_('offset param must be an integer'))
+ raise webob.exc.HTTPBadRequest(_('marker param must be an integer'))
try:
limit = int(request.GET.get('limit', 0))
@@ -102,19 +102,11 @@ def limited(items, request, max_limit=FLAGS.osapi_max_limit):
def limited_by_marker(items, request, max_limit=FLAGS.osapi_max_limit):
"""Return a slice of items according to the requested marker and limit."""
+ print "TEST LIMIT"
+ (marker, limit) = get_pagination_params(request)
- try:
- marker = int(request.GET.get('marker', 0))
- except ValueError:
- raise webob.exc.HTTPBadRequest(_('marker param must be an integer'))
-
- try:
- limit = int(request.GET.get('limit', max_limit))
- except ValueError:
- raise webob.exc.HTTPBadRequest(_('limit param must be an integer'))
-
- if limit < 0:
- raise webob.exc.HTTPBadRequest(_('limit param must be positive'))
+ if limit == 0:
+ limit = max_limit
limit = min(max_limit, limit)
start_index = 0
diff --git a/nova/api/openstack/images.py b/nova/api/openstack/images.py
index dcedd3db2..4ef9a5974 100644
--- a/nova/api/openstack/images.py
+++ b/nova/api/openstack/images.py
@@ -46,9 +46,6 @@ class Controller(object):
self._compute_service = compute_service or compute.API()
self._image_service = image_service or _default_service
- def _limit_items(self, items, req):
- return common.limited(items, req)
-
def index(self, req):
"""Return an index listing of images available to the request.
@@ -162,13 +159,11 @@ class ControllerV11(Controller):
base_url = request.application_url
return images_view.ViewBuilderV11(base_url)
- def get_default_xmlns(self, req):
- return common.XML_NS_V11
-
def index(self, req):
"""Return an index listing of images available to the request.
:param req: `wsgi.Request` object
+
"""
context = req.environ['nova.context']
filters = self._get_filters(req)
@@ -182,6 +177,7 @@ class ControllerV11(Controller):
"""Return a detailed index listing of images available to the request.
:param req: `wsgi.Request` object.
+
"""
context = req.environ['nova.context']
filters = self._get_filters(req)
diff --git a/nova/api/openstack/servers.py b/nova/api/openstack/servers.py
index f2ce64e78..ad556ca84 100644
--- a/nova/api/openstack/servers.py
+++ b/nova/api/openstack/servers.py
@@ -55,6 +55,7 @@ class Controller(object):
def detail(self, req):
""" Returns a list of server details for a given user """
+ print "DETAIL"
return self._items(req, is_detail=True)
def _image_id_from_req_data(self, data):