equal
deleted
inserted
replaced
21 |
21 |
22 import sys |
22 import sys |
23 from os.path import join, dirname, realpath |
23 from os.path import join, dirname, realpath |
24 from datetime import datetime, date, time, timedelta |
24 from datetime import datetime, date, time, timedelta |
25 from functools import reduce |
25 from functools import reduce |
26 |
|
27 from six import text_type, binary_type |
|
28 |
26 |
29 from logilab.common.decorators import cached, clear_cache |
27 from logilab.common.decorators import cached, clear_cache |
30 from logilab.common.deprecation import class_deprecated |
28 from logilab.common.deprecation import class_deprecated |
31 from logilab.common.modutils import clean_sys_modules |
29 from logilab.common.modutils import clean_sys_modules |
32 from logilab.common.registry import RegistryStore, Registry, ObjectNotFound, RegistryNotFound |
30 from logilab.common.registry import RegistryStore, Registry, ObjectNotFound, RegistryNotFound |
216 and returning the output as a string instead of requiring the [w]rite |
214 and returning the output as a string instead of requiring the [w]rite |
217 method as argument |
215 method as argument |
218 """ |
216 """ |
219 obj = self.select(oid, req, rset=rset, **kwargs) |
217 obj = self.select(oid, req, rset=rset, **kwargs) |
220 res = obj.render(**kwargs) |
218 res = obj.render(**kwargs) |
221 if isinstance(res, text_type): |
219 if isinstance(res, str): |
222 return res.encode(req.encoding) |
220 return res.encode(req.encoding) |
223 assert isinstance(res, binary_type) |
221 assert isinstance(res, bytes) |
224 return res |
222 return res |
225 |
223 |
226 def possible_views(self, req, rset=None, **kwargs): |
224 def possible_views(self, req, rset=None, **kwargs): |
227 """return an iterator on possible views for this result set |
225 """return an iterator on possible views for this result set |
228 |
226 |