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
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())))
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))
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))
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