[Zope3-checkins] CVS: Zope3/src/zope/app/traversing - namespace.py:1.12

Jim Fulton jim@zope.com
Wed, 28 May 2003 18:16:17 -0400


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

Modified Files:
	namespace.py 
Log Message:
Simplified the strategy for handling "side effect" URL path segments.
Before, we created an extra context wrapper for each segment.  Now we
just keep track of the extra names used in the context wrapper for the
original object.


=== Zope3/src/zope/app/traversing/namespace.py 1.11 => 1.12 ===
--- Zope3/src/zope/app/traversing/namespace.py:1.11	Tue May 27 10:18:27 2003
+++ Zope3/src/zope/app/traversing/namespace.py	Wed May 28 18:15:46 2003
@@ -18,7 +18,7 @@
 
 from zope.interface import Interface
 from zope.exceptions import NotFoundError
-from zope.context import ContextWrapper, getWrapperObject
+from zope.context import ContextWrapper, getWrapperData
 from zope.context import getWrapperContext
 from zope.configuration.action import Action
 from zope.component import queryAdapter, getAdapter, getServiceManager
@@ -74,20 +74,13 @@
         # different object.  We want to retain the side-effect name
         # for things like URLs.
 
-        # But wait, there's more. The object may be wrapped. If the
-        # object is already wrapped and we return the object in the
-        # context of itself, the containment context will be wrong,
-        # because the inner wrapper will be the original object, so
-        # our added layer with the name we want to preserve will be
-        # ignored when searching containment.
-
-        # For this reason, we'll remove a layer of wrapping from new
-        # before we put it in context.
-
-        new = getWrapperObject(new)
-
-        new = ContextWrapper(new, object, name='.', side_effect_name=name)
+        # We'll just at the name to the side-effect names stored in
+        # the object's wrapper.
 
+        data = getWrapperData(new, create=True)
+        data['side_effect_names'] = (data.get('side_effect_names', ())
+                                     + (name, )
+                                     )
     else:
         new = ContextWrapper(new, object, name=name)