equal
deleted
inserted
replaced
87 return None |
87 return None |
88 |
88 |
89 @classmethod |
89 @classmethod |
90 def __initialize__(cls): |
90 def __initialize__(cls): |
91 super(ANYENTITY, cls).__initialize__() # XXX |
91 super(ANYENTITY, cls).__initialize__() # XXX |
|
92 # set a default_ATTR method for rich text format fields |
|
93 # XXX move this away once the old widgets have been dropped! |
92 eschema = cls.e_schema |
94 eschema = cls.e_schema |
93 eschema.format_fields = {} |
95 for metaattr, (metadata, attr) in eschema.meta_attributes().iteritems(): |
94 # set a default_ATTR method for rich text format fields |
96 if metadata == 'format' and not hasattr(cls, 'default_%s' % metaattr): |
95 for attr, formatattr in eschema.rich_text_fields(): |
97 setattr(cls, 'default_%s' % metaattr, cls._default_format) |
96 if not hasattr(cls, 'default_%s' % formatattr): |
|
97 setattr(cls, 'default_%s' % formatattr, cls._default_format) |
|
98 eschema.format_fields[formatattr] = attr |
|
99 |
98 |
100 # meta data api ########################################################### |
99 # meta data api ########################################################### |
101 |
100 |
102 def dc_title(self): |
101 def dc_title(self): |
103 """return a suitable *unicode* title for this entity""" |
102 """return a suitable *unicode* title for this entity""" |
412 |
411 |
413 def use_fckeditor(self, attr): |
412 def use_fckeditor(self, attr): |
414 """return True if fckeditor should be used to edit entity's attribute named |
413 """return True if fckeditor should be used to edit entity's attribute named |
415 `attr`, according to user preferences |
414 `attr`, according to user preferences |
416 """ |
415 """ |
417 if self.req.use_fckeditor() and self.has_format(attr): |
416 if self.req.use_fckeditor() and self.has_metadata(attr, 'format'): |
418 if self.has_eid() or '%s_format' % attr in self: |
417 if self.has_eid() or '%s_format' % attr in self: |
419 return self.format(attr) == 'text/html' |
418 return self.attribute_metadata(attr, 'format') == 'text/html' |
420 return self.req.property_value('ui.default-text-format') == 'text/html' |
419 return self.req.property_value('ui.default-text-format') == 'text/html' |
421 return False |
420 return False |
422 |
421 |
423 # XXX: store a reference to the AnyEntity class since it is hijacked in goa |
422 # XXX: store a reference to the AnyEntity class since it is hijacked in goa |
424 # configuration and we need the actual reference to avoid infinite loops |
423 # configuration and we need the actual reference to avoid infinite loops |