[CMF-checkins] SVN: CMF/branches/jens_tools_as_utilities/CMF - hardcoded PortalObjectBase as IObjectManagerSite

Yvo Schubbe y.2007- at wcm-solutions.de
Fri Feb 23 08:10:37 EST 2007


Log message for revision 72782:
  - hardcoded PortalObjectBase as IObjectManagerSite

Changed:
  U   CMF/branches/jens_tools_as_utilities/CMFCore/DynamicType.py
  U   CMF/branches/jens_tools_as_utilities/CMFCore/PortalObject.py
  U   CMF/branches/jens_tools_as_utilities/CMFCore/__init__.py
  U   CMF/branches/jens_tools_as_utilities/CMFDefault/factory.py
  U   CMF/branches/jens_tools_as_utilities/CMFDefault/setuphandlers.py

-=-
Modified: CMF/branches/jens_tools_as_utilities/CMFCore/DynamicType.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFCore/DynamicType.py	2007-02-23 09:50:29 UTC (rev 72781)
+++ CMF/branches/jens_tools_as_utilities/CMFCore/DynamicType.py	2007-02-23 13:10:34 UTC (rev 72782)
@@ -20,8 +20,10 @@
 from AccessControl import ClassSecurityInfo
 from Globals import InitializeClass
 
+from zope.app.publication.zopepublication import BeforeTraverseEvent
 from zope.component import getUtility
 from zope.component import queryUtility
+from zope.event import notify
 from zope.interface import implements
 
 from interfaces import IDynamicType
@@ -120,6 +122,8 @@
         # XXX hack around a bug(?) in BeforeTraverse.MultiHook
         REQUEST = arg2 or arg1
 
+        notify(BeforeTraverseEvent(self, REQUEST))
+
         if REQUEST['REQUEST_METHOD'] not in ('GET', 'POST'):
             return
 

Modified: CMF/branches/jens_tools_as_utilities/CMFCore/PortalObject.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFCore/PortalObject.py	2007-02-23 09:50:29 UTC (rev 72781)
+++ CMF/branches/jens_tools_as_utilities/CMFCore/PortalObject.py	2007-02-23 13:10:34 UTC (rev 72782)
@@ -17,7 +17,11 @@
 
 from warnings import warn
 
+from five.localsitemanager import find_next_sitemanager
+from five.localsitemanager.registry import PersistentComponents
 from Globals import InitializeClass
+from Products.Five.component.interfaces import IObjectManagerSite
+from zope.component.globalregistry import base
 from zope.interface import implements
 
 from interfaces import ISiteRoot
@@ -35,7 +39,7 @@
 
 class PortalObjectBase(PortalFolder, SkinnableObjectManager):
 
-    implements(ISiteRoot)
+    implements(ISiteRoot, IObjectManagerSite)
     meta_type = 'Portal Site'
     _isPortalRoot = 1
 
@@ -60,4 +64,13 @@
              'the skins tool object.', DeprecationWarning, stacklevel=2)
         return PORTAL_SKINS_TOOL_ID
 
+    def getSiteManager(self):
+        if self._components is None:
+            next = find_next_sitemanager(self)
+            if next is None:
+                next = base
+            name = '/'.join(self.getPhysicalPath())
+            self._components = PersistentComponents(name, (next,))
+        return self._components
+
 InitializeClass(PortalObjectBase)

Modified: CMF/branches/jens_tools_as_utilities/CMFCore/__init__.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFCore/__init__.py	2007-02-23 09:50:29 UTC (rev 72781)
+++ CMF/branches/jens_tools_as_utilities/CMFCore/__init__.py	2007-02-23 13:10:34 UTC (rev 72782)
@@ -15,6 +15,14 @@
 $Id$
 """
 
+try:
+    import five.localsitemanager
+except ImportError, e:
+    import sys
+    import os
+    sys.path.append(os.path.join(os.path.dirname(__file__), 'src'))
+    import five.localsitemanager
+
 import PortalFolder
 import MembershipTool, WorkflowTool, CatalogTool, DiscussionTool
 import ActionsTool, UndoTool, RegistrationTool, SkinsTool
@@ -68,14 +76,6 @@
                      ,
                      )
 
-try:
-    import five.localsitemanager
-except ImportError, e:
-    import sys
-    import os
-    sys.path.append(os.path.join(os.path.dirname(__file__), 'src'))
-    import five.localsitemanager
-
 def initialize(context):
     context.registerClass(
         DirectoryView.DirectoryView,

Modified: CMF/branches/jens_tools_as_utilities/CMFDefault/factory.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFDefault/factory.py	2007-02-23 09:50:29 UTC (rev 72781)
+++ CMF/branches/jens_tools_as_utilities/CMFDefault/factory.py	2007-02-23 13:10:34 UTC (rev 72782)
@@ -16,6 +16,7 @@
 """
 
 from Products.PageTemplates.PageTemplateFile import PageTemplateFile
+from zope.app.component.hooks import setSite
 
 from Products.CMFCore.interfaces import ISiteRoot
 from Products.GenericSetup import EXTENSION
@@ -52,6 +53,7 @@
     site = CMFSite( site_id )
     dispatcher._setObject( site_id, site )
     site = dispatcher._getOb( site_id )
+    setSite(site)
 
     site._setObject(_TOOL_ID, SetupTool(_TOOL_ID))
     setup_tool = getattr(site, _TOOL_ID)

Modified: CMF/branches/jens_tools_as_utilities/CMFDefault/setuphandlers.py
===================================================================
--- CMF/branches/jens_tools_as_utilities/CMFDefault/setuphandlers.py	2007-02-23 09:50:29 UTC (rev 72781)
+++ CMF/branches/jens_tools_as_utilities/CMFDefault/setuphandlers.py	2007-02-23 13:10:34 UTC (rev 72782)
@@ -16,13 +16,8 @@
 """
 
 from exceptions import BadRequest
-from Products.Five.component import enableSite
-from Products.Five.component import HOOK_NAME
-from Products.Five.component.interfaces import IObjectManagerSite
-from zope.app.component.hooks import setSite
-from zope.component.globalregistry import base
-from zope.component.persistentregistry import PersistentComponents
 
+
 def importVarious(context):
     """ Import various settings.
 
@@ -31,15 +26,6 @@
     """
     site = context.getSite()
 
-    # Make the portal a Zope3 site and create a site manager.
-    # Check to see that this is not run more than once, ever
-    if not getattr(site, HOOK_NAME, None):
-        enableSite(site, iface=IObjectManagerSite)
-        components = PersistentComponents()
-        components.__bases__ = (base,)
-        site.setSiteManager(components)
-        setSite(site)
-
     try:
         site.manage_addPortalFolder('Members')
     except BadRequest:



More information about the CMF-checkins mailing list