396 break |
396 break |
397 if mainattr == 'eid': |
397 if mainattr == 'eid': |
398 needcheck = False |
398 needcheck = False |
399 return mainattr, needcheck |
399 return mainattr, needcheck |
400 |
400 |
401 def attribute_metadata(self, attr, metadata): |
401 def attr_metadata(self, attr, metadata): |
402 """return a metadata for an attribute (None if unspecified)""" |
402 """return a metadata for an attribute (None if unspecified)""" |
403 value = getattr(self, '%s_%s' % (attr, metadata), None) |
403 value = getattr(self, '%s_%s' % (attr, metadata), None) |
404 if value is None and metadata == 'encoding': |
404 if value is None and metadata == 'encoding': |
405 value = self.vreg.property_value('ui.encoding') |
405 value = self.vreg.property_value('ui.encoding') |
406 return value |
406 return value |
423 if attrtype == 'String': |
423 if attrtype == 'String': |
424 # internalinalized *and* formatted string such as schema |
424 # internalinalized *and* formatted string such as schema |
425 # description... |
425 # description... |
426 if props.get('internationalizable'): |
426 if props.get('internationalizable'): |
427 value = self.req._(value) |
427 value = self.req._(value) |
428 attrformat = self.attribute_metadata(attr, 'format') |
428 attrformat = self.attr_metadata(attr, 'format') |
429 if attrformat: |
429 if attrformat: |
430 return self.mtc_transform(value, attrformat, format, |
430 return self.mtc_transform(value, attrformat, format, |
431 self.req.encoding) |
431 self.req.encoding) |
432 elif attrtype == 'Bytes': |
432 elif attrtype == 'Bytes': |
433 attrformat = self.attribute_metadata(attr, 'format') |
433 attrformat = self.attr_metadata(attr, 'format') |
434 if attrformat: |
434 if attrformat: |
435 encoding = self.attribute_metadata(attr, 'encoding') |
435 encoding = self.attr_metadata(attr, 'encoding') |
436 return self.mtc_transform(value.getvalue(), attrformat, format, |
436 return self.mtc_transform(value.getvalue(), attrformat, format, |
437 encoding) |
437 encoding) |
438 return u'' |
438 return u'' |
439 value = printable_value(self.req, attrtype, value, props, displaytime) |
439 value = printable_value(self.req, attrtype, value, props, displaytime) |
440 if format == 'text/html': |
440 if format == 'text/html': |