I went for something even simpler : I bypass BEAUTIFUL.. I just wanted a
view with everything named :
def my_beautify(component):
t = TABLE()
if isinstance(component, dict):
for k, v in component.iteritems():
if v is None or isinstance(v, (bool, str)):
t.append(TR([str(k), str(v), ' ']))
else:
t.append(TR([str(k), repr(v), str(dir(v))]))
return t
Thanks to both of you ! :)
On Friday, March 24, 2017 at 12:08:16 AM UTC+1, Anthony wrote:
>
> BEAUTIFY is not designed to take the entire global environment. The
> problem is that globals() includes all of the web2py HTML helper classes.
> Because BEAUTIFY is itself an HTML helper, it is serialized by recursively
> processing its components. The serialization process checks whether a given
> component has a callable "xml" attribute, and assuming such an attribute is
> an instance method, it attempts to call .xml(). The problem is the helper
> classes themselves do have a callable "xml" attribute, but it is not
> actually an instance method in that case (it is simply an attribute that
> belongs to the class itself) -- so calling it generates an exception.
>
> You might try something like:
>
> BEAUTIFY({k: v for k, v in globals().iteritems() if not hasattr(v, 'xml'
> )})
>
> But you're probably asking for trouble attempting to display the entire
> global environment.
>
> 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.