event.notify(TermRenamedEvent(orig_title, new_title, self, vocab)) def update(self, *args, **kwargs): if kwargs.has_key("title"): orig_title = self.Title() BaseContent.update(self, *args, **kwargs) if kwargs.has_key("title"): new_title = kwargs["title"] vocab = find_toplevel_vocab(self) event.notify(TermRenamedEvent(orig_title, new_title, self, vocab)) edit = update # uncomment lines below when you need factory_type_information = { "allowed_content_types": (), "allow_discussion": 0, "immediate_view": "simplevocabulary_view", "global_allow": 0, "filter_content_types": 1, } actions = () registerType(SimpleVocabularyTerm, PROJECTNAME) registerVocabularyTerm(SimpleVocabularyTerm, "SimpleVocabulary") registerVocabularyTerm(SimpleVocabularyTerm, "SortedSimpleVocabulary")
actTerm = self while actTerm.aq_parent.portal_type != 'TreeVocabulary' \ and hasattr(actTerm.aq_parent, 'getTermKey'): path.append(actTerm.aq_parent.getTermKey()) actTerm = actTerm.aq_parent path.reverse() return path def getVocabularyKey(self): ''' returns the key of the field ''' deprecated("please use the IVocabularyTerm compatible method 'getTermKey'") return self.getTermKey() def getVocabularyValue(self, lang=None, **kwargs): ''' returns the value of the field. The value is a processed value ''' deprecated("please use the IVocabularyTerm compatible method 'getTermValue'") return self.getTermValue(lang=lang, **kwargs) # these should be inherited from SimpleVocabularyTerm processForm = SimpleVocabularyTerm.processForm edit = SimpleVocabularyTerm.edit update = SimpleVocabularyTerm.update registerType(TreeVocabularyTerm, PROJECTNAME) registerVocabularyContainer(TreeVocabularyTerm) registerVocabularyTerm(TreeVocabularyTerm, 'TreeVocabulary') registerVocabularyTerm(TreeVocabularyTerm, 'TreeVocabularyTerm') # end of class TreeVocabularyTerm
orig_title = self.Title() BaseContent.update(self, *args, **kwargs) if kwargs.has_key('title'): new_title = kwargs['title'] vocab = find_toplevel_vocab(self) event.notify(TermRenamedEvent(orig_title, new_title, self, vocab)) edit = update # uncomment lines below when you need factory_type_information={ 'allowed_content_types':() , 'allow_discussion': 0, 'immediate_view':'simplevocabulary_view', 'global_allow':0, 'filter_content_types':1, } actions= ( ) registerType(SimpleVocabularyTerm) registerVocabularyTerm(SimpleVocabularyTerm,'SimpleVocabulary') registerVocabularyTerm(SimpleVocabularyTerm, 'SortedSimpleVocabulary')