예제 #1
0
파일: error.py 프로젝트: fusionapp/mantissa
    def __init__(self, element, themes):
        """
        @param element: The L{INavigableFragment} that was being rendered.

        @param themes: A list of L{ITemplateNameResolver}s.
        """
        MissingDocumentFactory.__init__(self, element)
        self.themes = themes
예제 #2
0
    def __init__(self, element, themes):
        """
        @param element: The L{INavigableFragment} that was being rendered.

        @param themes: A list of L{ITemplateNameResolver}s.
        """
        MissingDocumentFactory.__init__(self, element)
        self.themes = themes
예제 #3
0
 def test_missingDocumentFactoryRepr(self):
     """
     Test that a L{MissingDocumentFactory} instance can be repr()'d without
     error.
     """
     class PrettyReprElement(Element):
         def __repr__(self):
             return 'Pretty Repr Element'
     self.assertIn('Pretty Repr Element',
                   repr(MissingDocumentFactory(PrettyReprElement())))
예제 #4
0
파일: page.py 프로젝트: jpunwin/tums
 def rend(self, context, data):
     """
     Backwards compatibility stub.  This is only here so that derived
     classes can upcall to it.  It is not otherwise used in the rendering
     process.
     """
     context.remember(_OldRendererFactory(self), IRendererFactory)
     docFactory = self.docFactory
     if docFactory is None:
         raise MissingDocumentFactory(self)
     return docFactory.load(None, _getPreprocessors(self))
예제 #5
0
파일: page.py 프로젝트: jpunwin/tums
    def render(self, request):
        """
        Load and return C{self.docFactory}.
        """
        rend = self.rend
        if rend.im_func is not Element.__dict__['rend']:
            context = _ctxForRequest(request, [], self, False)
            return rend(context, None)

        docFactory = self.docFactory
        if docFactory is None:
            raise MissingDocumentFactory(self)
        return docFactory.load(None, _getPreprocessors(self))
예제 #6
0
파일: page.py 프로젝트: calston/tums
    def rend(self, ctx, data):
        # Unfortunately, we still need a context to make the rest of the
        # rendering process work.  A goal should be to elimate this completely.
        context = WovenContext()

        if self.docFactory is None:
            raise MissingDocumentFactory(self)

        preprocessors = _getPreprocessors(self)

        doc = self.docFactory.load(context, preprocessors)

        context.remember(self, IData)
        context.remember(self, IRenderer)
        context.remember(self, IRendererFactory)
        context.tag = invisible[doc]
        return context