[Checkins] SVN: five.pt/trunk/ Fixed acquisition wrapping issue which could cause infinite loops with code relying on the acquisition chain (in a view or viewlet).
Malthe Borch
mborch at gmail.com
Thu Feb 12 13:34:52 EST 2009
Log message for revision 96481:
Fixed acquisition wrapping issue which could cause infinite loops with code relying on the acquisition chain (in a view or viewlet).
Changed:
U five.pt/trunk/CHANGES.txt
U five.pt/trunk/src/five/pt/patches.py
-=-
Modified: five.pt/trunk/CHANGES.txt
===================================================================
--- five.pt/trunk/CHANGES.txt 2009-02-12 18:33:25 UTC (rev 96480)
+++ five.pt/trunk/CHANGES.txt 2009-02-12 18:34:52 UTC (rev 96481)
@@ -3,6 +3,10 @@
In next version
+- Fixed acquisition-wrapping issue with the (patched) bound template
+ class (could cause infinite loop due to cyclic acquisition
+ chain). [malthe]
+
- Moved evaluate_path and evaluate_exists over to ``z3c.pt``, adding
support for global ``path()`` and ``exists()`` functions for use in
``python:`` expressions to it (LP #317967). [sidnei]
Modified: five.pt/trunk/src/five/pt/patches.py
===================================================================
--- five.pt/trunk/src/five/pt/patches.py 2009-02-12 18:33:25 UTC (rev 96480)
+++ five.pt/trunk/src/five/pt/patches.py 2009-02-12 18:34:52 UTC (rev 96481)
@@ -11,6 +11,8 @@
from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile as \
ZopeViewPageTemplateFile
+from Acquisition import aq_base
+
try:
from Products.Five.browser.pagetemplatefile import BoundPageTemplate
except ImportError:
@@ -23,8 +25,16 @@
"""
__parent__ = property(lambda self: self.im_self)
-
+ def __call__(self, *args, **kw):
+ if self.im_self is None:
+ im_self, args = args[0], args[1:]
+ else:
+ im_self = aq_base(self.im_self)
+ im_self = im_self.__of__(im_self.context)
+
+ return self.im_func(im_self, *args, **kw)
+
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile as \
FiveViewPageTemplateFile
@@ -36,6 +46,7 @@
template = getattr(self, '_template', _marker)
if template is _marker:
self._template = template = ViewPageTemplateFile(self.filename)
+
return BoundPageTemplate(template, instance)
FiveViewPageTemplateFile.__get__ = get_bound_template
More information about the Checkins
mailing list