[Checkins] SVN: z3c.jbot/trunk/z3c/jbot/__init__.py Hook into
_cook_check so customization also works when other entry
points than pt_render are used (such as direct macro access).
Wichert Akkerman
wichert at wiggy.net
Wed Jul 2 10:31:24 EDT 2008
Log message for revision 87927:
Hook into _cook_check so customization also works when other entry points than pt_render are used (such as direct macro access).
Changed:
U z3c.jbot/trunk/z3c/jbot/__init__.py
-=-
Modified: z3c.jbot/trunk/z3c/jbot/__init__.py
===================================================================
--- z3c.jbot/trunk/z3c/jbot/__init__.py 2008-07-02 14:09:20 UTC (rev 87926)
+++ z3c.jbot/trunk/z3c/jbot/__init__.py 2008-07-02 14:31:24 UTC (rev 87927)
@@ -1,11 +1,18 @@
import manager
-from zope.pagetemplate.pagetemplatefile import PageTemplate
+from zope.pagetemplate.pagetemplatefile import PageTemplateFile
# add registration hook to ``zope.app.pagetemplate``
-def jbot(pt_render):
- def render(self, *args, **kwargs):
+def jbot(func):
+ def jbot_func(self, *args, **kwargs):
manager.getGlobalTemplateManager().registerTemplate(self)
- return pt_render(self, *args, **kwargs)
- return render
+ return func(self, *args, **kwargs)
+ return jbot_func
-PageTemplate.pt_render = jbot(PageTemplate.pt_render)
+PageTemplateFile._cook_check = jbot(PageTemplateFile._cook_check)
+try:
+ from Products.PageTemplates.PageTemplateFile import PageTemplateFile as Z2PageTemplateFile
+ Z2PageTemplateFile._cook_check = jbot(Z2PageTemplateFile._cook_check)
+except ImportError:
+ raise
+
+
More information about the Checkins
mailing list