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

Class BEAUTIFY

source code

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


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 function that takes a key and returns its representation or
  None if the key is to be skipped.
  By default key[:1]=='_' is skipped.

Examples:

>>> 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;vertical-align:top;">hello</td><td style="vertical-align:top;">:</td><td><div>world</div></td></tr></table></div></td></tr></table></div>'

Instance Methods [hide private]
 
__init__(self, component, **attributes)
Args: components: any components that should be nested in this element 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 XmlComponent: __add__, __mul__, add_class, remove_class

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

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 

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

Raises:
    SyntaxError: when a stand alone tag receives components

Overrides: object.__init__
(inherited documentation)