def subregional_churchbodies(self): intids = getUtility(IIntIds) result = [] for i in self.context.values(): if IATFolder.providedBy(i): data = { 'title': i.Title(), 'churchbodies': [ o for o in i.values() if IChurchBody.providedBy(o) ] } if data['churchbodies']: result.append(data) return result
def subregional_churchbodies(self): intids = getUtility(IIntIds) result = [] for i in self.context.values(): if IATFolder.providedBy(i): data = { 'title': i.Title(), 'churchbodies': [o for o in i.values() if IChurchBody.providedBy(o)] } if data['churchbodies']: result.append(data) return result
def __call__(self, context): churchbodies = context.portal_catalog( portal_type='wcc.churches.churchbody', regions=context.getId() ) intids = getUtility(IIntIds) terms = [] keys = [] for brain in churchbodies: intid = intids.getId(brain.getObject()) terms.append(SimpleTerm(value=intid, title=brain.Title)) keys.append(intid) for obj in context.values(): if IChurchBody.providedBy(obj): intid = intids.getId(obj) if intid not in keys: terms.append(SimpleTerm(value=intid, title=obj.Title())) return SimpleVocabulary(terms)
def regional_churchbodies(self): return [i for i in self.context.values() if IChurchBody.providedBy(i)]