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

Steve Alexander steve@cat-box.net
Mon, 3 Feb 2003 12:44:03 -0500


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

Modified Files:
	__init__.py 
Log Message:
you can now explicitly give a context to getView


=== Zope3/src/zope/component/__init__.py 1.2 => 1.3 ===
--- Zope3/src/zope/component/__init__.py:1.2	Wed Dec 25 09:13:31 2002
+++ Zope3/src/zope/component/__init__.py	Mon Feb  3 12:43:29 2003
@@ -97,22 +97,30 @@
 
 # View service
 
-def getView(wrapped_object, name, request):
-    return getService(wrapped_object,
+def getView(wrapped_object, name, request, context=None):
+    if context is None:
+        context = wrapped_object
+    return getService(context,
                       'Views').getView(wrapped_object, name, request)
 
-def queryView(wrapped_object, name, request, default=None):
-    return getService(wrapped_object,
+def queryView(wrapped_object, name, request, default=None, context=None):
+    if context is None:
+        context = wrapped_object
+    return getService(context,
                       'Views').queryView(wrapped_object, name,
                                          request, default)
 
-def getDefaultViewName(wrapped_object, request):
-    return getService(wrapped_object,
+def getDefaultViewName(wrapped_object, request, context=None):
+    if context is None:
+        context = wrapped_object
+    return getService(context,
                       'Views').getDefaultViewName(wrapped_object,
                                                   request)
 
-def queryDefaultViewName(wrapped_object, request, default=None):
-    return getService(wrapped_object,
+def queryDefaultViewName(wrapped_object, request, default=None, context=None):
+    if context is None:
+        context = wrapped_object
+    return getService(context,
                       'Views').queryDefaultViewName(wrapped_object,
                                                     request, default)