[Checkins] SVN: z3c.bobopublisher/trunk/src/z3c/bobopublisher/ do not use directly the global site manager in the tests
Fabio Tranchitella
kobold at kobold.it
Thu Aug 27 03:21:31 EDT 2009
Log message for revision 103246:
do not use directly the global site manager in the tests
Changed:
U z3c.bobopublisher/trunk/src/z3c/bobopublisher/README.txt
U z3c.bobopublisher/trunk/src/z3c/bobopublisher/absoluteurl.py
U z3c.bobopublisher/trunk/src/z3c/bobopublisher/application.py
-=-
Modified: z3c.bobopublisher/trunk/src/z3c/bobopublisher/README.txt
===================================================================
--- z3c.bobopublisher/trunk/src/z3c/bobopublisher/README.txt 2009-08-27 01:06:59 UTC (rev 103245)
+++ z3c.bobopublisher/trunk/src/z3c/bobopublisher/README.txt 2009-08-27 07:21:30 UTC (rev 103246)
@@ -40,7 +40,7 @@
We register a dummy root object with a single hard-coded sub-item for our
testing purposes:
- >>> from zope.component import adapts, getGlobalSiteManager
+ >>> from zope.component import adapts, provideAdapter, provideUtility
>>> from zope.interface import implements, Interface
>>> from zope.interface.common.mapping import IReadMapping
>>> from zope.location.interfaces import IRoot
@@ -53,7 +53,7 @@
... pass
>>> class SubItem(object):
... implements(ISubItem)
- >>> getGlobalSiteManager().registerUtility(Root(), IRoot)
+ >>> provideUtility(Root(), IRoot)
PublishTraverse adapters
@@ -70,8 +70,8 @@
z3c.bobopublisher provides two generic PublishTraverse adapters:
>>> from z3c.bobopublisher.traversing import PublishTraverse, PublishTraverseMapping
- >>> getGlobalSiteManager().registerAdapter(PublishTraverse)
- >>> getGlobalSiteManager().registerAdapter(PublishTraverseMapping)
+ >>> provideAdapter(PublishTraverse)
+ >>> provideAdapter(PublishTraverseMapping)
It is now possible to perform a GET request on the test application:
@@ -94,7 +94,7 @@
... self.request = request
... def __call__(self):
... return u'ABC'
- >>> getGlobalSiteManager().registerAdapter(BrowserPage, name='index.html')
+ >>> provideAdapter(BrowserPage, name='index.html')
Using the test application, we are able to call the page and get its result:
@@ -112,7 +112,7 @@
... self.request = request
... def __call__(self):
... return u'DELETE'
- >>> getGlobalSiteManager().registerAdapter(BrowserPageDelete, name='index.html')
+ >>> provideAdapter(BrowserPageDelete, name='index.html')
Using the test application, we are able to call the page and get its result:
@@ -142,7 +142,7 @@
... self.request = request
... def __call__(self):
... return u'XYZ: %s' % repr(self.context.__parent__)
- >>> getGlobalSiteManager().registerAdapter(SubItemBrowserPage, name='index.html')
+ >>> provideAdapter(SubItemBrowserPage, name='index.html')
Using the test application, we are able to call the page and get its result:
@@ -209,7 +209,7 @@
>>> from zope.security.testing import Principal
>>> def principal(key):
... return key == 'test' and Principal(u'test') or None
- >>> getGlobalSiteManager().registerAdapter(principal, (Interface,), IPrincipal)
+ >>> provideAdapter(principal, (Interface,), IPrincipal)
Using the test application, we are able to call the page and get its result:
Modified: z3c.bobopublisher/trunk/src/z3c/bobopublisher/absoluteurl.py
===================================================================
--- z3c.bobopublisher/trunk/src/z3c/bobopublisher/absoluteurl.py 2009-08-27 01:06:59 UTC (rev 103245)
+++ z3c.bobopublisher/trunk/src/z3c/bobopublisher/absoluteurl.py 2009-08-27 07:21:30 UTC (rev 103246)
@@ -57,12 +57,12 @@
>>> a = SubItem(u'\xe1', root)
>>> b = SubItem(u'b', a)
- >>> from zope.component import getGlobalSiteManager
+ >>> from zope.component import provideAdapter
>>> from zope.location.traversing import LocationPhysicallyLocatable
- >>> getGlobalSiteManager().registerAdapter(LocationPhysicallyLocatable)
+ >>> provideAdapter(LocationPhysicallyLocatable)
>>> from zope.interface import Interface
- >>> getGlobalSiteManager().registerAdapter(AbsoluteURL, (Interface, Interface), IAbsoluteURL)
+ >>> provideAdapter(AbsoluteURL, (Interface, Interface), IAbsoluteURL)
Verify the object:
Modified: z3c.bobopublisher/trunk/src/z3c/bobopublisher/application.py
===================================================================
--- z3c.bobopublisher/trunk/src/z3c/bobopublisher/application.py 2009-08-27 01:06:59 UTC (rev 103245)
+++ z3c.bobopublisher/trunk/src/z3c/bobopublisher/application.py 2009-08-27 07:21:30 UTC (rev 103246)
@@ -18,9 +18,7 @@
import bobo
-from zope.component import getGlobalSiteManager
-
class Application(bobo.Application):
"""Create a WSGI application based on bobo"""
More information about the Checkins
mailing list