From 768b49224c439e250ee437a44df14a5e2e1f7f73 Mon Sep 17 00:00:00 2001 From: mdipierro Date: Thu, 27 Jun 2013 01:51:03 -0500 Subject: [PATCH] fixed Issue 1563:Web2py in error when the request contains a json string corresponding to a list, thanks Hono Sandai --- VERSION | 2 +- gluon/main.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/VERSION b/VERSION index 34a64fc1..06191ec8 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.6.0-development+timestamp.2013.06.26.05.11.38 +Version 2.6.0-development+timestamp.2013.06.27.01.50.11 diff --git a/gluon/main.py b/gluon/main.py index 1a9c268f..c0851c02 100644 --- a/gluon/main.py +++ b/gluon/main.py @@ -339,8 +339,9 @@ def parse_get_post_vars(request, environ): json_vars = {} pass # update vars and get_vars with what was posted as json - request.get_vars.update(json_vars) - request.vars.update(json_vars) + if isinstance(json_vars,dict): + request.get_vars.update(json_vars) + request.vars.update(json_vars) # parse POST variables on POST, PUT, BOTH only in post_vars @@ -386,7 +387,7 @@ def parse_get_post_vars(request, environ): if len(pvalue): request.post_vars[key] = (len(pvalue) > 1 and pvalue) or pvalue[0] - if is_json: + if is_json and isinstance(json_vars,dict): # update post_vars with what was posted as json request.post_vars.update(json_vars)