equal
deleted
inserted
replaced
40 def dc_title(self): |
40 def dc_title(self): |
41 """return a suitable *unicode* title for this entity""" |
41 """return a suitable *unicode* title for this entity""" |
42 for rschema, attrschema in self.e_schema.attribute_definitions(): |
42 for rschema, attrschema in self.e_schema.attribute_definitions(): |
43 if rschema.meta: |
43 if rschema.meta: |
44 continue |
44 continue |
45 value = self.get_value(rschema.type) |
45 value = self.cw_attr_value(rschema.type) |
46 if value: |
46 if value: |
47 # make the value printable (dates, floats, bytes, etc.) |
47 # make the value printable (dates, floats, bytes, etc.) |
48 return self.printable_value(rschema.type, value, attrschema.type, |
48 return self.printable_value(rschema.type, value, attrschema.type, |
49 format='text/plain') |
49 format='text/plain') |
50 return u'%s #%s' % (self.dc_type(), self.eid) |
50 return u'%s #%s' % (self.dc_type(), self.eid) |
105 """return a value which can be used to sort this entity or given |
105 """return a value which can be used to sort this entity or given |
106 entity's attribute |
106 entity's attribute |
107 """ |
107 """ |
108 if rtype is None: |
108 if rtype is None: |
109 return self.dc_title().lower() |
109 return self.dc_title().lower() |
110 value = self.get_value(rtype) |
110 value = self.cw_attr_value(rtype) |
111 # do not restrict to `unicode` because Bytes will return a `str` value |
111 # do not restrict to `unicode` because Bytes will return a `str` value |
112 if isinstance(value, basestring): |
112 if isinstance(value, basestring): |
113 return self.printable_value(rtype, format='text/plain').lower() |
113 return self.printable_value(rtype, format='text/plain').lower() |
114 return value |
114 return value |
115 |
115 |