[Zope-Checkins] CVS: Zope3/lib/python/Zope/ComponentArchitecture - __init__.py:1.6

Jim Fulton jim@zope.com
Fri, 12 Jul 2002 15:28:35 -0400


Update of /cvs-repository/Zope3/lib/python/Zope/ComponentArchitecture
In directory cvs.zope.org:/tmp/cvs-serv21500/lib/python/Zope/ComponentArchitecture

Modified Files:
	__init__.py 
Log Message:
Finally added a configuration directive for registering traversal
namespace handlers:

  <traversalNamespace name="etc" handler=".EtcNamespace.etc" />

Added a "skin" namespace so you can play with Sidbei's new UI work
by adding ++skin++ZopeTop to the front of your URLs:

  http://localhost:8080/++skin++ZopeTop

Added some needed __init__ modules to some of the new ZopeTop packages
and fixed up ZopeTop configure.zcml.



=== Zope3/lib/python/Zope/ComponentArchitecture/__init__.py 1.5 => 1.6 ===
 def queryAdapter(object, interface, default=None, context=None):
     if context is None:
         context = object
-    return getService(context, 'Adapters').queryAdapter(
+    try:
+        adapters = getService(context, 'Adapters')
+    except:
+        # Oh blast, no adapters. We're probably just running from a test
+        return default
+    
+    return adapters.queryAdapter(
         object, interface, default)
 
 # Factory service