[Zope3-Users] Named layouts for z3c.pagelet

Ilshad astoon.net at gmail.com
Wed Oct 8 22:34:39 EDT 2008


I need use several layout templates in same layer for z3c.pagelet-based
browser views.
For this, in current project I did follow:


from zope.component import getMultiAdapter
from z3c.template.interfaces import ILayoutTemplate

def layoutRenderer(self):
        """Allow to use named layout templates."""
               name = self.layout_name
               name = u''

         if self.layout is None:
                layout = getMultiAdapter((self, self.request),
ILayoutTemplate, name)
                return layout(self)
         return self.layout()

So, a pagelet's code look like:

from .... renderer import layoutRenderer

class Pagelet(object):
    __call__ = layoutRenderer


and usual pass the name into zcml-directive:


And layout-directive from z3c.template allow define name.

Summary, it quite convenient. But my proposal - let's add this feature into
z3c.pagelet package.

Ilshad Habibullin
Gadoz, Inc (http://www.gadoz.com)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope3-users/attachments/20081009/952fd95f/attachment.html 

More information about the Zope3-users mailing list