[Zope3-checkins] SVN: Zope3/branches/ZopeX3-3.0/src/zope/app/container/directory.py Converted removeAllProxies calls to the prefered removeSecurityProxy.

Jim Fulton jim at zope.com
Fri Aug 20 17:42:45 EDT 2004


Log message for revision 27199:
  Converted removeAllProxies calls to the prefered removeSecurityProxy.
  


Changed:
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/container/directory.py


-=-
Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/container/directory.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/container/directory.py	2004-08-20 21:07:23 UTC (rev 27198)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/container/directory.py	2004-08-20 21:42:45 UTC (rev 27199)
@@ -24,7 +24,7 @@
 $Id$
 """
 import zope.app.filerepresentation.interfaces
-from zope.proxy import removeAllProxies
+from zope.security.proxy import removeSecurityProxy
 from zope.interface import implements
 
 def noop(container):
@@ -49,7 +49,12 @@
         self.context = context
 
     def __call__(self, name):
-        # We remove all of the proxies so we can actually
-        # call the class. This should be OK as we are only
-        # calling this for objects that get this adapter.
-        return removeAllProxies(self.context).__class__()
+        
+        # We remove the security proxy so we can actually call the
+        # class and return an unproxied new object.  (We can't use a
+        # trusted adapter, because the result must be unproxied.)  By
+        # registering this adapter, one effectively gives permission
+        # to clone the class.  Don't use this for classes that have
+        # exciting side effects as a result of instantiation. :)
+
+        return removeSecurityProxy(self.context).__class__()



More information about the Zope3-Checkins mailing list