def collector_vocabulary(context): terms = [] # get local floor first site = get_site() # do not process local configuration if the current site is PloneSite if not IPloneSiteRoot.providedBy(site): utility = component.queryUtility(ILocalNewsletterLookup, name=get_name_for_site(site)) if utility is not None: local_lookup_utility = utility.get("newsletter_lookup", None) if local_lookup_utility: for collector in local_lookup_utility.local_collectors(): terms.append( zope.schema.vocabulary.SimpleTerm( value=collector, token="/".join(collector.getPhysicalPath()), title=collector.title ) ) # get global collectors (original vocabulary code) root = component.getUtility(IPloneSiteRoot) collectors = root["portal_newsletters"]["collectors"].objectValues() for collector in collectors: terms.append( zope.schema.vocabulary.SimpleTerm( value=collector, token="/".join(collector.getPhysicalPath()), title=collector.title ) ) return zope.schema.vocabulary.SimpleVocabulary(terms)
def collector_vocabulary(context): terms = [] # get local floor first site = get_site() # do not process local configuration if the current site is PloneSite if not IPloneSiteRoot.providedBy(site): utility = component.queryUtility(ILocalNewsletterLookup, name=get_name_for_site(site)) if utility is not None: local_lookup_utility=utility.get('newsletter_lookup',None) if local_lookup_utility: for collector in local_lookup_utility.local_collectors(): terms.append( zope.schema.vocabulary.SimpleTerm( value=collector, token='/'.join(collector.getPhysicalPath()), title=collector.title)) # get global collectors (original vocabulary code) root = component.getUtility(IPloneSiteRoot) collectors = root['portal_newsletters']['collectors'].objectValues() for collector in collectors: terms.append( zope.schema.vocabulary.SimpleTerm( value=collector, token='/'.join(collector.getPhysicalPath()), title=collector.title)) return zope.schema.vocabulary.SimpleVocabulary(terms)
def back_to_newsletter(self): root = get_site() return dict(label=_(u"Up to Local Singing & Dancing configuration"), url=root.absolute_url() + '/newsletter_administration_view')