diff roundup/cgi/engine_jinja2.py @ 5449:ddf1cf299ebc

only encode output on Python 2
author Christof Meerwald <cmeerw@cmeerw.org>
date Thu, 19 Jul 2018 22:24:12 +0100
parents 56c9bcdea47f
children 91391a366d92
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/