Solved.
I have found an answer from Massimo:
https://groups.google.com/forum/#!topic/web2py/aqECpxiPTqw
A code like
Field('data','text',filter_in=(lambda x: pickle.dumps(x)),filter_out=(lambda
s: s and pickle.loads(s)),default=None)
works fine.
But why is it not possible to use json?
2014-03-30 0:11 GMT+01:00 Martin Weissenboeck <[email protected]>:
> Let's say I have
> URL(f="myfunction", vars=dict(x=1))
> or
> v = {"f":"myfunction", "vars":{"x":1}}
> URL(**v)
>
> That works fine.
>
> Now I do
> j = json.dumps(v)
>
> I store j in
> Field("url", requires=IS_JSON())
>
> Now I read this field and call URL(**fieldvalue). I get an error:
>
> <type 'exceptions.SyntaxError'> when calling URL, function or function
> name required
>
> The fieldvalue I get is
> {'u'f : u'festfunction' ... }
>
> The key is a unicode string and not utf-8 coded.
>
> What is wrong? How can I get an utf-8 string?
>
> Regards, Martin
>
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.