be more safe with getting json aprams

This commit is contained in:
termie 2012-02-01 16:51:46 -08:00
parent a703983713
commit 40525e0e52
1 changed files with 7 additions and 3 deletions

View File

@ -89,9 +89,13 @@ class JsonBodyMiddleware(wsgi.Middleware):
if not params_json:
return
params_parsed = json.loads(params_json)
if not params_parsed:
params_parsed = {}
params_parsed = {}
try:
params_parsed = json.loads(params_json)
finally:
if not params_parsed:
params_parsed = {}
params = {}
for k, v in params_parsed.iteritems():
if k in ('self', 'context'):