[Zope-dev] Zope 2.5: allow_type

Yves Bastide Yves.Bastide@irisa.fr
Tue, 12 Mar 2002 17:54:50 +0100


Hi,

There seems to be a bug in either 
AccessControl.SimpleObjectPolicies.allow_type or 
Products.PythonScripts.module_access_examples.py, as 
module_access_examples's examples such as
allow_type(type(re.compile('')))
dont work.

Knowing neither Python nor Zope, I patched allow_type like this:

--- zope/lib/python/AccessControl/SimpleObjectPolicies.py~      Tue Mar 
12 17:49:14 2002
+++ zope/lib/python/AccessControl/SimpleObjectPolicies.py       Mon Mar 
  4 10:40:42 2002
@@ -57,5 +57,5 @@
          raise ValueError, "%s handles its own security" % `Type`
      if not (isinstance(allowed, IntType) or isinstance(allowed, 
DictType)):
          raise ValueError, "The 'allowed' argument must be an int or dict."
-    ContainerAssertions.update(Type, allowed)
+    ContainerAssertions.update({Type: allowed})

The above statement then works, but I don't know if this is an 
appropriate fix..

Regards,

yves