[Zope-Checkins] CVS: Zope3/lib/python/Zope/Security - Checker.py:1.1.2.11

Jim Fulton jim@zope.com
Sat, 27 Apr 2002 16:21:35 -0400


Update of /cvs-repository/Zope3/lib/python/Zope/Security
In directory cvs.zope.org:/tmp/cvs-serv14438

Modified Files:
      Tag: SecurityProxy-branch
	Checker.py 
Log Message:
Added extra names to lists of allowed names for tuples and lists so
that iteration and containment checks worked.

The tuple checker was also used for BTreeItems. BTreeItems needed
these extra methods to be permitted even though BTreeItems doesn't
implement them. This makes me suspect that we don't have proxies quite
right. There are common idioms used by Python to detect operation
support. Proxies aren't supporting these correctly.


=== Zope3/lib/python/Zope/Security/Checker.py 1.1.2.10 => 1.1.2.11 ===
                         'iterkeys', 'iteritems', 'itervalues', '__contains__',
                         ]),
-    list: NamesChecker(['__getitem__', '__len__', '__iter__',
-                        'index', 'count']),
+    list: NamesChecker(['__getitem__', '__getslice__', '__len__', '__iter__',
+                        '__contains__', 'index', 'count']),
 
     # YAGNI: () a rock
-    tuple: NamesChecker(['__getitem__', '__len__']),
+    tuple: NamesChecker(['__getitem__', '__getslice__',
+                         '__contains__', '__len__', '__iter__']),
     InstanceType: _instanceChecker,
     Proxy: NoProxy,
     ClassType: _classChecker,
@@ -271,6 +272,7 @@
     MethodType: _callableChecker,
     type: _typeChecker,
     ModuleType: _moduleChecker,
+    type(iter([])): NamesChecker(['next']),
     }