コード例 #1
0
 def beforeRender(self, ctx):
     """
     Call the C{beforeRender} implementations on L{MantissaLivePage} and
     L{_FragmentWrapperMixin}.
     """
     MantissaLivePage.beforeRender(self, ctx)
     return _FragmentWrapperMixin.beforeRender(self, ctx)
コード例 #2
0
ファイル: webapp.py プロジェクト: fusionapp/mantissa
 def beforeRender(self, ctx):
     """
     Call the C{beforeRender} implementations on L{MantissaLivePage} and
     L{_FragmentWrapperMixin}.
     """
     MantissaLivePage.beforeRender(self, ctx)
     return _FragmentWrapperMixin.beforeRender(self, ctx)
コード例 #3
0
ファイル: test_website.py プロジェクト: twisted/mantissa
        def _renderPage():
            page = MantissaLivePage(FakeWebSite())
            element = LiveElement(stan(tags.span(render=tags.directive('liveElement'))))
            element.setFragmentParent(page)
            element.jsClass = u'Mantissa.Test.Dummy.DummyWidget'
            page.docFactory = stan([tags.span(render=tags.directive('liveglue')), element])

            ctx = WovenContext()
            req = FakeRequest(headers={'host': self.hostname})
            ctx.remember(req, IRequest)
            page.beforeRender(ctx)
            page.renderHTTP(ctx)
            page._messageDeliverer.close()
コード例 #4
0
        def _renderPage():
            page = MantissaLivePage(FakeWebSite())
            element = LiveElement(
                stan(tags.span(render=tags.directive('liveElement'))))
            element.setFragmentParent(page)
            element.jsClass = u'Mantissa.Test.Dummy.DummyWidget'
            page.docFactory = stan(
                [tags.span(render=tags.directive('liveglue')), element])

            ctx = WovenContext()
            req = FakeRequest(headers={'host': self.hostname})
            ctx.remember(req, IRequest)
            page.beforeRender(ctx)
            page.renderHTTP(ctx)
            page._messageDeliverer.close()
コード例 #5
0
ファイル: test_website.py プロジェクト: twisted/mantissa
 def test_beforeRenderSetsModuleRoot(self):
     """
     L{MantissaLivePage.beforeRender} should set I{_moduleRoot} to the
     C{__jsmodule__} child of the URL returned by the I{rootURL}
     method of the L{WebSite} it wraps.
     """
     receivedRequests = []
     root = URL(netloc='example.com', pathsegs=['a', 'b'])
     class FakeWebSite(object):
         def rootURL(self, request):
             receivedRequests.append(request)
             return root
     request = FakeRequest()
     page = MantissaLivePage(FakeWebSite())
     page.beforeRender(request)
     self.assertEqual(receivedRequests, [request])
     self.assertEqual(page._moduleRoot, root.child('__jsmodule__'))
コード例 #6
0
    def test_beforeRenderSetsModuleRoot(self):
        """
        L{MantissaLivePage.beforeRender} should set I{_moduleRoot} to the
        C{__jsmodule__} child of the URL returned by the I{rootURL}
        method of the L{WebSite} it wraps.
        """
        receivedRequests = []
        root = URL(netloc='example.com', pathsegs=['a', 'b'])

        class FakeWebSite(object):
            def rootURL(self, request):
                receivedRequests.append(request)
                return root

        request = FakeRequest()
        page = MantissaLivePage(FakeWebSite())
        page.beforeRender(request)
        self.assertEqual(receivedRequests, [request])
        self.assertEqual(page._moduleRoot, root.child('__jsmodule__'))