Exemplo n.º 1
0
    def test_debug_flags(self):
        page = ZPTPage()
        page = self.pageInContext(page)
        page.setSource(u'<tal:x>Foo</tal:x>')

        request = TestRequest()
        self.assertEquals(page.render(request), u'Foo')

        request.debug.showTAL = True
        self.assertEquals(page.render(request), u'<tal:x>Foo</tal:x>')

        request.debug.showTAL = False
        request.debug.sourceAnnotations = True
        self.assertEquals(page.pt_source_file(), '/folder/zpt')
        self.assertEquals(
            page.render(request), '<!--\n' + '=' * 78 + '\n' +
            '/folder/zpt (line 1)\n' + '=' * 78 + '\n' + '-->Foo')
Exemplo n.º 2
0
    def test_debug_flags(self):
        page = ZPTPage()
        page = self.pageInContext(page)
        page.setSource(u'<tal:x>Foo</tal:x>')

        request = TestRequest()
        self.assertEquals(page.render(request), 'Foo\n')

        request.debug.showTAL = True
        self.assertEquals(page.render(request), '<tal:x>Foo</tal:x>\n')

        request.debug.showTAL = False
        request.debug.sourceAnnotations = True
        self.assertEquals(page.pt_source_file(), '/folder/zpt')
        self.assertEquals(page.render(request),
            '<!--\n' +
            '=' * 78 + '\n' +
            '/folder/zpt (line 1)\n' +
            '=' * 78 + '\n' +
            '-->Foo\n')
Exemplo n.º 3
0
    def test_source_file(self):
        page = ZPTPage()
        self.assert_(page.pt_source_file() is None)

        page = self.pageInContext(page)
        self.assertEquals(page.pt_source_file(), '/folder/zpt')
Exemplo n.º 4
0
    def test_source_file(self):
        page = ZPTPage()
        self.assert_(page.pt_source_file() is None)

        page = self.pageInContext(page)
        self.assertEquals(page.pt_source_file(), '/folder/zpt')