entity.py
changeset 3230 1d25e928c299
parent 3185 bd0126d17e83
parent 3212 07d11bacfefe
child 3293 69c0ba095536
equal deleted inserted replaced
3199:fc63b80ec979 3230:1d25e928c299
   319         if value is None and metadata == 'encoding':
   319         if value is None and metadata == 'encoding':
   320             value = self.vreg.property_value('ui.encoding')
   320             value = self.vreg.property_value('ui.encoding')
   321         return value
   321         return value
   322 
   322 
   323     def printable_value(self, attr, value=_marker, attrtype=None,
   323     def printable_value(self, attr, value=_marker, attrtype=None,
   324                         format='text/html'):
   324                         format='text/html', displaytime=True):
   325         """return a displayable value (i.e. unicode string) which may contains
   325         """return a displayable value (i.e. unicode string) which may contains
   326         html tags
   326         html tags
   327         """
   327         """
   328         attr = str(attr)
   328         attr = str(attr)
   329         if value is _marker:
   329         if value is _marker:
   349             if attrformat:
   349             if attrformat:
   350                 encoding = self.attr_metadata(attr, 'encoding')
   350                 encoding = self.attr_metadata(attr, 'encoding')
   351                 return self.mtc_transform(value.getvalue(), attrformat, format,
   351                 return self.mtc_transform(value.getvalue(), attrformat, format,
   352                                           encoding)
   352                                           encoding)
   353             return u''
   353             return u''
   354         value = printable_value(self.req, attrtype, value, props)
   354         value = printable_value(self.req, attrtype, value, props,
       
   355                                 displaytime=displaytime)
   355         if format == 'text/html':
   356         if format == 'text/html':
   356             value = xml_escape(value)
   357             value = xml_escape(value)
   357         return value
   358         return value
   358 
   359 
   359     def mtc_transform(self, data, format, target_format, encoding,
   360     def mtc_transform(self, data, format, target_format, encoding,