changeset 5449:ddf1cf299ebc

only encode output on Python 2
author Christof Meerwald <cmeerw@cmeerw.org>
date Thu, 19 Jul 2018 22:24:12 +0100
parents 754be676ccc8
children f2fade4552c5
files roundup/cgi/engine_jinja2.py
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/roundup/cgi/engine_jinja2.py	Thu Jul 19 22:23:53 2018 +0100
+++ b/roundup/cgi/engine_jinja2.py	Thu Jul 19 22:24:12 2018 +0100
@@ -34,6 +34,7 @@
 from __future__ import print_function
 import jinja2
 import gettext
+import sys
 
 from types import MethodType
 
@@ -87,7 +88,8 @@
         # [ ] limit the information passed to the minimal necessary set
         c = context(client, self, classname, request)
         c.update({'options': options})
-        return self._tpl.render(c).encode(client.charset, )
+        s = self._tpl.render(c)
+        return s if sys.version_info[0] > 2 else s.encode(client.STORAGE_CHARSET, )
 
     def __getitem__(self, name):
         # [ ] figure out what are these for

Roundup Issue Tracker: http://roundup-tracker.org/