Skip to content

Commit

Permalink
Converted removeAllProxies calls to the prefered removeSecurityProxy.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jim Fulton committed Aug 20, 2004
1 parent cc67c2e commit 738f36e
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions directory.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -49,7 +49,12 @@ def __init__(self, context):
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__()

0 comments on commit 738f36e

Please sign in to comment.