[Checkins] SVN: five.localsitemanager/trunk/src/five/localsitemanager/registry.py - in order to correctly look up a ISiteRoot, which will be this

Jens Vagelpohl jens at dataflake.org
Sun Mar 4 08:31:09 EST 2007


Log message for revision 72968:
  - in order to correctly look up a ISiteRoot, which will be this 
    component registry's parent, we need to make sure to not wrap it
    in itself but in its parent.
  

Changed:
  U   five.localsitemanager/trunk/src/five/localsitemanager/registry.py

-=-
Modified: five.localsitemanager/trunk/src/five/localsitemanager/registry.py
===================================================================
--- five.localsitemanager/trunk/src/five/localsitemanager/registry.py	2007-03-04 12:23:03 UTC (rev 72967)
+++ five.localsitemanager/trunk/src/five/localsitemanager/registry.py	2007-03-04 13:31:08 UTC (rev 72968)
@@ -35,8 +35,17 @@
                 raise ValueError('Not enough context to acquire parent')
 
             base = Acquisition.aq_base(comp)
-            comp = base.__of__(parent)
 
+            if base is not Acquisition.aq_base(parent):
+                # If the component is not the cmoponent registry container,
+                # wrap it in the parent
+                comp = base.__of__(parent)
+            else:
+                # If the component happens to be the component registry
+                # container we are looking up a ISiteRoot.
+                # We are not wrapping it in itself but in its own parent
+                comp = base.__of__(Acquisition.aq_parent(parent))
+
         return comp
 
     def queryUtility(self, provided, name=u'', default=None):



More information about the Checkins mailing list