From e0f1403939c4326ac99aff9ae84d375f76fbe770 Mon Sep 17 00:00:00 2001 From: Chris Jerdonek Date: Mon, 2 Apr 2012 06:07:37 -0700 Subject: Removed a use of the Python ternary operator (for Python 2.4 support). --- pystache/renderer.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'pystache/renderer.py') 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): """ -- cgit v1.2.1