[Zope-Checkins] CVS: Zope3/lib/python/Zope/Publisher - mapply.py:1.1.2.7.6.1

Jim Fulton jim@zope.com
Tue, 26 Mar 2002 13:00:23 -0500


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

Modified Files:
      Tag: Zope3-publisher-refactor-branch
	mapply.py 
Log Message:
Modified the server to use the new request factory API and got all the
unit tests to pass.


=== Zope3/lib/python/Zope/Publisher/mapply.py 1.1.2.7 => 1.1.2.7.6.1 ===
     return unwrapped, wrapperCount
 
-def mapply(object, positional=(), keyword={}, call=apply):
+def mapply(object, positional=(), request={}, call=apply):
     __traceback_info__ = object
     unwrapped, wrapperCount = unwrapMethod( object )
     code = unwrapped.func_code
@@ -66,7 +66,7 @@
     else:
         args = []
 
-    get = keyword.get
+    get = request.get
     if defaults:
         nrequired = len(names) - (len(defaults))
     else:
@@ -75,10 +75,13 @@
         name = names[index]
         v = get(name, _marker)
         if v is _marker:
-            if index < nrequired:
+            if name == 'REQUEST':
+                v = request
+            elif index < nrequired:
                 raise TypeError, 'Missing argument to %s(): %s' % (
                     getattr(unwrapped, '__name__', repr(object)), name)
-            else: v = defaults[index-nrequired]
+            else:
+                v = defaults[index-nrequired]
         args.append(v)
 
     args = tuple(args)