[Zope3-dev] Pagelet and LayoutTemplate recursion

Christian Zagrodnick cz at gocept.com
Wed Sep 26 10:19:29 EDT 2007


Hi,

there is a recursion problem with Pagelets and layout templates when 
you don't register a template for the pagelet.

A layout template could be registered as follows (from z3c.formdemo):

  <z3c:layout
      for="*"
      layer="z3c.formdemo.layer.IDemoBrowserLayer"
      template="template.pt"
      />

This registers an adapter providing ILayoutTemplate.

The BrowserPagelet's render method retrieves the template for the 
pagelet's contents (i.e. not the outer wrap) as follows:

            template = zope.component.getMultiAdapter(
                (self, self.request), IPageTemplate)

The problem is, that ILayoutTemplate is derived from IPageTemplate. 
This is why the pagelet tries to render its contents with the layout 
template.

I'm not sure what to do about this.

a) Explicitly check that the template is *not* an ILayoutTemplate in 
BrowserPagelet.render

b) make <z3c:template> use another interface which is also derived from 
IPageTemplate and use the new interface in BrowserPagelet.render.

c) ... ?


Comments, remarks?

-- 
Christian Zagrodnick

gocept gmbh & co. kg  ·  forsterstrasse 29 · 06112 halle/saale
www.gocept.com · fon. +49 345 12298894 · fax. +49 345 12298891





More information about the Zope3-dev mailing list