summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDolph Mathews <dolph.mathews@gmail.com>2012-06-01 09:35:41 -0500
committerGerrit Code Review <review@openstack.org>2012-06-28 21:22:54 +0000
commit002dd429532721392b0676eb42ec1bfb5735c0ea (patch)
tree8fdcb4a9afe1324d299d656b68e1620c9cac19a2
parent8cd73c75cec35d4df49891ee4c36102b4c8d96ff (diff)
Fixed marker & limit computation (bug 1006055)
Change-Id: I8a4a7b114b05e36024753cd02189188fd4294fc1
-rw-r--r--keystone/identity/core.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/keystone/identity/core.py b/keystone/identity/core.py
index 3caaed5c..aec0b753 100644
--- a/keystone/identity/core.py
+++ b/keystone/identity/core.py
@@ -414,18 +414,19 @@ class TenantController(wsgi.Application):
def _format_tenant_list(self, tenant_refs, **kwargs):
marker = kwargs.get('marker')
- page_idx = 0
+ first_index = 0
if marker is not None:
- for (marker_idx, tenant) in enumerate(tenant_refs):
+ for (marker_index, tenant) in enumerate(tenant_refs):
if tenant['id'] == marker:
# we start pagination after the marker
- page_idx = marker_idx + 1
+ first_index = marker_index + 1
break
else:
msg = 'Marker could not be found'
raise exception.ValidationError(message=msg)
limit = kwargs.get('limit')
+ last_index = None
if limit is not None:
try:
limit = int(limit)
@@ -434,8 +435,9 @@ class TenantController(wsgi.Application):
except (ValueError, AssertionError):
msg = 'Invalid limit value'
raise exception.ValidationError(message=msg)
+ last_index = first_index + limit
- tenant_refs = tenant_refs[page_idx:limit]
+ tenant_refs = tenant_refs[first_index:last_index]
for x in tenant_refs:
if 'enabled' not in x: