diff options
author | Chris Jerdonek <chris.jerdonek@gmail.com> | 2012-04-10 22:31:28 -0700 |
---|---|---|
committer | Chris Jerdonek <chris.jerdonek@gmail.com> | 2012-04-10 22:31:28 -0700 |
commit | 84e24e5e8451d1845129c4e9d7c3fcf10995ca08 (patch) | |
tree | 8aef5456af069c5e40b32cc8e9c024e6e3446b93 | |
parent | 9d1e3aad107b37794d383ff37fa3590c6f1bc45c (diff) | |
download | pystache-84e24e5e8451d1845129c4e9d7c3fcf10995ca08.tar.gz |
Tests now pass with Python 3.1.
-rw-r--r-- | README.rst | 2 | ||||
-rw-r--r-- | pystache/defaults.py | 7 | ||||
-rw-r--r-- | pystache/tests/test_renderer.py | 4 |
3 files changed, 10 insertions, 3 deletions
@@ -204,7 +204,7 @@ Author .. _Mustache: http://mustache.github.com/ .. _Mustache spec: https://github.com/mustache/spec .. _mustache(5): http://mustache.github.com/mustache.5.html -.. _nose: http://somethingaboutorange.com/mrl/projects/nose/0.11.1/testing.html +.. _nose: http://readthedocs.org/docs/nose/en/latest/ .. _only unicode strings: http://docs.python.org/howto/unicode.html#tips-for-writing-unicode-aware-programs .. _PyPI: http://pypi.python.org/pypi/pystache .. _Pystache: https://github.com/defunkt/pystache diff --git a/pystache/defaults.py b/pystache/defaults.py index bb989c5..e12e635 100644 --- a/pystache/defaults.py +++ b/pystache/defaults.py @@ -11,6 +11,13 @@ does not otherwise specify a value. try: # Python 3.2 deprecates cgi.escape() and adds the html module as a replacement. import html + try: + # We also need to verify the existence of the escape() method + # due to the following issue: + # http://bugs.python.org/issue14545 + html.escape + except AttributeError: + raise ImportError("html.escape does not exist") except ImportError: import cgi as html diff --git a/pystache/tests/test_renderer.py b/pystache/tests/test_renderer.py index c022079..64a4325 100644 --- a/pystache/tests/test_renderer.py +++ b/pystache/tests/test_renderer.py @@ -63,8 +63,8 @@ class RendererInitTestCase(unittest.TestCase): self.assertEqual(escape(">"), ">") self.assertEqual(escape('"'), """) - # Single quotes are escaped in Python 3 but not Python 2. - if sys.version_info < (3, ): + # Single quotes are escaped only in Python 3.2 and later. + if sys.version_info < (3, 2): expected = "'" else: expected = ''' |