Пример #1
0
    def setUp(self):
        # Stack a new DemoStorage on top of the one from z2.STARTUP.
        self["zodbDB"] = zodb.stackDemoStorage(self.get("zodbDB"), name="PloneSubRequestFixture")

        # Create a new global registry
        zca.pushGlobalRegistry()
        self["configurationContext"] = context = zca.stackConfigurationContext(self.get("configurationContext"))

        # Load out ZCML
        from zope.configuration import xmlconfig
        import plone.subrequest

        xmlconfig.file("testing.zcml", plone.subrequest, context=context)

        with z2.zopeApp() as app:
            # Enable virtual hosting
            z2.installProduct(app, "Products.SiteAccess")
            from Products.SiteAccess.VirtualHostMonster import VirtualHostMonster

            vhm = VirtualHostMonster()
            app._setObject(vhm.getId(), vhm, suppress_events=True)
            # With suppress_events=False, this is called twice...
            vhm.manage_afterAdd(vhm, app)
            # Setup default content
            app.manage_addFolder("folder1")
            make_site(app.folder1)
            app.folder1.manage_addFolder("folder1A")
            app.folder1.folder1A.manage_addFolder("folder1Ai")
            app.folder1.manage_addFolder("folder1B")
            app.manage_addFolder("folder2")
            make_site(app.folder2)
            app.folder2.manage_addFolder("folder2A")
            app.folder2.folder2A.manage_addFolder("folder2Ai space")
Пример #2
0
    def setUp(self):
        # Stack a new DemoStorage on top of the one from z2.STARTUP.
        self['zodbDB'] = zodb.stackDemoStorage(self.get('zodbDB'),
                                               name='PloneSubRequestFixture')

        # Create a new global registry
        zca.pushGlobalRegistry()
        self['configurationContext'] = context = zca.stackConfigurationContext(
            self.get('configurationContext'))

        # Load out ZCML
        from zope.configuration import xmlconfig
        import plone.subrequest
        xmlconfig.file('testing.zcml', plone.subrequest, context=context)

        with z2.zopeApp() as app:
            # Enable virtual hosting
            z2.installProduct(app, 'Products.SiteAccess')
            from Products.SiteAccess.VirtualHostMonster import \
                VirtualHostMonster
            vhm = VirtualHostMonster()
            app._setObject(vhm.getId(), vhm, suppress_events=True)
            # With suppress_events=False, this is called twice...
            vhm.manage_afterAdd(vhm, app)
            # Setup default content
            app.manage_addFolder('folder1')
            make_site(app.folder1)
            app.folder1.manage_addFolder('folder1A')
            app.folder1.folder1A.manage_addFolder('folder1Ai')
            app.folder1.manage_addFolder('folder1B')
            app.manage_addFolder('folder2')
            make_site(app.folder2)
            app.folder2.manage_addFolder('folder2A')
            app.folder2.folder2A.manage_addFolder('folder2Ai space')