From 6ae9a64013023ae2f5140b54d013d588aa7e8026 Mon Sep 17 00:00:00 2001 From: Jaroslav Henner Date: Wed, 5 Feb 2014 14:38:11 +0100 Subject: [PATCH] Do not produce extra whitespaces on Python 2.7.3. Also, make the version check hopefully less cryptic. Change-Id: I516ed7aa7b8c3a7f005997e7287c68de52eed54c --- jenkins_jobs/builder.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/jenkins_jobs/builder.py b/jenkins_jobs/builder.py index 0c9690436..37928ebff 100644 --- a/jenkins_jobs/builder.py +++ b/jenkins_jobs/builder.py @@ -35,9 +35,9 @@ logger = logging.getLogger(__name__) MAGIC_MANAGE_STRING = "" -# 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