Permalink
Browse files

The get_json() method should be used instead.

  • Loading branch information...
1 parent 679d300 commit b5aae7f20996470884236d5153c3b00e244be5a9 @nycholas nycholas committed Jul 7, 2014
Showing with 2 additions and 2 deletions.
  1. +2 −2 examples/decorator/decorator.py
@@ -48,7 +48,7 @@
def check_terminal_id(fn):
def wrapped():
- terminal_id = int(request.json.get('terminal_id', 0))
+ terminal_id = int(request.get_json(silent=True).get('terminal_id', 0))
if terminal_id <= 0:
raise OtherError('Invalid terminal ID')
return fn()
@@ -57,7 +57,7 @@ def wrapped():
@jsonrpc.method('App.index')
@check_terminal_id
def index():
- return u'Terminal ID: {0}'.format(request.json['terminal_id'])
+ return u'Terminal ID: {0}'.format(request.get_json(silent=True).get('terminal_id', 0))
if __name__ == '__main__':

0 comments on commit b5aae7f

Please sign in to comment.