Fixed bug in finalizer
--HG--
branch : trunk
diff --git a/jinja2/compiler.py b/jinja2/compiler.py
index a90526c..2d96d0d 100644
--- a/jinja2/compiler.py
+++ b/jinja2/compiler.py
@@ -1045,6 +1045,11 @@
if self.has_known_extends and frame.toplevel:
return
+ if self.environment.finalize:
+ finalize = lambda x: unicode(self.environment.finalize(x))
+ else:
+ finalize = unicode
+
self.newline(node)
# if we are in the toplevel scope and there was already an extends
@@ -1071,7 +1076,7 @@
const = const.__html__()
else:
const = escape(const)
- const = unicode(const)
+ const = finalize(const)
except:
# if something goes wrong here we evaluate the node
# at runtime for easier debugging