[Checkins] SVN: zope.traversing/trunk/ Resolved the dependency on zope.app.applicationcontrol by importing the

Thomas Lotze tl at gocept.com
Wed Nov 21 04:05:31 EST 2007


Log message for revision 81951:
  Resolved the dependency on zope.app.applicationcontrol by importing the
  application controller only if the package is available.
  

Changed:
  U   zope.traversing/trunk/CHANGES.txt
  U   zope.traversing/trunk/setup.py
  U   zope.traversing/trunk/src/zope/traversing/namespace.py
  U   zope.traversing/trunk/src/zope/traversing/tests/test_etc.py

-=-
Modified: zope.traversing/trunk/CHANGES.txt
===================================================================
--- zope.traversing/trunk/CHANGES.txt	2007-11-21 08:41:11 UTC (rev 81950)
+++ zope.traversing/trunk/CHANGES.txt	2007-11-21 09:05:31 UTC (rev 81951)
@@ -8,3 +8,6 @@
 - Added a traverer for ++skin++ for XMLRPC skins (IXMLRPCSkinType). This also
   means that the normal ++skin++ namespace handler is only bound to
   IBrowserRequest. 
+
+- Resolved the dependency on zope.app.applicationcontrol by importing the
+  application controller only if the package is available.

Modified: zope.traversing/trunk/setup.py
===================================================================
--- zope.traversing/trunk/setup.py	2007-11-21 08:41:11 UTC (rev 81950)
+++ zope.traversing/trunk/setup.py	2007-11-21 09:05:31 UTC (rev 81951)
@@ -36,9 +36,10 @@
       extras_require = dict(test=['zope.app.testing',
                                   'zope.app.securitypolicy',
                                   'zope.app.zcmlfiles',
-                                  'zope.app.zptpage']),
+                                  'zope.app.zptpage',
+                                  'zope.app.applicationcontrol',
+                                  ]),
       install_requires=['setuptools',
-                        'zope.app.applicationcontrol',
                         'zope.component',
                         'zope.i18n',
                         'zope.i18nmessageid',

Modified: zope.traversing/trunk/src/zope/traversing/namespace.py
===================================================================
--- zope.traversing/trunk/src/zope/traversing/namespace.py	2007-11-21 08:41:11 UTC (rev 81950)
+++ zope.traversing/trunk/src/zope/traversing/namespace.py	2007-11-21 09:05:31 UTC (rev 81951)
@@ -308,14 +308,17 @@
 
         ob = self.context
 
-        # TODO: lift dependency on zope.app
         if (name in ('process', 'ApplicationController')
             and IContainmentRoot.providedBy(ob)):
             # import the application controller here to avoid circular
             # import problems
-            from zope.app.applicationcontrol.applicationcontrol \
-                 import applicationController
-            return applicationController
+            try:
+                from zope.app.applicationcontrol.applicationcontrol \
+                     import applicationController
+            except ImportError:
+                pass
+            else:
+                return applicationController
 
         if name not in ('site',):
             raise TraversalError(ob, name)

Modified: zope.traversing/trunk/src/zope/traversing/tests/test_etc.py
===================================================================
--- zope.traversing/trunk/src/zope/traversing/tests/test_etc.py	2007-11-21 08:41:11 UTC (rev 81950)
+++ zope.traversing/trunk/src/zope/traversing/tests/test_etc.py	2007-11-21 09:05:31 UTC (rev 81951)
@@ -21,6 +21,15 @@
 class Test(CleanUp, TestCase):
 
     def testApplicationControl(self):
+        # This test is to be taken with care. The 'process' name will only be
+        # resolved if zope.app.applicationcontrol can be imported in the first
+        # place. So there is no guarantee that 'process' can be resolved in
+        # spite of the test; it just assures that if the applicationcontroller
+        # can be imported, the 'process' name will be resolved correctly.
+        # While the zope.traversing package itself no longer depends on
+        # zope.app.applicationcontrol, its tests do, so we always test the
+        # behaviour in the case that the application controller is present.
+
         from zope.traversing.namespace import etc
         from zope.app.applicationcontrol.applicationcontrol \
              import applicationController, applicationControllerRoot



More information about the Checkins mailing list