def setUp(self): super(Test, self).setUp() traversingSetUp() # XXX this whole test setup is rather involved. Is there a # simpler way to publish widget_macros.pt? Probably. # load the registrations for formlib xmlconfig.file("configure.zcml", zope.formlib) # set up the widget_macros macro macro_template = PageTemplate() widget_macros = os.path.join(os.path.dirname(zope.formlib.__file__), 'widget_macros.pt') f = open(widget_macros, 'r') data = f.read() f.close() macro_template.write(data) @zope.component.adapter(None, None) @implementer(zope.traversing.interfaces.ITraversable) class view: def __init__(self, ob, r=None): pass def traverse(*args): return macro_template.macros provideAdapter(view, name='view') provideAdapter(DefaultTraversable, [None])
def setUp(self): ZCMLFileLayer.setUp(self) # Set up site manager adapter zope.component.provideAdapter( SiteManagerAdapter, (Interface,), IComponentLookup) # Set up traversal traversingSetUp() zope.component.provideAdapter( ContainerTraversable, (ISimpleReadContainer,), ITraversable) # Session zope.component.provideAdapter(ClientId, (IRequest,), IClientId) zope.component.provideAdapter(Session, (IRequest,), ISession) zope.component.provideUtility( CookieClientIdManager(), IClientIdManager) sdc = PersistentSessionDataContainer() zope.component.provideUtility(sdc, ISessionDataContainer, '') # Set up site site = rootFolder() site.setSiteManager(LocalSiteManager(site)) zope.component.hooks.setSite(site) return site
def setUp(test): traversingSetUp() provideAdapter(TextWidget, (ITextLine, IDefaultBrowserLayer), IInputWidget) provideAdapter(WidgetInputErrorView, (IWidgetInputError, IDefaultBrowserLayer), IWidgetInputErrorView)
def placefulSetUp(site=False): testing.setUp() eventtesting.setUp() traversingSetUp() setHooks() provideAdapter(ContainerTraversable, (ISimpleReadContainer,), ITraversable) provideAdapter(SiteManagerAdapter, (Interface,), IComponentLookup) if site: root = rootFolder() createSiteManager(root, setsite=True) return root
def setUp(self): ZCMLFileLayer.setUp(self) eventtesting.setUp() traversingSetUp() zope.component.hooks.setHooks() # Set up site manager adapter zope.component.provideAdapter( SiteManagerAdapter, (Interface,), IComponentLookup) # Set up site site = rootFolder() site.setSiteManager(LocalSiteManager(site)) zope.component.hooks.setSite(site)
def setUp(self): testing.setUp() eventtesting.setUp() traversingSetUp() setHooks() provideAdapter(ContainerTraversable, (ISimpleReadContainer,), ITraversable) provideAdapter(SiteManagerAdapter, (Interface,), IComponentLookup) self.root = rootFolder() createSiteManager(self.root, setsite=True) provideAdapter(connectionOfPersistent, (IPersistent, ), IConnection) provideAdapter( KeyReferenceToPersistent, (IPersistent, ), IKeyReference)
def setUp(self): testing.setUp() eventtesting.setUp() traversingSetUp() setHooks() provideAdapter(ContainerTraversable, (ISimpleReadContainer, ), ITraversable) provideAdapter(SiteManagerAdapter, (Interface, ), IComponentLookup) self.root = rootFolder() createSiteManager(self.root, setsite=True) provideAdapter(connectionOfPersistent, (IPersistent, ), IConnection) provideAdapter(KeyReferenceToPersistent, (IPersistent, ), IKeyReference)
def setUp(test): cleanup.setUp() eventtesting.setUp() traversingSetUp() # resource namespace setup from zope.traversing.interfaces import ITraversable from zope.traversing.namespace import resource zope.component.provideAdapter( resource, (None,), ITraversable, name = "resource") zope.component.provideAdapter( resource, (None, None), ITraversable, name = "resource") from zope.browserpage import metaconfigure from zope.contentprovider import tales metaconfigure.registerType('provider', tales.TALESProviderExpression)
def doctestSetUp(test): cleanup.setUp() eventtesting.setUp() traversingSetUp() # resource namespace setup from zope.traversing.interfaces import ITraversable from zope.traversing.namespace import resource zope.component.provideAdapter(resource, (None, ), ITraversable, name="resource") zope.component.provideAdapter(resource, (None, None), ITraversable, name="resource") from zope.browserpage import metaconfigure from zope.contentprovider import tales metaconfigure.registerType('provider', tales.TALESProviderExpression)
def setUp(self): traversingSetUp() self.setUpContent()