[Zope-Checkins] CVS: Zope3/lib/python/Interface - Implements.py:1.1.2.2.6.1

Jim Fulton jim@zope.com
Fri, 26 Apr 2002 14:23:12 -0400


Update of /cvs-repository/Zope3/lib/python/Interface
In directory cvs.zope.org:/tmp/cvs-serv26237/lib/python/Interface

Modified Files:
      Tag: SecurityProxy-branch
	Implements.py 
Log Message:
Changed security code to use security proxies and name-based
security. This has pretty far-reaching implications:

- You now protect names/operations, *not* values. This means it's as
  easy yo protect data attributes that have simple values as it is to
  protect methods.

- There is no longer a __permissions__ attribute. :)

- There is no longer a validate method in either security managers or
  policies. 

- No more need to have a special compiler for restricted code.
  In exchange, lots of objects are proxies and code sometimes needs to
  be prepared to remove proxies.

In addition:

- Basic objects (None, strings, numbers, etc.) are not wrapped in
  context wrappers.

- There is a test that fails unless Python 2.3 is used.



=== Zope3/lib/python/Interface/Implements.py 1.1.2.2 => 1.1.2.2.6.1 ===
 CLASS_INTERFACES = 1
 
-try:
-    import ExtensionClass
-except ImportError:
-    ClassTypes = (ClassType, type(object))
-else:
-    class dummy (ExtensionClass.Base): pass
-    ClassTypes = (type(dummy), ClassType, type(object))
+ClassTypes = (ClassType, type(object))
 
 _typeImplements={}
 
@@ -54,11 +48,6 @@
             return klass.__implements__
         else:
             return None
-    elif hasattr(klass, 'instancesImplements'):
-        # Hook for ExtensionClass. :)
-        # XXX Potential security problem since "instancesImplements"
-        # is a valid Zope identifier.
-        return klass.instancesImplements()
     else:
         return tiget(klass, None)
 
@@ -70,6 +59,7 @@
     If the visitor returns anything true, the loop stops.
     This does not, and should not, visit superinterfaces.
     """
+
     if isinstance(implements, InterfaceClass):
         return visitor(implements)
     elif implements == CLASS_INTERFACES: