def setThemes(self, value, **kw): """ Use the tagging adapter to set the themes. """ # value = filter(None, value) value = [val for val in value if val] tagging = IThemeTagging(self) tagging.tags = value
def setThemes(self, value, **kw): """ Use the tagging adapter to set the themes. """ # value = filter(None, value) value = [val for val in value if val] tagging = IThemeTagging(self) tagging.tags = value
def testMergedThemes(self): """ air_quality is merged with air create and theme tag a news item """ self.portal.invokeFactory('News Item', id='news2') obj = self.portal.news2 themes = IThemeTagging(obj) themes.tags = ['air'] self.portal.portal_catalog.reindexObject(self.portal.news2) self.portal.invokeFactory('News Item', id='news3') obj = self.portal.news3 themes = IThemeTagging(obj) themes.tags = ['air_quality'] self.portal.portal_catalog.reindexObject(self.portal.news3) processQueue() res = self.portal.portal_catalog.searchResults( getThemes=['air_quality'], portal_type='News Item') self.assertEqual(len(res), 1) # only air is mapped to air_quality not the other way around res = self.portal.portal_catalog.searchResults(getThemes=['air'], portal_type='News Item') self.assertEqual(len(res), 1)
def afterSetUp(self): """ After setup """ setSite(self.portal) provideAdapter(ThemeTaggableMerged) provideAdapter(AttributeAnnotations, provides=IAnnotations, adapts=[IThemeTaggable]) classImplements(ATNewsItem, IThemeTaggable) self.setRoles('Manager') # create and theme tag a news item self.portal.invokeFactory('News Item', id='news1') obj = self.portal.news1 themes = IThemeTagging(obj) themes.tags = ['agriculture'] self.portal.portal_catalog.reindexObject(self.portal.news1) self.portal.portal_catalog.reindexObject(self.portal) processQueue()
def setThemes(self, value, **kw): """ Use the tagging adapter to set the themes. """ value = [val for val in value if val is not None] tagging = IThemeTagging(self) tagging.tags = value
def setThemes(self, value, **kw): """ Use the tagging adapter to set the themes. """ value = [val for val in value if val is not None] tagging = IThemeTagging(self) tagging.tags = value