Merge "Remove redundant code on offset, limit parameters."
This commit is contained in:
commit
2f0580a5aa
@ -100,8 +100,8 @@ class ContainersController(object):
|
||||
|
||||
result = self.container_repo.get_by_create_date(
|
||||
keystone_id,
|
||||
offset_arg=int(kw.get('offset')),
|
||||
limit_arg=int(kw.get('limit')),
|
||||
offset_arg=kw.get('offset', 0),
|
||||
limit_arg=kw.get('limit', None),
|
||||
suppress_exception=True
|
||||
)
|
||||
|
||||
|
@ -102,28 +102,10 @@ class OrdersController(object):
|
||||
LOG.debug('Start orders on_get '
|
||||
'for tenant-ID {0}:'.format(keystone_id))
|
||||
|
||||
offset = kw.get('offset')
|
||||
if offset is not None:
|
||||
try:
|
||||
offset = int(offset)
|
||||
except ValueError:
|
||||
# as per Github issue 171, if offset is invalid then
|
||||
# the default should be used.
|
||||
offset = None
|
||||
|
||||
limit = kw.get('limit')
|
||||
if limit is not None:
|
||||
try:
|
||||
limit = int(limit)
|
||||
except ValueError:
|
||||
# as per Github issue 171, if limit is invalid then
|
||||
# the default should be used.
|
||||
limit = None
|
||||
|
||||
result = self.order_repo \
|
||||
.get_by_create_date(keystone_id,
|
||||
offset_arg=offset,
|
||||
limit_arg=limit,
|
||||
offset_arg=kw.get('offset', 0),
|
||||
limit_arg=kw.get('limit', None),
|
||||
suppress_exception=True)
|
||||
orders, offset, limit, total = result
|
||||
|
||||
|
@ -166,41 +166,22 @@ class SecretsController(object):
|
||||
LOG.debug('Start secrets on_get '
|
||||
'for tenant-ID {0}:'.format(keystone_id))
|
||||
|
||||
name = kw.get('name')
|
||||
name = kw.get('name', '')
|
||||
if name:
|
||||
name = urllib.unquote_plus(name)
|
||||
|
||||
offset = kw.get('offset')
|
||||
if offset is not None:
|
||||
try:
|
||||
offset = int(offset)
|
||||
except ValueError:
|
||||
# as per Github issue 171, if offset is invalid then
|
||||
# the default should be used.
|
||||
offset = None
|
||||
|
||||
limit = kw.get('limit')
|
||||
if limit is not None:
|
||||
try:
|
||||
limit = int(limit)
|
||||
except ValueError:
|
||||
# as per Github issue 171, if limit is invalid then
|
||||
# the default should be used.
|
||||
limit = None
|
||||
|
||||
bits = kw.get('bits')
|
||||
if bits is not None:
|
||||
try:
|
||||
bits = int(bits)
|
||||
except ValueError:
|
||||
# as per Github issue 171, if bits is invalid then
|
||||
# the default should be used.
|
||||
bits = None
|
||||
bits = kw.get('bits', 0)
|
||||
try:
|
||||
bits = int(bits)
|
||||
except ValueError:
|
||||
# as per Github issue 171, if bits is invalid then
|
||||
# the default should be used.
|
||||
bits = 0
|
||||
|
||||
result = self.secret_repo.get_by_create_date(
|
||||
keystone_id,
|
||||
offset_arg=offset,
|
||||
limit_arg=limit,
|
||||
offset_arg=kw.get('offset', 0),
|
||||
limit_arg=kw.get('limit', None),
|
||||
name=name,
|
||||
alg=kw.get('alg'),
|
||||
mode=kw.get('mode'),
|
||||
|
@ -634,8 +634,8 @@ class WhenGettingSecretsListUsingSecretsResource(FunctionalTest):
|
||||
# secrets.on_get function prior to searching the repo.
|
||||
self.secret_repo.get_by_create_date \
|
||||
.assert_called_once_with(self.keystone_id,
|
||||
offset_arg=self.offset,
|
||||
limit_arg=self.limit,
|
||||
offset_arg=u'{0}'.format(self.offset),
|
||||
limit_arg=u'{0}'.format(self.limit),
|
||||
suppress_exception=True,
|
||||
name=self.name,
|
||||
alg=None, mode=None,
|
||||
@ -654,10 +654,10 @@ class WhenGettingSecretsListUsingSecretsResource(FunctionalTest):
|
||||
|
||||
self.secret_repo.get_by_create_date \
|
||||
.assert_called_once_with(self.keystone_id,
|
||||
offset_arg=self.offset,
|
||||
limit_arg=self.limit,
|
||||
offset_arg=u'{0}'.format(self.offset),
|
||||
limit_arg=u'{0}'.format(self.limit),
|
||||
suppress_exception=True,
|
||||
name=None, alg=None, mode=None,
|
||||
name='', alg=None, mode=None,
|
||||
bits=0)
|
||||
|
||||
self.assertTrue('previous' in resp.namespace)
|
||||
@ -695,10 +695,10 @@ class WhenGettingSecretsListUsingSecretsResource(FunctionalTest):
|
||||
|
||||
self.secret_repo.get_by_create_date \
|
||||
.assert_called_once_with(self.keystone_id,
|
||||
offset_arg=self.offset,
|
||||
limit_arg=self.limit,
|
||||
offset_arg=u'{0}'.format(self.offset),
|
||||
limit_arg=u'{0}'.format(self.limit),
|
||||
suppress_exception=True,
|
||||
name=None, alg=None, mode=None,
|
||||
name='', alg=None, mode=None,
|
||||
bits=0)
|
||||
|
||||
self.assertFalse('previous' in resp.namespace)
|
||||
@ -1190,8 +1190,8 @@ class WhenGettingOrdersListUsingOrdersResource(FunctionalTest):
|
||||
|
||||
self.order_repo.get_by_create_date \
|
||||
.assert_called_once_with(self.keystone_id,
|
||||
offset_arg=self.offset,
|
||||
limit_arg=self.limit,
|
||||
offset_arg=u'{0}'.format(self.offset),
|
||||
limit_arg=u'{0}'.format(self.limit),
|
||||
suppress_exception=True)
|
||||
|
||||
self.assertTrue('previous' in resp.namespace)
|
||||
@ -1222,10 +1222,8 @@ class WhenGettingOrdersListUsingOrdersResource(FunctionalTest):
|
||||
|
||||
self.order_repo.get_by_create_date \
|
||||
.assert_called_once_with(self.keystone_id,
|
||||
offset_arg=self.params.get('offset',
|
||||
self.offset),
|
||||
limit_arg=self.params.get('limit',
|
||||
self.limit),
|
||||
offset_arg=u'{0}'.format(self.offset),
|
||||
limit_arg=u'{0}'.format(self.limit),
|
||||
suppress_exception=True)
|
||||
|
||||
self.assertFalse('previous' in resp.namespace)
|
||||
@ -1603,8 +1601,8 @@ class WhenGettingContainersListUsingResource(FunctionalTest):
|
||||
|
||||
self.container_repo.get_by_create_date \
|
||||
.assert_called_once_with(self.keystone_id,
|
||||
offset_arg=self.offset,
|
||||
limit_arg=self.limit,
|
||||
offset_arg=u'{0}'.format(self.offset),
|
||||
limit_arg=u'{0}'.format(self.limit),
|
||||
suppress_exception=True)
|
||||
|
||||
self.assertTrue('previous' in resp.namespace)
|
||||
@ -1641,8 +1639,8 @@ class WhenGettingContainersListUsingResource(FunctionalTest):
|
||||
|
||||
self.container_repo.get_by_create_date \
|
||||
.assert_called_once_with(self.keystone_id,
|
||||
offset_arg=self.offset,
|
||||
limit_arg=self.limit,
|
||||
offset_arg=u'{0}'.format(self.offset),
|
||||
limit_arg=u'{0}'.format(self.limit),
|
||||
suppress_exception=True)
|
||||
|
||||
self.assertFalse('previous' in resp.namespace)
|
||||
|
Loading…
x
Reference in New Issue
Block a user