~grupoesoc/cubicerp-addons/7.0

« back to all changes in this revision

Viewing changes to report_geraldo/lib/geraldo/site/newsite/site-geraldo/django/utils/xmlutils.py

  • Committer: Cubic ERP
  • Date: 2014-01-07 15:38:09 UTC
  • Revision ID: info@cubicerp.com-20140107153809-4jmif3zoi8rcveve
[ADD] cubicReport

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
"""
 
2
Utilities for XML generation/parsing.
 
3
"""
 
4
 
 
5
from xml.sax.saxutils import XMLGenerator
 
6
 
 
7
class SimplerXMLGenerator(XMLGenerator):
 
8
    def addQuickElement(self, name, contents=None, attrs=None):
 
9
        "Convenience method for adding an element with no children"
 
10
        if attrs is None: attrs = {}
 
11
        self.startElement(name, attrs)
 
12
        if contents is not None:
 
13
            self.characters(contents)
 
14
        self.endElement(name)