Ticket #15936: patch.diff

File patch.diff, 814 bytes (added by Brant Steen <brant.steen@…>, 13 years ago)

Patch for SimplerXMLGenerator

  • django/utils/xmlutils.py

     
    55from xml.sax.saxutils import XMLGenerator
    66
    77class SimplerXMLGenerator(XMLGenerator):
    8     def addQuickElement(self, name, contents=None, attrs=None):
     8    def addQuickElement(self, name, contents=None, attrs=None, escape=True):
    99        "Convenience method for adding an element with no children"
    1010        if attrs is None: attrs = {}
    1111        self.startElement(name, attrs)
    1212        if contents is not None:
    13             self.characters(contents)
     13            if escape:
     14                self.characters(contents)
     15            else:
     16                self._write(contents)
    1417        self.endElement(name)
Back to Top