Replaced use of webob.Request.str_param

* Changed webob.Request.str_param => webob.Request.param to
   ensure compatibility with WebOb >= 1.2.
 * Fixes bug 949677

Change-Id: I59c5af17fdef0754862ef6a0fda99978036112d9
This commit is contained in:
Maru Newby 2012-03-07 21:55:56 -08:00
parent 3b229c3945
commit 80cd81f714
3 changed files with 14 additions and 13 deletions

View File

@ -33,6 +33,7 @@ Lorin Hochstein <lorin@isi.edu>
Major Hayden <major@mhtx.net>
Mark McLoughlin <markmc@redhat.com>
Mark Washenberger <mark.washenberger@rackspace.com>
Maru Newby <mnewby@internap.com>
Matt Dietz <matt.dietz@rackspace.com>
Mike Lundy <mike@pistoncloud.com>
Monty Taylor <mordred@inaugust.com>

View File

@ -187,8 +187,8 @@ class Controller(controller.BaseController):
params = {'filters': self._get_filters(req)}
for PARAM in SUPPORTED_PARAMS:
if PARAM in req.str_params:
params[PARAM] = req.str_params.get(PARAM)
if PARAM in req.params:
params[PARAM] = req.params.get(PARAM)
return params
def _get_filters(self, req):
@ -199,9 +199,9 @@ class Controller(controller.BaseController):
:retval a dict of key/value filters
"""
query_filters = {}
for param in req.str_params:
for param in req.params:
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]):
raise HTTPBadRequest('Bad value passed to filter %s '
'got %s' % (param,

View File

@ -156,12 +156,12 @@ class Controller(object):
else:
filters['is_public'] = True
for param in req.str_params:
for param in req.params:
if param in SUPPORTED_FILTERS:
filters[param] = req.str_params.get(param)
filters[param] = req.params.get(param)
if param.startswith('property-'):
_param = param[9:]
properties[_param] = req.str_params.get(param)
properties[_param] = req.params.get(param)
if 'changes-since' in filters:
isotime = filters['changes-since']
@ -196,7 +196,7 @@ class Controller(object):
def _get_limit(self, req):
"""Parse a limit query param into something usable."""
try:
limit = int(req.str_params.get('limit',
limit = int(req.params.get('limit',
self.conf.limit_param_default))
except ValueError:
raise exc.HTTPBadRequest(_("limit param must be an integer"))
@ -208,7 +208,7 @@ class Controller(object):
def _get_marker(self, req):
"""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):
msg = _('Invalid marker format')
@ -218,7 +218,7 @@ class Controller(object):
def _get_sort_key(self, req):
"""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:
_keys = ', '.join(SUPPORTED_SORT_KEYS)
msg = _("Unsupported sort_key. Acceptable values: %s") % (_keys,)
@ -227,7 +227,7 @@ class Controller(object):
def _get_sort_dir(self, req):
"""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:
_keys = ', '.join(SUPPORTED_SORT_DIRS)
msg = _("Unsupported sort_dir. Acceptable values: %s") % (_keys,)
@ -245,7 +245,7 @@ class Controller(object):
def _get_is_public(self, req):
"""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:
# NOTE(vish): This preserves the default value of showing only
@ -263,7 +263,7 @@ class Controller(object):
def _parse_deleted_filter(self, req):
"""Parse deleted into something usable."""
deleted = req.str_params.get('deleted')
deleted = req.params.get('deleted')
if deleted is None:
return None
return utils.bool_from_string(deleted)