mitsuhiko/jinja2 — pull request #240 by msabramo (2013-06-06 05:48:56+00:00)
Title: Fix BytecodeCache error on Python 3

This adds a test that reproduces an error with `BytecodeCache` on Python 3:

```
marca@marca-mac:~/dev/git-repos/jinja2$ .tox/py33/bin/python run-tests.py -v jinja2.testsuite.bytecode_cache.ByteCodeCacheTestCase
test_simple (jinja2.testsuite.bytecode_cache.ByteCodeCacheTestCase) ... ERROR

======================================================================
ERROR: test_simple (jinja2.testsuite.bytecode_cache.ByteCodeCacheTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/marca/dev/git-repos/jinja2/jinja2/testsuite/bytecode_cache.py", line 29, in test_simple
tmpl = env.get_template('test.html')
File "/Users/marca/dev/git-repos/jinja2/jinja2/environment.py", line 791, in get_template
return self._load_template(name, self.make_globals(globals))
File "/Users/marca/dev/git-repos/jinja2/jinja2/environment.py", line 765, in _load_template
template = self.loader.load(self, name, globals)
File "/Users/marca/dev/git-repos/jinja2/jinja2/loaders.py", line 119, in load
bucket = bcc.get_bucket(environment, name, filename, source)
File "/Users/marca/dev/git-repos/jinja2/jinja2/bccache.py", line 176, in get_bucket
key = self.get_cache_key(name, filename)
File "/Users/marca/dev/git-repos/jinja2/jinja2/bccache.py", line 163, in get_cache_key
if isinstance(filename, unicode):
NameError: global name 'unicode' is not defined

----------------------------------------------------------------------
Ran 1 test in 0.001s

FAILED (errors=1)
```

and then fixes it by replacing `unicode` with `jinja2._compat.text_type`.