Skip to content

Commit

Permalink
Provide support for request.params even on a Flask request
Browse files Browse the repository at this point in the history
It is used all over the place and they both are dict-like objects
  • Loading branch information
amercader committed Jun 15, 2016
1 parent 871eeb8 commit 2f2e972
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions ckan/common.py
Expand Up @@ -42,6 +42,16 @@ class Request(object):
Wraps the request object, returning attributes from either the Flask or
Pylons request object, depending of whether flask.request is available.
'''

@property
def params(self):
''' Special case as request.params is used all over the place.
'''
if is_flask():
return flask.request.args
else:
return pylons.request.params

def __getattr__(self, name):
if is_flask():
return getattr(flask.request, name, None)
Expand Down

0 comments on commit 2f2e972

Please sign in to comment.