equal
deleted
inserted
replaced
28 import re |
28 import re |
29 from StringIO import StringIO |
29 from StringIO import StringIO |
30 |
30 |
31 from logilab.mtconverter import xml_escape, html_unescape |
31 from logilab.mtconverter import xml_escape, html_unescape |
32 from logilab.common.date import ustrftime |
32 from logilab.common.date import ustrftime |
|
33 from logilab.common.deprecation import deprecated |
33 |
34 |
34 from cubicweb.utils import JSString, json_dumps |
35 from cubicweb.utils import JSString, json_dumps |
35 |
36 |
36 |
37 |
37 def rql_for_eid(eid): |
38 def rql_for_eid(eid): |
132 'Float': print_float, |
133 'Float': print_float, |
133 'Decimal': print_float, |
134 'Decimal': print_float, |
134 'Interval': print_timedelta, |
135 'Interval': print_timedelta, |
135 } |
136 } |
136 |
137 |
|
138 @deprecated('[3.14] use req.printable_value(attrtype, value, ...)') |
137 def printable_value(req, attrtype, value, props=None, displaytime=True): |
139 def printable_value(req, attrtype, value, props=None, displaytime=True): |
138 """return a displayable value (i.e. unicode string)""" |
140 return req.printable_value(attrtype, value, props, displaytime) |
139 if value is None: |
|
140 return u'' |
|
141 try: |
|
142 printer = PRINTERS[attrtype] |
|
143 except KeyError: |
|
144 return unicode(value) |
|
145 return printer(value, req, props, displaytime) |
|
146 |
141 |
147 |
142 |
148 # text publishing ############################################################# |
143 # text publishing ############################################################# |
149 |
144 |
150 try: |
145 try: |