entity.py
branch3.5
changeset 3212 07d11bacfefe
parent 3184 613064b49331
child 3230 1d25e928c299
child 3241 1a6f7a0e7dbd
equal deleted inserted replaced
3210:44fa8d4a25d5 3212:07d11bacfefe
   425         if value is None and metadata == 'encoding':
   425         if value is None and metadata == 'encoding':
   426             value = self.vreg.property_value('ui.encoding')
   426             value = self.vreg.property_value('ui.encoding')
   427         return value
   427         return value
   428 
   428 
   429     def printable_value(self, attr, value=_marker, attrtype=None,
   429     def printable_value(self, attr, value=_marker, attrtype=None,
   430                         format='text/html'):
   430                         format='text/html', displaytime=True):
   431         """return a displayable value (i.e. unicode string) which may contains
   431         """return a displayable value (i.e. unicode string) which may contains
   432         html tags
   432         html tags
   433         """
   433         """
   434         attr = str(attr)
   434         attr = str(attr)
   435         if value is _marker:
   435         if value is _marker:
   455             if attrformat:
   455             if attrformat:
   456                 encoding = self.attr_metadata(attr, 'encoding')
   456                 encoding = self.attr_metadata(attr, 'encoding')
   457                 return self.mtc_transform(value.getvalue(), attrformat, format,
   457                 return self.mtc_transform(value.getvalue(), attrformat, format,
   458                                           encoding)
   458                                           encoding)
   459             return u''
   459             return u''
   460         value = printable_value(self.req, attrtype, value, props)
   460         value = printable_value(self.req, attrtype, value, props,
       
   461                                 displaytime=displaytime)
   461         if format == 'text/html':
   462         if format == 'text/html':
   462             value = xml_escape(value)
   463             value = xml_escape(value)
   463         return value
   464         return value
   464 
   465 
   465     def mtc_transform(self, data, format, target_format, encoding,
   466     def mtc_transform(self, data, format, target_format, encoding,