[Checkins] SVN: GenericSetup/trunk/ - replaced getSite() because it is not part of ISetupEnviron and might not be available

Yvo Schubbe y.2007- at wcm-solutions.de
Thu Jun 7 04:55:11 EDT 2007


Log message for revision 76444:
  - replaced getSite() because it is not part of ISetupEnviron and might not be available
  - fixed tests

Changed:
  U   GenericSetup/trunk/components.py
  U   GenericSetup/trunk/tests/test_components.py

-=-
Modified: GenericSetup/trunk/components.py
===================================================================
--- GenericSetup/trunk/components.py	2007-06-07 08:22:03 UTC (rev 76443)
+++ GenericSetup/trunk/components.py	2007-06-07 08:55:10 UTC (rev 76444)
@@ -20,6 +20,7 @@
 from zope.component.interfaces import IComponentRegistry
 
 from Acquisition import aq_base
+from Acquisition import aq_parent
 
 from interfaces import ISetupEnviron
 from utils import XMLAdapterBase
@@ -129,7 +130,7 @@
 
             obj_path = child.getAttribute('object')
             if obj_path:
-                site = self.environ.getSite()
+                site = aq_parent(self.context)
                 # we support registering aq_wrapped objects only for now
                 if hasattr(site, 'aq_base'):
                     # filter out empty path segments
@@ -202,7 +203,7 @@
                 # if the site is acquistion wrapped as well, get the relative
                 # path to the site
                 path = '/'.join(comp.getPhysicalPath())
-                site = self.environ.getSite()
+                site = aq_parent(self.context)
                 if hasattr(site, 'aq_base'):
                     site_path = '/'.join(site.getPhysicalPath())
                     rel_path = path[len(site_path):]

Modified: GenericSetup/trunk/tests/test_components.py
===================================================================
--- GenericSetup/trunk/tests/test_components.py	2007-06-07 08:22:03 UTC (rev 76443)
+++ GenericSetup/trunk/tests/test_components.py	2007-06-07 08:55:10 UTC (rev 76444)
@@ -36,7 +36,7 @@
 from zope.component import getSiteManager
 from zope.component import queryUtility
 from zope.component.globalregistry import base
-from zope.component.persistentregistry import PersistentComponents
+from five.localsitemanager.registry import PersistentComponents
 from zope.interface import implements
 from zope.interface import Interface
 
@@ -47,6 +47,7 @@
 
     components = PersistentComponents()
     components.__bases__ = (base,)
+    components.__parent__ = aq_base(context)
     context.setSiteManager(components)
 
 class IDummyInterface(Interface):
@@ -106,7 +107,7 @@
      object="/dummy_tool"/>
   <utility name="dummy tool name2"
      interface="Products.GenericSetup.tests.test_components.IDummyInterface"
-     object="/test_folder_1_/dummy_tool2"/>
+     object="/dummy_tool2"/>
   <utility name="foo"
      factory="Products.GenericSetup.tests.test_components.DummyUtility"
      interface="Products.GenericSetup.tests.test_components.IDummyInterface"/>
@@ -126,7 +127,7 @@
         tool = self.app['dummy_tool']
         obj.registerUtility(tool, IDummyInterface, name=u'dummy tool name')
 
-        tool2 = self.folder['dummy_tool2']
+        tool2 = self.app['dummy_tool2']
         obj.registerUtility(tool2, IDummyInterface, name=u'dummy tool name2')
 
     def test_body_get(self):
@@ -211,7 +212,7 @@
         self.app._setObject(tool.id, tool)
 
         tool2 = DummyTool2()
-        self.folder._setObject(tool2.id, tool2)
+        self.app._setObject(tool2.id, tool2)
 
         self._obj = sm
         self._BODY = _COMPONENTS_BODY



More information about the Checkins mailing list