Merge "Replaced use of webob.Request.str_param"
This commit is contained in:
commit
7041f19696
1
Authors
1
Authors
@ -33,6 +33,7 @@ Lorin Hochstein <lorin@isi.edu>
|
|||||||
Major Hayden <major@mhtx.net>
|
Major Hayden <major@mhtx.net>
|
||||||
Mark McLoughlin <markmc@redhat.com>
|
Mark McLoughlin <markmc@redhat.com>
|
||||||
Mark Washenberger <mark.washenberger@rackspace.com>
|
Mark Washenberger <mark.washenberger@rackspace.com>
|
||||||
|
Maru Newby <mnewby@internap.com>
|
||||||
Matt Dietz <matt.dietz@rackspace.com>
|
Matt Dietz <matt.dietz@rackspace.com>
|
||||||
Mike Lundy <mike@pistoncloud.com>
|
Mike Lundy <mike@pistoncloud.com>
|
||||||
Monty Taylor <mordred@inaugust.com>
|
Monty Taylor <mordred@inaugust.com>
|
||||||
|
@ -187,8 +187,8 @@ class Controller(controller.BaseController):
|
|||||||
params = {'filters': self._get_filters(req)}
|
params = {'filters': self._get_filters(req)}
|
||||||
|
|
||||||
for PARAM in SUPPORTED_PARAMS:
|
for PARAM in SUPPORTED_PARAMS:
|
||||||
if PARAM in req.str_params:
|
if PARAM in req.params:
|
||||||
params[PARAM] = req.str_params.get(PARAM)
|
params[PARAM] = req.params.get(PARAM)
|
||||||
return params
|
return params
|
||||||
|
|
||||||
def _get_filters(self, req):
|
def _get_filters(self, req):
|
||||||
@ -199,9 +199,9 @@ class Controller(controller.BaseController):
|
|||||||
:retval a dict of key/value filters
|
:retval a dict of key/value filters
|
||||||
"""
|
"""
|
||||||
query_filters = {}
|
query_filters = {}
|
||||||
for param in req.str_params:
|
for param in req.params:
|
||||||
if param in SUPPORTED_FILTERS or param.startswith('property-'):
|
if param in SUPPORTED_FILTERS or param.startswith('property-'):
|
||||||
query_filters[param] = req.str_params.get(param)
|
query_filters[param] = req.params.get(param)
|
||||||
if not filters.validate(param, query_filters[param]):
|
if not filters.validate(param, query_filters[param]):
|
||||||
raise HTTPBadRequest('Bad value passed to filter %s '
|
raise HTTPBadRequest('Bad value passed to filter %s '
|
||||||
'got %s' % (param,
|
'got %s' % (param,
|
||||||
|
@ -156,12 +156,12 @@ class Controller(object):
|
|||||||
else:
|
else:
|
||||||
filters['is_public'] = True
|
filters['is_public'] = True
|
||||||
|
|
||||||
for param in req.str_params:
|
for param in req.params:
|
||||||
if param in SUPPORTED_FILTERS:
|
if param in SUPPORTED_FILTERS:
|
||||||
filters[param] = req.str_params.get(param)
|
filters[param] = req.params.get(param)
|
||||||
if param.startswith('property-'):
|
if param.startswith('property-'):
|
||||||
_param = param[9:]
|
_param = param[9:]
|
||||||
properties[_param] = req.str_params.get(param)
|
properties[_param] = req.params.get(param)
|
||||||
|
|
||||||
if 'changes-since' in filters:
|
if 'changes-since' in filters:
|
||||||
isotime = filters['changes-since']
|
isotime = filters['changes-since']
|
||||||
@ -196,7 +196,7 @@ class Controller(object):
|
|||||||
def _get_limit(self, req):
|
def _get_limit(self, req):
|
||||||
"""Parse a limit query param into something usable."""
|
"""Parse a limit query param into something usable."""
|
||||||
try:
|
try:
|
||||||
limit = int(req.str_params.get('limit',
|
limit = int(req.params.get('limit',
|
||||||
self.conf.limit_param_default))
|
self.conf.limit_param_default))
|
||||||
except ValueError:
|
except ValueError:
|
||||||
raise exc.HTTPBadRequest(_("limit param must be an integer"))
|
raise exc.HTTPBadRequest(_("limit param must be an integer"))
|
||||||
@ -208,7 +208,7 @@ class Controller(object):
|
|||||||
|
|
||||||
def _get_marker(self, req):
|
def _get_marker(self, req):
|
||||||
"""Parse a marker query param into something usable."""
|
"""Parse a marker query param into something usable."""
|
||||||
marker = req.str_params.get('marker', None)
|
marker = req.params.get('marker', None)
|
||||||
|
|
||||||
if marker and not utils.is_uuid_like(marker):
|
if marker and not utils.is_uuid_like(marker):
|
||||||
msg = _('Invalid marker format')
|
msg = _('Invalid marker format')
|
||||||
@ -218,7 +218,7 @@ class Controller(object):
|
|||||||
|
|
||||||
def _get_sort_key(self, req):
|
def _get_sort_key(self, req):
|
||||||
"""Parse a sort key query param from the request object."""
|
"""Parse a sort key query param from the request object."""
|
||||||
sort_key = req.str_params.get('sort_key', None)
|
sort_key = req.params.get('sort_key', None)
|
||||||
if sort_key is not None and sort_key not in SUPPORTED_SORT_KEYS:
|
if sort_key is not None and sort_key not in SUPPORTED_SORT_KEYS:
|
||||||
_keys = ', '.join(SUPPORTED_SORT_KEYS)
|
_keys = ', '.join(SUPPORTED_SORT_KEYS)
|
||||||
msg = _("Unsupported sort_key. Acceptable values: %s") % (_keys,)
|
msg = _("Unsupported sort_key. Acceptable values: %s") % (_keys,)
|
||||||
@ -227,7 +227,7 @@ class Controller(object):
|
|||||||
|
|
||||||
def _get_sort_dir(self, req):
|
def _get_sort_dir(self, req):
|
||||||
"""Parse a sort direction query param from the request object."""
|
"""Parse a sort direction query param from the request object."""
|
||||||
sort_dir = req.str_params.get('sort_dir', None)
|
sort_dir = req.params.get('sort_dir', None)
|
||||||
if sort_dir is not None and sort_dir not in SUPPORTED_SORT_DIRS:
|
if sort_dir is not None and sort_dir not in SUPPORTED_SORT_DIRS:
|
||||||
_keys = ', '.join(SUPPORTED_SORT_DIRS)
|
_keys = ', '.join(SUPPORTED_SORT_DIRS)
|
||||||
msg = _("Unsupported sort_dir. Acceptable values: %s") % (_keys,)
|
msg = _("Unsupported sort_dir. Acceptable values: %s") % (_keys,)
|
||||||
@ -245,7 +245,7 @@ class Controller(object):
|
|||||||
|
|
||||||
def _get_is_public(self, req):
|
def _get_is_public(self, req):
|
||||||
"""Parse is_public into something usable."""
|
"""Parse is_public into something usable."""
|
||||||
is_public = req.str_params.get('is_public', None)
|
is_public = req.params.get('is_public', None)
|
||||||
|
|
||||||
if is_public is None:
|
if is_public is None:
|
||||||
# NOTE(vish): This preserves the default value of showing only
|
# NOTE(vish): This preserves the default value of showing only
|
||||||
@ -263,7 +263,7 @@ class Controller(object):
|
|||||||
|
|
||||||
def _parse_deleted_filter(self, req):
|
def _parse_deleted_filter(self, req):
|
||||||
"""Parse deleted into something usable."""
|
"""Parse deleted into something usable."""
|
||||||
deleted = req.str_params.get('deleted')
|
deleted = req.params.get('deleted')
|
||||||
if deleted is None:
|
if deleted is None:
|
||||||
return None
|
return None
|
||||||
return utils.bool_from_string(deleted)
|
return utils.bool_from_string(deleted)
|
||||||
|
Loading…
Reference in New Issue
Block a user