>
> As I pass it as vars via LOAD: 
>
>         {{=LOAD('default',
>         'send_suggestion', 
>         vars={ 'c':request.controller,
>         'f':request.function,
>         'args':request.args,
>         'vars':request.vars},
>         ajax_trap=True)}}
>
> does it mean that request.vars  has not been serialized/deserialized 
> correctly ?
>

When you pass a dict as a URL var, the dict is converted to a string 
representation of the dict and then urlencoded. When it is decoded, you 
have a string representation of the dict (equivalent to repr(request.vars) 
in this case), not the dict itself (actually, I think it's a list with the 
string representation of the dict as its sole element). To get the dict 
back, you can safely eval it using ast.literal_eval:

import ast
_vars = ast.literal_eval(request.vars.vars[0]) if request.vars.vars else {}

Anthony

Reply via email to