equal
deleted
inserted
replaced
54 new relation on an edited entity). |
54 new relation on an edited entity). |
55 """ |
55 """ |
56 if attr == 'modification_date': |
56 if attr == 'modification_date': |
57 return '%s DESC' % var |
57 return '%s DESC' % var |
58 return None |
58 return None |
59 |
|
60 @classmethod |
|
61 def __initialize__(cls): |
|
62 super(ANYENTITY, cls).__initialize__() # XXX |
|
63 # set a default_ATTR method for rich text format fields |
|
64 # XXX move this away once the old widgets have been dropped! |
|
65 eschema = cls.e_schema |
|
66 for metaattr, (metadata, attr) in eschema.meta_attributes().iteritems(): |
|
67 if metadata == 'format' and not hasattr(cls, 'default_%s' % metaattr): |
|
68 setattr(cls, 'default_%s' % metaattr, cls._default_format) |
|
69 |
59 |
70 # meta data api ########################################################### |
60 # meta data api ########################################################### |
71 |
61 |
72 def dc_title(self): |
62 def dc_title(self): |
73 """return a suitable *unicode* title for this entity""" |
63 """return a suitable *unicode* title for this entity""" |
266 |
256 |
267 @obsolete('use AutomaticEntityForm.[e]srelations_by_category') |
257 @obsolete('use AutomaticEntityForm.[e]srelations_by_category') |
268 def srelations_by_category(self, categories=None, permission=None): |
258 def srelations_by_category(self, categories=None, permission=None): |
269 from cubicweb.web.views.autoform import AutomaticEntityForm |
259 from cubicweb.web.views.autoform import AutomaticEntityForm |
270 return AutomaticEntityForm.esrelations_by_category(self, categories, permission) |
260 return AutomaticEntityForm.esrelations_by_category(self, categories, permission) |
271 |
|
272 def _default_format(self): |
|
273 return self.req.property_value('ui.default-text-format') |
|
274 |
261 |
275 def attribute_values(self, attrname): |
262 def attribute_values(self, attrname): |
276 if self.has_eid() or attrname in self: |
263 if self.has_eid() or attrname in self: |
277 try: |
264 try: |
278 values = self[attrname] |
265 values = self[attrname] |