app/django/utils/xmlutils.py
author Pawel Solyga <Pawel.Solyga@gmail.com>
Wed, 15 Oct 2008 13:59:52 +0000
changeset 337 cb7d22b1e7d8
parent 54 03e267d67478
permissions -rw-r--r--
Show "Created by" read-only field in Sponsor Edit view. Fix function keyword arguments in sponsor/list.py to follow our PythonStyleGuide. Sponsor founder property is not updated anymore when editing Sponsor profile, it's just saved once when creating Sponsor profile. Patch by: Pawel Solyga Review 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)