as expected of Anthony, fast and concise, thk that's what i needed.
El sábado, 30 de mayo de 2015, 14:24:58 (UTC-4), Anthony escribió:
>
> On Saturday, May 30, 2015 at 2:07:47 PM UTC-4, Yoel Benitez Fonseca wrote:
>>
>> hi! what methods i need to implement on a class of my own for it to get
>> serialized on views as in:
>>
>> {{=from}}
>>
>
> When an object is preceded with an "=" inside the template delimiters,
> that gets translated to response.write(object), which ultimately calls
> gluon.html.xmlescape
> <https://github.com/web2py/web2py/blob/master/gluon/html.py#L119> -- have
> a look at that to see how it serializes objects. Basically, your class
> should either have an .xml method or a .__str__ method that serializes the
> object as you like. If it has an .xml method, xmlescape will simply return
> that output of that method. If it has a .__str__ method, that will get
> called when xmlescape passes the object to str(), and after that, the
> output will be passed to cgi.escape before being returned (so, use the .xml
> method instead if you don't want the escaping to happen automatically).
>
> Anthony
>
--
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.