]> git.ipfire.org Git - thirdparty/jinja.git/commitdiff
Fix Python 3 compatibility of BytecodeCache by checking for `if
authorMarc Abramowitz <marc@marc-abramowitz.com>
Thu, 6 Jun 2013 05:40:03 +0000 (22:40 -0700)
committerArmin Ronacher <armin.ronacher@active-4.com>
Wed, 7 Aug 2013 11:30:38 +0000 (12:30 +0100)
isinstance(filename, text_type)` instead of `if isinstance(filename,
unicode)`

jinja2/bccache.py

index b534e27123d2a3d5f1fe8c47c169a6fd1996ef45..f2f9db61b31c552e2ebac965004330ba9ff517b0 100644 (file)
@@ -21,7 +21,7 @@ import tempfile
 import fnmatch
 from hashlib import sha1
 from jinja2.utils import open_if_exists
-from jinja2._compat import BytesIO, pickle, PY2
+from jinja2._compat import BytesIO, pickle, PY2, text_type
 
 
 # marshal works better on 3.x, one hack less required
@@ -160,7 +160,7 @@ class BytecodeCache(object):
         hash = sha1(name.encode('utf-8'))
         if filename is not None:
             filename = '|' + filename
-            if isinstance(filename, unicode):
+            if isinstance(filename, text_type):
                 filename = filename.encode('utf-8')
             hash.update(filename)
         return hash.hexdigest()