Zope Subversion Repository

  Zope

Zope: Zope3/trunk/src/zope/app/security/adapter.py

Diff for /Zope3/trunk/src/zope/app/security/adapter.py between version 27133 and 27237

version 27133, Fri Aug 13 20:32:40 2004 UTC version 27237, Mon Aug 23 23:42:11 2004 UTC
Line 17 
Line 17 
 """  """
   
 from zope.security.checker import ProxyFactory  from zope.security.checker import ProxyFactory
 from zope.security.proxy import getProxiedObject  from zope.security.proxy import removeSecurityProxy
 from zope.app.location import ILocation, Location  from zope.app.location import ILocation, Location
   
 class TrustedAdapterFactory(object):  class TrustedAdapterFactory(object):
Line 68 
Line 68 
        And the object proxied is not.  (We actually have to remove the         And the object proxied is not.  (We actually have to remove the
        adapter to get to the adapted object in this case.)         adapter to get to the adapted object in this case.)
   
          >>> a = getProxiedObject(a)           >>> a = removeSecurityProxy(a)
          >>> type(a.context).__name__           >>> type(a.context).__name__
          'list'           'list'
   
Line 86 
Line 86 
          >>> a = TM(p, o2, o3)           >>> a = TM(p, o2, o3)
          >>> type(a).__name__           >>> type(a).__name__
          '_Proxy'           '_Proxy'
          >>> a = getProxiedObject(a)           >>> a = removeSecurityProxy(a)
          >>> a.context[0] is o, a.context[1] is o2, a.context[2] is o3           >>> a.context[0] is o, a.context[1] is o2, a.context[2] is o3
          (True, True, True)           (True, True, True)
   
          >>> a = TM(p, ProxyFactory(o2), ProxyFactory(o3))           >>> a = TM(p, ProxyFactory(o2), ProxyFactory(o3))
          >>> type(a).__name__           >>> type(a).__name__
          '_Proxy'           '_Proxy'
          >>> a = getProxiedObject(a)           >>> a = removeSecurityProxy(a)
          >>> a.context[0] is o, a.context[1] is o2, a.context[2] is o3           >>> a.context[0] is o, a.context[1] is o2, a.context[2] is o3
          (True, True, True)           (True, True, True)
   
Line 116 
Line 116 
   
          >>> TL(o).__parent__ is o           >>> TL(o).__parent__ is o
          True           True
          >>> getProxiedObject(TL(p)).__parent__ is o           >>> removeSecurityProxy(TL(p)).__parent__ is o
          True           True
   
        The factory adapter has the __name__ and __module__ of the factory it adapts:         The factory adapter has the __name__ and __module__ of the
          factory it adapts:
   
          >>> (TA.__module__, TA.__name__) == (A.__module__, A.__name__)           >>> (TA.__module__, TA.__name__) == (A.__module__, A.__name__)
          True           True
Line 133 
Line 134 
   
     def __call__(self, *args):      def __call__(self, *args):
         for arg in args:          for arg in args:
             if getProxiedObject(arg) is not arg:              if removeSecurityProxy(arg) is not arg:
                 args = map(getProxiedObject, args)                  args = map(removeSecurityProxy, args)
                 adapter = self.factory(*args)                  adapter = self.factory(*args)
                 if (ILocation.providedBy(adapter)                  if (ILocation.providedBy(adapter)
                     and adapter.__parent__ is None):                      and adapter.__parent__ is None):


Generate output suitable for use with a patch program
Legend:
Removed from v.27133  
changed lines
  Added in v.27237

webmaster@zope.org

Powered by ViewCVS 1.0-dev
(Powered by Apache)

ViewCVS and CVS Help