Esempio n. 1
0
 def startElement(self, name, attrs):
     """ saxutils.XMLGenerator.startElement() expects name and attrs to be
         unicode and bad things happen if any of them is (utf-8) encoded.
         We override the method here to sanitize this case.
         Can be removed once we drop Python2 support.
     """
     if PY2:
         attrs = {b2u(name): b2u(value) for name, value in attrs.items()}
     saxutils.XMLGenerator.startElement(self, name, attrs)
Esempio n. 2
0
 def startElement(self, name, attrs):
     """ saxutils.XMLGenerator.startElement() expects name and attrs to be
         unicode and bad things happen if any of them is (utf-8) encoded.
         We override the method here to sanitize this case.
         Can be removed once we drop Python2 support.
     """
     if PY2:
         attrs = {b2u(name): b2u(value) for name, value in attrs.items()}
     saxutils.XMLGenerator.startElement(self, name, attrs)
Esempio n. 3
0
 def simpleElement(self, name, attrs):
     """ slightly modified startElement()
     """
     if PY2:
         self._write(u"<" + b2u(name))
         for (name, value) in attrs.items():
             self._write(u" %s=%s" % (b2u(name), saxutils.quoteattr(b2u(value))))
         self._write(u"/>")
     else:
         self._write("<" + name)
         for (name, value) in attrs.items():
             self._write(" %s=%s" % (name, saxutils.quoteattr(value)))
         self._write("/>")
Esempio n. 4
0
 def simpleElement(self, name, attrs):
     """ slightly modified startElement()
     """
     if PY2:
         self._write(u'<' + b2u(name))
         for (name, value) in attrs.items():
             self._write(u' %s=%s' %
                         (b2u(name), saxutils.quoteattr(b2u(value))))
         self._write(u'/>')
     else:
         self._write('<' + name)
         for (name, value) in attrs.items():
             self._write(' %s=%s' % (name, saxutils.quoteattr(value)))
         self._write('/>')
Esempio n. 5
0
 def simpleElement(self, name, attrs):
     """ slightly modified startElement()
     """
     if PY2:
         self._write(u'<' + b2u(name))
         for (name, value) in attrs.items():
             self._write(u' %s=%s' % (b2u(name),
                                      saxutils.quoteattr(b2u(value))))
         self._write(u'/>')
     else:
         self._write('<' + name)
         for (name, value) in attrs.items():
             self._write(' %s=%s' % (name, saxutils.quoteattr(value)))
         self._write('/>')
Esempio n. 6
0
 def ignorableWhitespace(self, content):
     """ saxutils.XMLGenerator.ignorableWhitespace() expects content to be
         unicode and bad things happen if it's (utf-8) encoded.
         We override the method here to sanitize this case.
         Can be removed once we drop Python2 support.
     """
     saxutils.XMLGenerator.ignorableWhitespace(self, b2u(content))
Esempio n. 7
0
 def endElement(self, name):
     """ saxutils.XMLGenerator.endElement() expects name to be
         unicode and bad things happen if it's (utf-8) encoded.
         We override the method here to sanitize this case.
         Can be removed once we drop Python2 support.
     """
     saxutils.XMLGenerator.endElement(self, b2u(name))
Esempio n. 8
0
 def ignorableWhitespace(self, content):
     """ saxutils.XMLGenerator.ignorableWhitespace() expects content to be
         unicode and bad things happen if it's (utf-8) encoded.
         We override the method here to sanitize this case.
         Can be removed once we drop Python2 support.
     """
     saxutils.XMLGenerator.ignorableWhitespace(self, b2u(content))
Esempio n. 9
0
 def endElement(self, name):
     """ saxutils.XMLGenerator.endElement() expects name to be
         unicode and bad things happen if it's (utf-8) encoded.
         We override the method here to sanitize this case.
         Can be removed once we drop Python2 support.
     """
     saxutils.XMLGenerator.endElement(self, b2u(name))
Esempio n. 10
0
 def set(self, key, value):
     _key = b2u(key.strip())
     self._config[_key] = b2u(value.strip())
     if _key in self._deleted:
         self._deleted.remove(_key)
Esempio n. 11
0
 def set(self, key, value):
     _key = b2u(key.strip())
     self._config[_key] = b2u(value.strip())
     if _key in self._deleted:
         self._deleted.remove(_key)