summaryrefslogtreecommitdiff
path: root/pystache
diff options
context:
space:
mode:
authorChris Jerdonek <chris.jerdonek@gmail.com>2012-04-02 06:07:37 -0700
committerChris Jerdonek <chris.jerdonek@gmail.com>2012-04-02 19:24:19 -0700
commite0f1403939c4326ac99aff9ae84d375f76fbe770 (patch)
treec646c9d82ee9b1f079688e12f3faa7b08fefa854 /pystache
parentfc9f9659079bee827cc5dda96e9b09bbf9583cc7 (diff)
downloadpystache-e0f1403939c4326ac99aff9ae84d375f76fbe770.tar.gz
Removed a use of the Python ternary operator (for Python 2.4 support).
Diffstat (limited to 'pystache')
-rw-r--r--pystache/renderer.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/pystache/renderer.py b/pystache/renderer.py
index 86d349f..5bd2a3f 100644
--- a/pystache/renderer.py
+++ b/pystache/renderer.py
@@ -138,8 +138,11 @@ class Renderer(object):
Convert a basestring to unicode, preserving any unicode subclass.
"""
- # Avoid the "double-decoding" TypeError.
- return s if isinstance(s, unicode) else self.unicode(s)
+ # We type-check to avoid "TypeError: decoding Unicode is not supported".
+ # We avoid the Python ternary operator for Python 2.4 support.
+ if isinstance(s, unicode):
+ return s
+ return self.unicode(s)
def _to_unicode_hard(self, s):
"""