[Zope3-checkins] CVS: Zope3/src/zope/component - __init__.py:1.13

Jim Fulton jim at zope.com
Sun Sep 21 13:34:07 EDT 2003


Update of /cvs-repository/Zope3/src/zope/component
In directory cvs.zope.org:/tmp/cvs-serv15943/src/zope/component

Modified Files:
	__init__.py 
Log Message:
Rewrote getView in terms of queryView and made queryView hookable.


=== Zope3/src/zope/component/__init__.py 1.12 => 1.13 ===
--- Zope3/src/zope/component/__init__.py:1.12	Fri Jul 11 21:22:13 2003
+++ Zope3/src/zope/component/__init__.py	Sun Sep 21 13:34:06 2003
@@ -141,15 +141,19 @@
 # View service
 
 def getView(object, name, request, context=None):
-    if context is None:
-        context = object
-    return getService(context, 'Views').getView(object, name, request)
+    v = queryView(object, name, request, context=context)
+    if v is not None:
+        return v
+    
+    raise ComponentLookupError("Couldn't find view", context, name)
 
 def queryView(object, name, request, default=None, context=None):
     if context is None:
         context = object
     return getService(context,
                       'Views').queryView(object, name, request, default)
+
+queryView = hookable(queryView)
 
 def getDefaultViewName(object, request, context=None):
     if context is None:




More information about the Zope3-Checkins mailing list