[Checkins] SVN: zope.site/trunk/ Cleaned up the undeclared dependency on zope.app.publication by moving the
Thomas Lotze
tl at gocept.com
Tue Sep 29 02:16:04 EDT 2009
Log message for revision 104600:
Cleaned up the undeclared dependency on zope.app.publication by moving the
two relevant subscriber registrations and their tests to that package.
Changed:
U zope.site/trunk/CHANGES.txt
U zope.site/trunk/src/zope/site/configure.zcml
U zope.site/trunk/src/zope/site/site.txt
U zope.site/trunk/src/zope/site/tests/test_site.py
-=-
Modified: zope.site/trunk/CHANGES.txt
===================================================================
--- zope.site/trunk/CHANGES.txt 2009-09-29 06:14:59 UTC (rev 104599)
+++ zope.site/trunk/CHANGES.txt 2009-09-29 06:16:04 UTC (rev 104600)
@@ -5,7 +5,8 @@
3.6.5 (unreleased)
------------------
-- ...
+- Cleaned up the undeclared dependency on zope.app.publication by moving the
+ two relevant subscriber registrations and their tests to that package.
3.6.4 (2009-09-01)
Modified: zope.site/trunk/src/zope/site/configure.zcml
===================================================================
--- zope.site/trunk/src/zope/site/configure.zcml 2009-09-29 06:14:59 UTC (rev 104599)
+++ zope.site/trunk/src/zope/site/configure.zcml 2009-09-29 06:16:04 UTC (rev 104600)
@@ -53,17 +53,6 @@
<subscriber
for="zope.location.interfaces.ISite
- zope.app.publication.interfaces.IBeforeTraverseEvent"
- handler=".site.threadSiteSubscriber"
- />
-
- <subscriber
- for="zope.app.publication.interfaces.IEndRequestEvent"
- handler=".site.clearThreadSiteSubscriber"
- />
-
- <subscriber
- for="zope.location.interfaces.ISite
zope.container.interfaces.IObjectMovedEvent"
handler=".site.changeSiteConfigurationAfterMove"
/>
Modified: zope.site/trunk/src/zope/site/site.txt
===================================================================
--- zope.site/trunk/src/zope/site/site.txt 2009-09-29 06:14:59 UTC (rev 104599)
+++ zope.site/trunk/src/zope/site/site.txt 2009-09-29 06:16:04 UTC (rev 104600)
@@ -83,27 +83,7 @@
>>> zope.component.interfaces.IComponentLookup(myfolder) is sm
True
-During traversal,
- >>> from zope.app import publication
- >>> request = object()
- >>> ev = publication.interfaces.BeforeTraverseEvent(myfolder, request)
- >>> site.threadSiteSubscriber(myfolder, ev)
-
-the nearest site is also recorded in a thread-global variable:
-
- >>> from zope.site import hooks
- >>> hooks.getSite() is myfolder
- True
-
-After a request is completed, the site setting is cleared again:
-
- >>> ev = publication.interfaces.EndRequestEvent(myfolder, request)
- >>> site.clearThreadSiteSubscriber(ev)
- >>> hooks.getSite() is None
- True
-
-
Using the Site Manager
----------------------
@@ -208,6 +188,7 @@
By the way, once you set a site
+ >>> from zope.site import hooks
>>> hooks.setSite(myfolder)
you can simply use the zope.component's `getSiteManager()` method to get
Modified: zope.site/trunk/src/zope/site/tests/test_site.py
===================================================================
--- zope.site/trunk/src/zope/site/tests/test_site.py 2009-09-29 06:14:59 UTC (rev 104599)
+++ zope.site/trunk/src/zope/site/tests/test_site.py 2009-09-29 06:16:04 UTC (rev 104600)
@@ -80,46 +80,6 @@
True
"""
-
-def test_setThreadSite_clearThreadSite():
- """
- This test ensures that the site is corectly set and cleared in a thread
- during traversal using event subscribers. Before we start, no site is set:
-
- >>> from zope.site import hooks
- >>> hooks.getSite() is None
- True
-
-
- >>> request = object()
-
- >>> from zope.app.publication import interfaces
- >>> from zope import site
-
-
- On the other hand, if a site is traversed,
-
- >>> sm = SiteManagerStub()
- >>> mysite = CustomFolder('mysite')
- >>> mysite.setSiteManager(sm)
-
- >>> ev = interfaces.BeforeTraverseEvent(mysite, request)
- >>> site.threadSiteSubscriber(mysite, ev)
-
- >>> hooks.getSite()
- <CustomFolder mysite>
-
- Once the request is completed,
-
- >>> ev = interfaces.EndRequestEvent(mysite, request)
- >>> site.clearThreadSiteSubscriber(ev)
-
- the site assignment is cleared again:
-
- >>> hooks.getSite() is None
- True
- """
-
class BaseTestSiteManagerContainer(unittest.TestCase):
"""This test is for objects that don't have site managers by
default and that always give back the site manager they were
More information about the checkins
mailing list