thanks for that Anthony .... I thought that in some automagicaly way web2py
was seriallizing/deserializing... ;)

by the way as the request.vars.vars contains "<Storage {'eeee': '5555',
'www': '4'}>" ast.literal_eval(request.vars.vars[9:-1]) did the trick

Just wondering if there is an easier way of doing it.... (I mean: to pass
the current URL+vars to the LOAD)


On Thu, May 17, 2012 at 1:03 PM, Anthony <abasta...@gmail.com> wrote:

> 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
>



-- 
Sebastian E. Ovide

Reply via email to