Pagelets are Zope 3 UI components. In particular they allow the developer to specify content templates without worrying about the UI O-wrap.
This package provides a very flexible base implementation that can be used to write view components which can be higly customized later in custom projects. This is needed if you have to write reusable components like those needed in a framework. Pagelets are BrowserPages made differently and can be used to replace them.
What does this mean?
We separate the python view code from the template implementation. And we also separate the template in at least two different templates - the content template and the layout template.
This package uses z3c.template and offers an implementaton for this template pattern. Additionaly this package offers a pagelet directive wich can be used to register pagelets.
Pagelets are views which can be called and support the update and render pattern.
How do they work
A pagelet returns the rendered content without layout in the render method and returns the layout code if we call it. See also z3c.template which shows how the template works. These samples will only show how the base implementation located in the z3c.pagelet.browser module get used.
BrowserPagelet
The base implementation called BrowserPagelet offers builtin __call__ and render methods which provide the different template lookups. Take a look at the BrowserPagelet class located in z3c.pagelet.browser and you can see that the render method returns a IContentTemplate and the __call__ method a ILayoutTemplate defined in the z3c.layout package.
|