app/django/utils/xmlutils.py
author Sverre Rabbelier <srabbelier@gmail.com>
Wed, 11 Feb 2009 23:59:41 +0000
changeset 1274 5f87d9807b77
parent 54 03e267d67478
permissions -rw-r--r--
Rename TinyMCE to FullTinyMCE and add TinyMCE widget The FullTinyMCE (irony intended) is the full-fledged editor, usefull in editing documents etc. The regular TinyMCE widget can be used for smaller tasks that allow HTML input (such as the description field). Patch by: Sverre Rabbelier

"""
Utilities for XML generation/parsing.
"""

from xml.sax.saxutils import XMLGenerator

class SimplerXMLGenerator(XMLGenerator):
    def addQuickElement(self, name, contents=None, attrs=None):
        "Convenience method for adding an element with no children"
        if attrs is None: attrs = {}
        self.startElement(name, attrs)
        if contents is not None:
            self.characters(contents)
        self.endElement(name)