comparison 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
comparison
equal deleted inserted replaced
5448:754be676ccc8 5449:ddf1cf299ebc
32 """ 32 """
33 33
34 from __future__ import print_function 34 from __future__ import print_function
35 import jinja2 35 import jinja2
36 import gettext 36 import gettext
37 import sys
37 38
38 from types import MethodType 39 from types import MethodType
39 40
40 # http://jinja.pocoo.org/docs/api/#loaders 41 # http://jinja.pocoo.org/docs/api/#loaders
41 42
85 86
86 def render(self, client, classname, request, **options): 87 def render(self, client, classname, request, **options):
87 # [ ] limit the information passed to the minimal necessary set 88 # [ ] limit the information passed to the minimal necessary set
88 c = context(client, self, classname, request) 89 c = context(client, self, classname, request)
89 c.update({'options': options}) 90 c.update({'options': options})
90 return self._tpl.render(c).encode(client.charset, ) 91 s = self._tpl.render(c)
92 return s if sys.version_info[0] > 2 else s.encode(client.STORAGE_CHARSET, )
91 93
92 def __getitem__(self, name): 94 def __getitem__(self, name):
93 # [ ] figure out what are these for 95 # [ ] figure out what are these for
94 raise NotImplemented 96 raise NotImplemented
95 #return self._pt[name] 97 #return self._pt[name]

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