Exemple #1
0
 def __call__(self, *args, **kwargs):
     context = aq_inner(self.context)
     context_of_context = aq_inner(context.context)
     view = context.__of__(context_of_context)
     
     # self.default_template is a ViewPageTemplateFile, which is a property descriptor
     # whose __get__ method returns a BoundPageTemplate.  That expects to be accessed from
     # a view, but we're accessing it from a NamedTemplateAdapter so we have to be sneaky and
     # make our own BoundPageTemplate rather than calling self.default_template directly.
     return BoundPageTemplate(self.__class__.__dict__['default_template'], view)(*args, **kwargs)
Exemple #2
0
    def render(self):
        """This method renders the outer skeleton template, which in
        turn calls the 'contents' method below.

        We use an indirection to 'self.index' here to allow users to
        override the skeleton template through the 'browser' zcml
        directive. If no index template is set, we look up a an adapter from
        (self, request) to IPageTemplate and use that instead.
        """
        if self.request.response.getStatus() in (302, 303):
            return u""
        if self.index is None:
            template = zope.component.getMultiAdapter(
                (self, self.request), IPageTemplate)
            return BoundPageTemplate(template, self)()
        return self.index()
Exemple #3
0
    def __call__(self, *args, **kwargs):
        if is_bumblebee_feature_enabled():
            set_preferred_listing_view('list')
            self.template = BoundPageTemplate(self.bumblebee_template, self)

        return super(Documents, self).__call__(self, *args, **kwargs)
 def __init__(self, context, request, templatename):
     self.context = context
     self.request = request
     pt = ViewPageTemplateFile(templatename)
     self.template = BoundPageTemplate(pt, self)
Exemple #5
0
 def __call__(self):
     vptr = ViewPageTemplateResource(self.context.portal_type,
                                     template_name=getattr(
                                         self, 'section', 'view.pt'))
     bpt = BoundPageTemplate(vptr, self)
     return bpt()