[Checkins] SVN: z3ext.layout/trunk/src/z3ext/layout/ allow override layout template
Nikolay Kim
fafhrd at datacom.kz
Thu Feb 5 17:10:43 EST 2009
Log message for revision 96160:
allow override layout template
Changed:
U z3ext.layout/trunk/src/z3ext/layout/configure.zcml
U z3ext.layout/trunk/src/z3ext/layout/interfaces.py
U z3ext.layout/trunk/src/z3ext/layout/layout.py
-=-
Modified: z3ext.layout/trunk/src/z3ext/layout/configure.zcml
===================================================================
--- z3ext.layout/trunk/src/z3ext/layout/configure.zcml 2009-02-05 19:32:24 UTC (rev 96159)
+++ z3ext.layout/trunk/src/z3ext/layout/configure.zcml 2009-02-05 22:10:42 UTC (rev 96160)
@@ -11,6 +11,10 @@
name="pagelet"
interface="z3ext.layout.interfaces.IPagelet" />
+ <z3ext:pageletType
+ name="layout"
+ interface="z3ext.layout.interfaces.ILayoutView" />
+
<!-- adapter provides IPagelet for (context, request) -->
<adapter factory=".pagelet.queryPagelet" />
Modified: z3ext.layout/trunk/src/z3ext/layout/interfaces.py
===================================================================
--- z3ext.layout/trunk/src/z3ext/layout/interfaces.py 2009-02-05 19:32:24 UTC (rev 96159)
+++ z3ext.layout/trunk/src/z3ext/layout/interfaces.py 2009-02-05 22:10:42 UTC (rev 96160)
@@ -68,6 +68,10 @@
"""Render the layout """
+class ILayoutView(interface.Interface):
+ """ layout view """
+
+
class ILayoutTemplateFile(interface.Interface):
""" layout template file """
Modified: z3ext.layout/trunk/src/z3ext/layout/layout.py
===================================================================
--- z3ext.layout/trunk/src/z3ext/layout/layout.py 2009-02-05 19:32:24 UTC (rev 96159)
+++ z3ext.layout/trunk/src/z3ext/layout/layout.py 2009-02-05 22:10:42 UTC (rev 96160)
@@ -22,7 +22,8 @@
from zope.pagetemplate.pagetemplatefile import PageTemplateFile
from z3ext.layout.pagelet import queryLayout
-from z3ext.layout.interfaces import LayoutNotFound, ILayout, ILayoutTemplateFile
+from z3ext.layout.interfaces import LayoutNotFound
+from z3ext.layout.interfaces import ILayout, ILayoutView, ILayoutTemplateFile
class ViewMapper(object):
@@ -69,6 +70,7 @@
class Layout(browser.BrowserPage):
interface.implements(ILayout)
+ template = None
mainview = None
maincontext = None
@@ -83,6 +85,11 @@
pass
def render(self):
+ if self.template is None:
+ view = getMultiAdapter((self, self.request), ILayoutView)
+ view.update()
+ return view.render()
+
return self.template(self)
def __call__(self, layout=None, view=None, *args, **kw):
More information about the Checkins
mailing list