[Checkins] SVN: five.localsitemanager/trunk/ Made sure that the __of__ method is only called on objects providing the IAcquirer interface.
Hanno Schlichting
hannosch at hannosch.eu
Sun Sep 27 07:57:13 EDT 2009
Log message for revision 104573:
Made sure that the __of__ method is only called on objects providing the IAcquirer interface.
Changed:
U five.localsitemanager/trunk/CHANGES.txt
U five.localsitemanager/trunk/src/five/localsitemanager/registry.py
-=-
Modified: five.localsitemanager/trunk/CHANGES.txt
===================================================================
--- five.localsitemanager/trunk/CHANGES.txt 2009-09-27 11:18:22 UTC (rev 104572)
+++ five.localsitemanager/trunk/CHANGES.txt 2009-09-27 11:57:13 UTC (rev 104573)
@@ -4,6 +4,10 @@
2.0dev - unreleased
-------------------
+* Made sure that the __of__ method is only called on objects providing the
+ IAcquirer interface.
+ [hannosch]
+
* Updated forked registerUtility method to match the zope.component 3.7.1
code base. This fixes the two bugs with the implicit unregistration of
utilities for existing interface / name pairs.
Modified: five.localsitemanager/trunk/src/five/localsitemanager/registry.py
===================================================================
--- five.localsitemanager/trunk/src/five/localsitemanager/registry.py 2009-09-27 11:18:22 UTC (rev 104572)
+++ five.localsitemanager/trunk/src/five/localsitemanager/registry.py 2009-09-27 11:57:13 UTC (rev 104573)
@@ -122,7 +122,11 @@
# If component is stored as a ComponentPathWrapper, we traverse to
# the component using the stored path:
if isinstance(comp, ComponentPathWrapper):
- return _rewrap(getSite().unrestrictedTraverse(comp.path))
+ comp = getSite().unrestrictedTraverse(comp.path)
+ if IAcquirer.providedBy(comp):
+ return _rewrap(comp)
+ else:
+ return comp
# BBB: The primary reason for doing this sort of wrapping of
# returned utilities is to support CMF tool-like functionality where
@@ -172,7 +176,11 @@
return comp
+
def _rewrap(obj):
+ """This functions relies on the passed in obj to provide the IAcquirer
+ interface.
+ """
obj = Acquisition.aq_inner(obj)
base = Acquisition.aq_base(obj)
parent = Acquisition.aq_parent(obj)
More information about the checkins
mailing list