[Zope-Checkins]
SVN: Products.Five/branches/philikon-local-components/
Move site manager adapter and subscriber configuration (IOW,
the useful stuff
Philipp von Weitershausen
philikon at philikon.de
Thu Mar 2 15:42:25 EST 2006
Log message for revision 65741:
Move site manager adapter and subscriber configuration (IOW, the useful stuff
in Five.site) to Five.component.
Changed:
U Products.Five/branches/philikon-local-components/component/__init__.py
U Products.Five/branches/philikon-local-components/component/configure.zcml
U Products.Five/branches/philikon-local-components/site/configure.zcml
U Products.Five/branches/philikon-local-components/site/localsite.py
-=-
Modified: Products.Five/branches/philikon-local-components/component/__init__.py
===================================================================
--- Products.Five/branches/philikon-local-components/component/__init__.py 2006-03-02 19:04:58 UTC (rev 65740)
+++ Products.Five/branches/philikon-local-components/component/__init__.py 2006-03-02 20:42:25 UTC (rev 65741)
@@ -30,6 +30,23 @@
import zope.app.component.hooks
zope.app.component.hooks.setHooks()
+def siteManagerAdapter(ob):
+ """An adapter * -> ISiteManager.
+
+ This is registered in place of the one in Zope 3 so that we lookup
+ using acquisition instead of ILocation.
+ """
+ current = ob
+ while True:
+ if ISite.providedBy(current):
+ return current.getSiteManager()
+ current = getattr(current, '__parent__', aq_parent(aq_inner(current)))
+ if current is None:
+ # It does not support acquisition or has no parent, so we
+ # return the global site
+ return getGlobalSiteManager()
+
+
class LocalSiteHook(ExtensionClass.Base):
def __call__(self, container, request):
Modified: Products.Five/branches/philikon-local-components/component/configure.zcml
===================================================================
--- Products.Five/branches/philikon-local-components/component/configure.zcml 2006-03-02 19:04:58 UTC (rev 65740)
+++ Products.Five/branches/philikon-local-components/component/configure.zcml 2006-03-02 20:42:25 UTC (rev 65741)
@@ -1,6 +1,23 @@
<configure xmlns="http://namespaces.zope.org/zope"
xmlns:browser="http://namespaces.zope.org/browser">
+ <adapter
+ for="*"
+ provides="zope.component.interfaces.IComponentLookup"
+ factory=".siteManagerAdapter"
+ />
+
+ <subscriber
+ for="zope.app.component.interfaces.ISite
+ zope.app.publication.interfaces.IBeforeTraverseEvent"
+ handler="zope.app.component.site.threadSiteSubscriber"
+ />
+
+ <subscriber
+ for="zope.app.publication.interfaces.IEndRequestEvent"
+ handler="zope.app.component.site.clearThreadSiteSubscriber"
+ />
+
<browser:page
for="OFS.interfaces.IObjectManager"
name="components.html"
Modified: Products.Five/branches/philikon-local-components/site/configure.zcml
===================================================================
--- Products.Five/branches/philikon-local-components/site/configure.zcml 2006-03-02 19:04:58 UTC (rev 65740)
+++ Products.Five/branches/philikon-local-components/site/configure.zcml 2006-03-02 20:42:25 UTC (rev 65741)
@@ -2,28 +2,11 @@
xmlns:browser="http://namespaces.zope.org/browser">
<adapter
- for="*"
- provides="zope.component.interfaces.ISiteManager"
- factory=".localsite.siteManagerAdapter"
- />
-
- <adapter
for="zope.app.site.interfaces.ISite"
provides=".interfaces.IFiveUtilityRegistry"
factory=".utility.SimpleLocalUtilityRegistry"
/>
- <subscriber
- for="zope.app.component.interfaces.ISite
- zope.app.publication.interfaces.IBeforeTraverseEvent"
- handler="zope.app.component.site.threadSiteSubscriber"
- />
-
- <subscriber
- for="zope.app.publication.interfaces.IEndRequestEvent"
- handler="zope.app.component.site.clearThreadSiteSubscriber"
- />
-
<browser:page
for="zope.app.component.interfaces.IPossibleSite"
name="manage_site.html"
Modified: Products.Five/branches/philikon-local-components/site/localsite.py
===================================================================
--- Products.Five/branches/philikon-local-components/site/localsite.py 2006-03-02 19:04:58 UTC (rev 65740)
+++ Products.Five/branches/philikon-local-components/site/localsite.py 2006-03-02 20:42:25 UTC (rev 65741)
@@ -23,22 +23,6 @@
from Acquisition import aq_inner, aq_parent
from Products.Five.site.interfaces import IFiveSiteManager, IFiveUtilityRegistry
-def siteManagerAdapter(ob):
- """An adapter * -> ISiteManager.
-
- This is registered in place of the one in Zope 3 so that we lookup
- using acquisition instead of ILocation.
- """
- current = ob
- while True:
- if ISite.providedBy(current):
- return current.getSiteManager()
- current = getattr(current, '__parent__', aq_parent(aq_inner(current)))
- if current is None:
- # It does not support acquisition or has no parent, so we
- # return the global site
- return getGlobalSiteManager()
-
class FiveSiteManager(object):
implements(IFiveSiteManager)
More information about the Zope-Checkins
mailing list