vnccollab/ | covered 95% (12 of 287 uncovered) | |
common/ | covered 95% (12 of 287 uncovered) | |
vocabularies.py | covered 100% (0 of 11 uncovered) |
1: from zope.interface import implements 1: from zope.schema.interfaces import IVocabularyFactory 1: from zope.schema.vocabulary import SimpleTerm, SimpleVocabulary 2: class SimpleVocabularyFactory: 1: implements(IVocabularyFactory) 1: def __init__(self, lst): 1: self.lst = lst 1: def __call__(self, context): 3: terms = [SimpleTerm(value=x[0], token=x[0], title=x[1]) for x in self.lst] 1: vocabulary = SimpleVocabulary(terms) 1: return vocabulary