mitsuhiko/jinja2 — pull request #183 by kuyan (2013-02-19 01:16:13+00:00)
Title: Fix fix `file` reference

The `file()` builtin was removed in Python 3. When `TemplateStream.dump()` is called, the following error is raised:

File "/Users/natan/.virtualenvs/robowolves/lib/python3.3/site-packages/jinja2/environment.py", line 1065, in dump
fp = file(fp, 'w')
NameError: global name 'file' is not defined

Replacing it with `open()` appears to work - I ran the unit tests on both Python 3.3 and Python 2.7 with no failures, but if someone could double-check them for me, that would be great.

However, this is not a complete fix - once the code in this pull request is applied, the following error occurs:

File "/Users/natan/.virtualenvs/plaster/src/jinja2/build/lib/jinja2/environment.py", line 1075, in dump
fp.writelines(iterable)
TypeError: must be str, not bytes

I'm not sure on how I should go about resolving this particular error.