[Zope3-checkins] CVS: Zope3/src/zope/app/component - metaconfigure.py:1.42

Stephan Richter srichter at cosmos.phy.tufts.edu
Sat Apr 24 19:19:28 EDT 2004


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

Modified Files:
	metaconfigure.py 
Log Message:


The simple proxyView function simply did not handle multi-views
correctly. Shrug. Took me 3 hours to find this bug. I replaced the function
with a class that does the right thing and updated the API doc tool to
recognize it as well.




=== Zope3/src/zope/app/component/metaconfigure.py 1.41 => 1.42 ===
--- Zope3/src/zope/app/component/metaconfigure.py:1.41	Fri Apr 23 07:38:58 2004
+++ Zope3/src/zope/app/component/metaconfigure.py	Sat Apr 24 19:19:27 2004
@@ -289,12 +289,17 @@
         checker = _checker(_context, permission,
                            allowed_interface, allowed_attributes)
 
-        def proxyView(context, request, factory=factory[-1], checker=checker):
-            return proxify(factory(context, request), checker)
-        # Keep track of the factory for documentation
-        proxyView.factory = factory[-1]
+        class ProxyView(object):
+            """Class to create simple proxy views."""
 
-        factory[-1] = proxyView
+            def __init__(self, factory, checker):
+                self.factory = factory
+                self.checker = checker
+
+            def __call__(self, *objects):
+                return proxify(self.factory(*objects), self.checker)
+
+        factory[-1] = ProxyView(factory[-1], checker)
 
 
     if not for_:




More information about the Zope3-Checkins mailing list