Do not produce extra whitespaces on Python 2.7.3.

Also, make the version check hopefully less cryptic.

Change-Id: I516ed7aa7b8c3a7f005997e7287c68de52eed54c
This commit is contained in:
Jaroslav Henner 2014-02-05 14:38:11 +01:00
parent a32288a573
commit 6ae9a64013

View File

@ -35,9 +35,9 @@ logger = logging.getLogger(__name__)
MAGIC_MANAGE_STRING = "<!-- Managed by Jenkins Job Builder -->"
# Python 2.6's minidom toprettyxml produces broken output by adding extraneous
# whitespace around data. This patches the broken implementation with one taken
# from 2.7
# Python <= 2.7.3's minidom toprettyxml produces broken output by adding
# extraneous whitespace around data. This patches the broken implementation
# with one taken from Python > 2.7.3.
def writexml(self, writer, indent="", addindent="", newl=""):
# indent = current indentation
# addindent = indentation to add to higher levels
@ -66,7 +66,7 @@ def writexml(self, writer, indent="", addindent="", newl=""):
else:
writer.write("/>%s" % (newl))
if sys.hexversion < 0x02070000:
if sys.version_info[:3] <= (2, 7, 3):
minidom.Element.writexml = writexml