diff --git a/planet/reconstitute.py b/planet/reconstitute.py index eb1548a..f578c7e 100644 --- a/planet/reconstitute.py +++ b/planet/reconstitute.py @@ -35,7 +35,7 @@ def createTextElement(parent, name, value): def invalidate(c): """ replace invalid characters """ return '\xef\xbf\xbd' % \ - hex(ord(c.group(0)))[2:].rjust(4,'0') + ('000' + hex(ord(c.group(0)))[2:])[-4:] def ncr2c(value): """ convert numeric character references to characters """ diff --git a/planet/shell/xslt.py b/planet/shell/xslt.py index 6757d8f..1e6de03 100644 --- a/planet/shell/xslt.py +++ b/planet/shell/xslt.py @@ -13,7 +13,8 @@ def run(script, doc, output_file=None): # otherwise, use the command line interface dom = None import warnings - warnings.simplefilter('ignore', RuntimeWarning) + if hasattr(warnings, 'simplefilter'): + warnings.simplefilter('ignore', RuntimeWarning) docfile = os.tmpnam() file = open(docfile,'w') file.write(doc) diff --git a/tests/test_apply.py b/tests/test_apply.py index e035ab2..e737ee0 100644 --- a/tests/test_apply.py +++ b/tests/test_apply.py @@ -44,8 +44,8 @@ class ApplyTest(unittest.TestCase): content += 1 if div.getAttribute('xml:lang') == 'en-us': lang += 1 html.close() - self.assertEqual(3, lang) self.assertEqual(12, content) + self.assertEqual(3, lang) def test_apply_fancy(self): config.load(configfile % 'fancy') @@ -59,6 +59,6 @@ class ApplyTest(unittest.TestCase): # verify that index.html is well formed, has content, and xml:lang html = open(os.path.join(workdir, 'index.html')).read() - self.assertTrue('