doc: Fix incorrect example for req.get_param() in README.md

As of version 0.1.4, req.get_param() no longer accepts a "default"
parameter. Instead, callers are encourage to use the idiomatic
python "or" pattern. For example:

limit = req.get_param('limit') or 10

Fixes #132
This commit is contained in:
kgriffs
2013-05-10 12:14:02 -04:00
parent 8519e62b6d
commit 29b2027940
2 changed files with 4 additions and 4 deletions

View File

@@ -134,8 +134,8 @@ class ThingsResource:
self.logger = logging.getLogger('thingsapi.' + __name__)
def on_get(self, req, resp, user_id):
marker = req.get_param('marker', default='')
limit = req.get_param_as_int('limit', default=50)
marker = req.get_param('marker') or ''
limit = req.get_param_as_int('limit') or 50
try:
result = self.db.get_things(marker, limit)

View File

@@ -412,8 +412,8 @@ class Request(object):
Returns:
The value of the param if it is found and can be converted to an
integer. If the param is not found, returns None, unless
unless required is True.
integer. If the param is not found, returns None, unless required
is True.
Raises
HTTPBadRequest: The param was not found in the request, even though