On Feb 8, 2011, at 3:56 AM, Manuele Pesenti wrote:
> 
> I'm trying pass some variables from one one controller/function to another 
> using the command:
> 
> URL(request.application, 'myControler', 'myFunction', vars=dict(myVar=myVar))
> 
> but when I call request.vars.myVar I get a string type object even if myVar 
> was a dictionary. I cannot bypass this problem using the json library because 
> it causes an early return of the function. I tried:
> 
> import gluon.contrib.simplejson as sj
> 
> myVar = request.vars.myVar
> myVar = sj.loads(myVar)
> 
> and after that any command are not executed... any suggestion?

request.vars represents the query string of the URL to be generated, which must 
itself be a string. If you want to pass something else in the query string, 
it's up to you to make a string of it. You could pass a json-encoded myVar, for 
example. URL won't encode it for you, because it has no way of knowing what 
kind of encoding the recipient expects.

Reply via email to