diff options
author | Armin Ronacher <armin.ronacher@active-4.com> | 2013-05-19 14:43:18 +0100 |
---|---|---|
committer | Armin Ronacher <armin.ronacher@active-4.com> | 2013-05-19 14:43:18 +0100 |
commit | 7e239b4d165975d72beedcf6c653ce3d0cf18aa4 (patch) | |
tree | 7f094bb6ae584ddb50a123b4a846ee2ea9e4934a /jinja2/environment.py | |
parent | 7e245e26788d140d661034047f1f59619436ad4b (diff) | |
download | jinja2-7e239b4d165975d72beedcf6c653ce3d0cf18aa4.tar.gz |
Added unicode mixin for unified string logic
Diffstat (limited to 'jinja2/environment.py')
-rw-r--r-- | jinja2/environment.py | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/jinja2/environment.py b/jinja2/environment.py index cbac8c1..bf56d0f 100644 --- a/jinja2/environment.py +++ b/jinja2/environment.py @@ -28,7 +28,7 @@ from jinja2.exceptions import TemplateSyntaxError, TemplateNotFound, \ from jinja2.utils import import_string, LRUCache, Markup, missing, \ concat, consume, internalcode, _encode_filename from jinja2._compat import imap, ifilter, string_types, iteritems, \ - text_type, reraise, PY2, Iterator, next + text_type, reraise, Iterator, next, UnicodeMixin from functools import reduce @@ -1051,7 +1051,7 @@ class Template(object): return '<%s %s>' % (self.__class__.__name__, name) -class TemplateModule(object): +class TemplateModule(UnicodeMixin): """Represents an imported template. All the exported names of the template are available as attributes on this object. Additionally converting it into an unicode- or bytestrings renders the contents. @@ -1068,13 +1068,6 @@ class TemplateModule(object): def __unicode__(self): return concat(self._body_stream) - if PY2: - def __str__(self): - return self.__unicode__().encode('utf-8') - else: - __str__ = __unicode__ - del __unicode__ - def __repr__(self): if self.__name__ is None: name = 'memory:%x' % id(self) |