equal
deleted
inserted
replaced
25 import sys |
25 import sys |
26 from os.path import join, dirname, realpath |
26 from os.path import join, dirname, realpath |
27 from warnings import warn |
27 from warnings import warn |
28 from datetime import datetime, date, time, timedelta |
28 from datetime import datetime, date, time, timedelta |
29 from functools import reduce |
29 from functools import reduce |
|
30 |
|
31 from six import text_type, binary_type |
30 |
32 |
31 from logilab.common.decorators import cached, clear_cache |
33 from logilab.common.decorators import cached, clear_cache |
32 from logilab.common.deprecation import deprecated, class_deprecated |
34 from logilab.common.deprecation import deprecated, class_deprecated |
33 from logilab.common.modutils import cleanup_sys_modules |
35 from logilab.common.modutils import cleanup_sys_modules |
34 from logilab.common.registry import ( |
36 from logilab.common.registry import ( |
219 and returning the output as a string instead of requiring the [w]rite |
221 and returning the output as a string instead of requiring the [w]rite |
220 method as argument |
222 method as argument |
221 """ |
223 """ |
222 obj = self.select(oid, req, rset=rset, **kwargs) |
224 obj = self.select(oid, req, rset=rset, **kwargs) |
223 res = obj.render(**kwargs) |
225 res = obj.render(**kwargs) |
224 if isinstance(res, unicode): |
226 if isinstance(res, text_type): |
225 return res.encode(req.encoding) |
227 return res.encode(req.encoding) |
226 assert isinstance(res, str) |
228 assert isinstance(res, binary_type) |
227 return res |
229 return res |
228 |
230 |
229 def possible_views(self, req, rset=None, **kwargs): |
231 def possible_views(self, req, rset=None, **kwargs): |
230 """return an iterator on possible views for this result set |
232 """return an iterator on possible views for this result set |
231 |
233 |