Exemplo n.º 1
0
    def setUp(self):
        from collective.routes import addRoute
        self.portal = self.layer['portal']
        self.request = self.layer['request']
        addRoute(
            'foobar',
            '/{effective:year}/{effective:month}/{effective:day}',
            defaultQuery={'portal_type': 'News Item'},
            allowPartialMatch=True)
        addRoute(
            'foobar1',
            '/foobar1/{effective:year}/{effective:month}/{effective:day}',
            defaultQuery={'portal_type': 'News Item'})
        addRoute(
            'foobar2',
            '/foobar2/{Subject}',
            defaultQuery={'portal_type': 'News Item'})
        addRoute(
            'customBreadcrumbs',
            '/foobar3',
            defaultQuery={
                'portal_type': 'News Item',
                'effectiveDate': '2010/10/10'
            },
            breadcrumbFactory=customBreadcrumbFactory)
        addRoute(
            'customPredicate',
            '/customPredicate',
            defaultQuery={
                'portal_type': 'News Item',
                'effectiveDate': '2010/10/10'
            },
            customPredicates=customPredicate)
        addRoute(
            'foobar4',
            '/foobar4/{effective:year}/{effective:month}/{effective:day}',
            defaultQuery={'portal_type': 'News Item'},
            allowPartialMatch=False)
        folder = createObject(self.portal, 'Folder', 'folder')
        createObject(
            folder,
            'News Item',
            'test1',
            title="Test 1",
            effectiveDate="2010/10/10")
        createObject(
            folder,
            'News Item',
            'test2',
            title="Test 2",
            effectiveDate="2010/10/09",
            subject=('foobar', ))
        self.activateRoutes()

        transaction.commit()
        self.browser = Browser(self.layer['app'])
        self.browser.handleErrors = False
        browserLogin(self.portal, self.browser)
Exemplo n.º 2
0
    def setUp(self):
        from collective.routes import addRoute

        self.portal = self.layer["portal"]
        self.request = self.layer["request"]
        addRoute(
            "foobar",
            "/{effective:year}/{effective:month}/{effective:day}",
            defaultQuery={"portal_type": "News Item"},
            allowPartialMatch=True,
        )
        addRoute(
            "foobar1",
            "/foobar1/{effective:year}/{effective:month}/{effective:day}",
            defaultQuery={"portal_type": "News Item"},
        )
        addRoute("foobar2", "/foobar2/{Subject}", defaultQuery={"portal_type": "News Item"})
        addRoute(
            "customBreadcrumbs",
            "/foobar3",
            defaultQuery={"portal_type": "News Item", "effectiveDate": "2010/10/10"},
            breadcrumbFactory=customBreadcrumbFactory,
        )
        addRoute(
            "customPredicate",
            "/customPredicate",
            defaultQuery={"portal_type": "News Item", "effectiveDate": "2010/10/10"},
            customPredicates=customPredicate,
        )
        addRoute(
            "foobar4",
            "/foobar4/{effective:year}/{effective:month}/{effective:day}",
            defaultQuery={"portal_type": "News Item"},
            allowPartialMatch=False,
        )
        folder = createObject(self.portal, "Folder", "folder")
        createObject(folder, "News Item", "test1", title="Test 1", effectiveDate="2010/10/10")
        createObject(folder, "News Item", "test2", title="Test 2", effectiveDate="2010/10/09", subject=("foobar",))
        self.activateRoutes()

        transaction.commit()
        self.browser = Browser(self.layer["app"])
        self.browser.handleErrors = False
        browserLogin(self.portal, self.browser)
Exemplo n.º 3
0
    def setUp(self):
        from collective.routes import addRoute
        self.portal = self.layer['portal']
        self.request = self.layer['request']
        addRoute('foobar',
                 '/{effective:year}/{effective:month}/{effective:day}',
                 defaultQuery={'portal_type': 'News Item'})
        addRoute('foobar1',
                 '/foobar1/{effective:year}/{effective:month}/{effective:day}',
                 defaultQuery={'portal_type': 'News Item'})
        addRoute('foobar2',
                 '/foobar2/{Subject}',
                 defaultQuery={'portal_type': 'News Item'})
        folder = createObject(self.portal, 'Folder', 'folder')
        createObject(folder, 'News Item', 'test1',
            title="Test 1", effectiveDate="2010/10/10")
        createObject(folder, 'News Item', 'test2',
            title="Test 2", effectiveDate="2010/10/09", subject=('foobar',))
        self.activateRoutes()

        transaction.commit()
        self.browser = Browser(self.layer['app'])
        self.browser.handleErrors = False
        browserLogin(self.portal, self.browser)