コード例 #1
0
 def test_adding(self):
     self.portal.invokeFactory('conference.program', 'program')
     program = self.portal['program']
     self.assertTrue(IProgram.providedBy(program))
コード例 #2
0
 def test_factory(self):
     fti = queryUtility(IDexterityFTI, name='conference.program')
     factory = fti.factory
     new_object = createObject(factory)
     self.assertTrue(IProgram.providedBy(new_object))
コード例 #3
0
def get_enclosing_program(context):
    """ Given a context, find the enclosing program """
    context = aq_inner(context)
    while not (IProgram.providedBy(context) or IPloneSiteRoot.providedBy(context)):
        context = aq_parent(context)
    return IProgram.providedBy(context) and context or None