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

Class XML

source code

  object --+    
           |    
XmlComponent --+
               |
              XML

use it to wrap a string that contains XML/HTML so that it will not be escaped by the template

Examples:

>>> XML('<h1>Hello</h1>').xml()
'<h1>Hello</h1>'
Instance Methods [hide private]
 
__init__(self, text, sanitize=False, permitted_tags=['a', 'b', 'blockquote', 'br/', 'i', 'li', 'ol', 'ul', 'p', 'c..., allowed_attributes={'a': ['href', 'title', 'target'], 'blockquote': ['type'], 'im...)
Args: text: the XML text sanitize: sanitize text using the permitted tags and allowed attributes (default False) permitted_tags: list of permitted tags (default: simple list of tags) allowed_attributes: dictionary of allowed attributed (default for A, IMG and BlockQuote).
source code
 
xml(self) source code
 
__str__(self)
str(x)
source code
 
__add__(self, other) source code
 
__radd__(self, other) source code
 
__cmp__(self, other) source code
 
__hash__(self)
hash(x)
source code
 
__getitem__(self, i) source code
 
__getslice__(self, i, j) source code
 
__iter__(self) source code
 
__len__(self) source code
 
flatten(self, render=None)
returns the text stored by the XML object rendered by the `render` function
source code
 
elements(self, *args, **kargs)
to be considered experimental since the behavior of this method is questionable another option could be `TAG(self.text).elements(*args,**kwargs)`
source code

Inherited from XmlComponent: __mul__, add_class, remove_class

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

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, text, sanitize=False, permitted_tags=['a', 'b', 'blockquote', 'br/', 'i', 'li', 'ol', 'ul', 'p', 'c..., allowed_attributes={'a': ['href', 'title', 'target'], 'blockquote': ['type'], 'im...)
(Constructor)

source code 

Args:
    text: the XML text
    sanitize: sanitize text using the permitted tags and allowed
        attributes (default False)
    permitted_tags: list of permitted tags (default: simple list of
        tags)
    allowed_attributes: dictionary of allowed attributed (default
        for A, IMG and BlockQuote).
        The key is the tag; the value is a list of allowed attributes.

Overrides: object.__init__

xml(self)

source code 
Overrides: XmlComponent.xml

__str__(self)
(Informal representation operator)

source code 

str(x)

Overrides: object.__str__
(inherited documentation)

__add__(self, other)
(Addition operator)

source code 
Overrides: XmlComponent.__add__

__hash__(self)
(Hashing function)

source code 

hash(x)

Overrides: object.__hash__
(inherited documentation)