[Zope3-checkins] SVN: Zope3/branches/jim-adapter/src/zope/ Move
some setup code to zope.traversing
Philipp von Weitershausen
philikon at philikon.de
Wed Apr 5 11:34:54 EDT 2006
Log message for revision 66550:
Move some setup code to zope.traversing
Changed:
U Zope3/branches/jim-adapter/src/zope/app/testing/setup.py
U Zope3/branches/jim-adapter/src/zope/traversing/testing.py
U Zope3/branches/jim-adapter/src/zope/traversing/tests/test_physicallocationadapters.py
-=-
Modified: Zope3/branches/jim-adapter/src/zope/app/testing/setup.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/testing/setup.py 2006-04-05 15:22:28 UTC (rev 66549)
+++ Zope3/branches/jim-adapter/src/zope/app/testing/setup.py 2006-04-05 15:34:54 UTC (rev 66550)
@@ -47,42 +47,15 @@
#------------------------------------------------------------------------
# Traversal
-from zope.traversing.browser.interfaces import IAbsoluteURL
-from zope.traversing.interfaces import IContainmentRoot
-from zope.traversing.interfaces import IPhysicallyLocatable
-from zope.traversing.interfaces import ITraverser, ITraversable
-from zope.traversing.adapters import DefaultTraversable
-from zope.traversing.adapters import Traverser, RootPhysicallyLocatable
-from zope.traversing.namespace import etc
-from zope.location.traversing import LocationPhysicallyLocatable
-from zope.app.container.traversal import ContainerTraversable
+from zope.traversing.interfaces import ITraversable
from zope.app.container.interfaces import ISimpleReadContainer
-
+from zope.app.container.traversal import ContainerTraversable
def setUpTraversal():
- from zope.traversing.browser import SiteAbsoluteURL, AbsoluteURL
+ from zope.traversing.testing import setUp
+ setUp()
+ zope.component.provideAdapter(ContainerTraversable,
+ (ISimpleReadContainer,), ITraversable)
- ztapi.provideAdapter(None, ITraverser, Traverser)
- ztapi.provideAdapter(None, ITraversable, DefaultTraversable)
-
- ztapi.provideAdapter(
- ISimpleReadContainer, ITraversable, ContainerTraversable)
- ztapi.provideAdapter(
- None, IPhysicallyLocatable, LocationPhysicallyLocatable)
- ztapi.provideAdapter(
- IContainmentRoot, IPhysicallyLocatable, RootPhysicallyLocatable)
-
- # set up etc namespace
- ztapi.provideAdapter(None, ITraversable, etc, name="etc")
- ztapi.provideView(None, None, ITraversable, "etc", etc)
-
- ztapi.browserView(None, "absolute_url", AbsoluteURL)
- ztapi.browserView(IContainmentRoot, "absolute_url", SiteAbsoluteURL)
-
- ztapi.browserView(None, '', AbsoluteURL, providing=IAbsoluteURL)
- ztapi.browserView(IContainmentRoot, '', SiteAbsoluteURL,
- providing=IAbsoluteURL)
-
-
#------------------------------------------------------------------------
# ISiteManager lookup
from zope.app.component.site import SiteManagerAdapter
Modified: Zope3/branches/jim-adapter/src/zope/traversing/testing.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/traversing/testing.py 2006-04-05 15:22:28 UTC (rev 66549)
+++ Zope3/branches/jim-adapter/src/zope/traversing/testing.py 2006-04-05 15:34:54 UTC (rev 66550)
@@ -20,7 +20,35 @@
import zope.component
import zope.interface
from zope.publisher.interfaces.browser import IDefaultBrowserLayer
+from zope.location.traversing import LocationPhysicallyLocatable
+from zope.traversing.interfaces import ITraverser, ITraversable
+from zope.traversing.interfaces import IPhysicallyLocatable
+from zope.traversing.interfaces import IContainmentRoot
+from zope.traversing.adapters import DefaultTraversable
+from zope.traversing.adapters import Traverser, RootPhysicallyLocatable
+from zope.traversing.browser import SiteAbsoluteURL, AbsoluteURL
+from zope.traversing.browser.interfaces import IAbsoluteURL
+from zope.traversing.namespace import etc
+def setUp():
+ zope.component.provideAdapter(Traverser, (None,), ITraverser)
+ zope.component.provideAdapter(DefaultTraversable, (None,), ITraversable)
+ zope.component.provideAdapter(LocationPhysicallyLocatable,
+ (None,), IPhysicallyLocatable)
+ zope.component.provideAdapter(RootPhysicallyLocatable,
+ (IContainmentRoot,), IPhysicallyLocatable)
+
+ # set up the 'etc' namespace
+ zope.component.provideAdapter(etc, (None,), ITraversable, name="etc")
+ zope.component.provideAdapter(etc, (None, None), ITraversable, name="etc")
+
+ browserView(None, "absolute_url", AbsoluteURL)
+ browserView(IContainmentRoot, "absolute_url", SiteAbsoluteURL)
+
+ browserView(None, '', AbsoluteURL, providing=IAbsoluteURL)
+ browserView(IContainmentRoot, '', SiteAbsoluteURL,
+ providing=IAbsoluteURL)
+
def browserView(for_, name, factory, providing=zope.interface.Interface):
zope.component.provideAdapter(factory, (for_, IDefaultBrowserLayer),
providing, name=name)
Modified: Zope3/branches/jim-adapter/src/zope/traversing/tests/test_physicallocationadapters.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/traversing/tests/test_physicallocationadapters.py 2006-04-05 15:22:28 UTC (rev 66549)
+++ Zope3/branches/jim-adapter/src/zope/traversing/tests/test_physicallocationadapters.py 2006-04-05 15:34:54 UTC (rev 66550)
@@ -16,9 +16,10 @@
$Id$
"""
from unittest import TestCase, main, makeSuite
+
+import zope.traversing.testing
+from zope.traversing.interfaces import IContainmentRoot, IPhysicallyLocatable
from zope.interface import implements
-from zope.traversing.interfaces import IContainmentRoot
-from zope.traversing.interfaces import IPhysicallyLocatable
from zope.app.testing import setup
from zope.app.container.contained import contained
@@ -38,7 +39,7 @@
class Test(TestCase):
def test(self):
- setup.setUpTraversal()
+ zope.traversing.testing.setUp()
root = Root()
f1 = contained(C(), root, name='f1')
More information about the Zope3-Checkins
mailing list