def form_interfaces(context): """ Used as a source for a vocabulary this function returns a vocabulary of interfaces which may be used as sub-forms in a resource object. """ behaviors = set(( 'seantis.reservation.interfaces.IReservationFormSet', 'seantis.reservation.interfaces.IReservationManagerFormSet' )) ftis = [ fti for fti in getallutils(IDexterityFTI) if behaviors & set(fti.behaviors) ] site = getSite() def get_term(item): title = translate(item.Title(), context=site.REQUEST) return SimpleTerm(title=title, value=item.id) return SimpleVocabulary(map(get_term, ftis))
def form_interfaces(context): """ Used as a source for a vocabulary this function returns a vocabulary of interfaces which may be used as sub-forms in a resource object. """ behaviors = set( ('seantis.reservation.interfaces.IReservationFormSet', 'seantis.reservation.interfaces.IReservationManagerFormSet')) ftis = [ fti for fti in getallutils(IDexterityFTI) if behaviors & set(fti.behaviors) ] site = getSite() def get_term(item): title = translate(item.Title(), context=site.REQUEST) return SimpleTerm(title=title, value=item.id) return SimpleVocabulary(map(get_term, ftis))
def form_interfaces(context): """ Used as a source for a vocabulary this function returns a vocabulary of interfaces which may be used as sub-forms in a resource object. """ dutils = getallutils(IDexterityFTI) behaviors = set(( 'seantis.reservation.interfaces.IReservationFormSet', 'seantis.reservation.interfaces.IReservationManagerFormSet' )) interfaces = [ ( u.title, u.lookupSchema() ) for u in dutils if behaviors & set(u.behaviors) ] def get_term(item): return SimpleTerm(title=item[0], value=getname(item[1].__name__)) return SimpleVocabulary(map(get_term, interfaces))