Package web2py :: Package gluon :: Module html :: Class BEAUTIFY
[hide private]
[frames] | no frames]

Class BEAUTIFY

source code

  object --+        
           |        
XmlComponent --+    
               |    
             DIV --+
                   |
                  BEAUTIFY


example::

    >>> BEAUTIFY(['a', 'b', {'hello': 'world'}]).xml()
    '<div><table><tr><td><div>a</div></td></tr><tr><td><div>b</div></td></tr><tr><td><div><table><tr><td style="font-weight:bold;">hello</td><td valign="top">:</td><td><div>world</div></td></tr></table></div></td></tr></table></div>'

turns any list, dictionary, etc into decent looking html.
Two special attributes are
:sorted: a function that takes the dict and returned sorted keys
:keyfilter: a funciton that takes a key and returns its representation
            or None if the key is to be skipped. By default key[:1]=='_' is skipped.



Instance Methods [hide private]
 
__init__(self, component, **attributes)
:param *components: any components that should be nested in this element :param **attributes: any attributes you want to give to this element
source code

Inherited from DIV: __delitem__, __getitem__, __len__, __nonzero__, __setitem__, __str__, append, element, elements, flatten, insert, sibling, siblings, update, xml

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__

Static Methods [hide private]
 
no_underscore(key) source code
Class Variables [hide private]
  tag = 'div'

Inherited from DIV: regex_attr, regex_class, regex_id, regex_tag

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, component, **attributes)
(Constructor)

source code 

:param *components: any components that should be nested in this element :param **attributes: any attributes you want to give to this element

:raises SyntaxError: when a stand alone tag receives components
Overrides: DIV.__init__
(inherited documentation)