aboutsummaryrefslogtreecommitdiffstats
path: root/mako/runtime.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2011-02-21 11:45:24 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2011-02-21 11:45:24 -0500
commit76f27c8002f7200a12a23e2b6f5dd7a38bc4c293 (patch)
tree87fe19a195cf40d35df5c1ce1cec229753d82bc3 /mako/runtime.py
parent1936fc61ef6d61b32324fbdc1e49b44241473b62 (diff)
downloadexternal_python_mako-76f27c8002f7200a12a23e2b6f5dd7a38bc4c293.tar.gz
external_python_mako-76f27c8002f7200a12a23e2b6f5dd7a38bc4c293.tar.bz2
external_python_mako-76f27c8002f7200a12a23e2b6f5dd7a38bc4c293.zip
- the "ascii encoding by default" approach doesn't work in Py3K,
because a string and an ascii encoded string are of course different things, and we'd like render() by default to return a string. So go the other way, use FEB in all cases, add a new flag bytestring_passthrough which goes back to StringIO, to support that one guy who wanted to force a bytestring through in an expression.
Diffstat (limited to 'mako/runtime.py')
-rw-r--r--mako/runtime.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/mako/runtime.py b/mako/runtime.py
index f57087f..dfd701a 100644
--- a/mako/runtime.py
+++ b/mako/runtime.py
@@ -645,13 +645,13 @@ def _render(template, callable_, args, data, as_unicode=False):
if as_unicode:
buf = util.FastEncodingBuffer(unicode=True)
- elif template.output_encoding:
+ elif template.bytestring_passthrough:
+ buf = util.StringIO()
+ else:
buf = util.FastEncodingBuffer(
unicode=as_unicode,
encoding=template.output_encoding,
errors=template.encoding_errors)
- else:
- buf = util.StringIO()
context = Context(buf, **data)
context._outputting_as_unicode = as_unicode
context._with_template = template