def __call__(self, context=None): terms = [] for roster in parents(context, iface=IRoster): context = roster if not IRoster.providedBy(context): context = MockRoster() request = api.portal.getRequest() tbl = PersonnelListing(context, request) for name, col in getAdapters((context, request, tbl), IColumn): terms.append(SimpleTerm(name, name, col.header)) return SimpleVocabulary(terms)
def __call__(self, context): groups = [] roster = None normalizer = getUtility(IIDNormalizer) for parent in tuple(parents(context, iface=IProvidesGroups)): roster = parent break for group in getattr(roster, 'groups', ()): if '|' in group: value, title = group.split('|', 1) else: value = title = group groups.append( SimpleTerm(value, token=normalizer.normalize(group), title=title) ) return SimpleVocabulary(groups)