app/django/utils/xmlutils.py
author Sverre Rabbelier <srabbelier@gmail.com>
Mon, 20 Oct 2008 23:24:21 +0000
changeset 399 b82852e6963e
parent 54 03e267d67478
permissions -rw-r--r--
Various improvements to the generic View code Among others: * Added the 'page' argument to the simple.errorResponse call * Pass the result of getEmptyKeyFields to edit() in create() * Fix typo's in error responses * Fixed a todo to properly redirect on create * Made editPost return something when the form is not valid * Added an _editGet hook Patch by: Sverre Rabbelier Reviewed by: to-be-reviewed

"""
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)