Ejemplo n.º 1
0
def optionalProvidersSource(context):
    # context is result of 'getContent' method of SubscriberForm
    if IGazetteFolder.providedBy(context):
        folder = context
    else:
        folder = IGazetteFolder(context.get('context'), None)

    if folder is not None:
        all_providers = providersVocabularyFactory(context)
        providers = folder.auto_optional_providers
        items = []
        for item in providers:
            try:
                items.append(all_providers.getTerm(item))
            except LookupError:
                pass
        return SimpleVocabulary(items)
    else:
        return SimpleVocabulary([])
Ejemplo n.º 2
0
 def test_factory(self):
     fti = queryUtility(IDexterityFTI, name='gazette.GazetteFolder')
     factory = fti.factory
     new_object = createObject(factory)
     self.failUnless(IGazetteFolder.providedBy(new_object))
     self.failUnless(ISoupAnnotatable.providedBy(new_object))
Ejemplo n.º 3
0
 def test_adding(self):
     self.portal.invokeFactory('gazette.GazetteFolder', 'gf1')
     p1 = self.portal['gf1']
     self.failUnless(IGazetteFolder.providedBy(p1))
     self.failUnless(ISoupAnnotatable.providedBy(p1))