Permalink
Browse files

Fix for #304

  • Loading branch information...
mitsuhiko committed Jun 6, 2014
1 parent c8c70ff commit 06badebe3b0985c9fe3365ab446f690d1af3a512
Showing with 6 additions and 5 deletions.
  1. +6 −5 jinja2/lexer.py
View
@@ -21,7 +21,7 @@
from jinja2.exceptions import TemplateSyntaxError
from jinja2.utils import LRUCache
from jinja2._compat import iteritems, implements_iterator, text_type, \
intern
intern, PY2
# cache for the lexers. Exists in order to be able to have multiple
@@ -578,10 +578,11 @@ def wrap(self, stream, name=None, filename=None):
# we do that for support of semi broken APIs
# as datetime.datetime.strftime. On python 3 this
# call becomes a noop thanks to 2to3
try:
value = str(value)
except UnicodeError:
pass
if PY2:
try:
value = value.encode('ascii')
except UnicodeError:
pass
elif token == 'integer':
value = int(value)
elif token == 'float':

0 comments on commit 06badeb

Please sign in to comment.