[Zope] Zope Permission object destroys Security tab

Itai Tavor itai@optusnet.com.au
Wed, 31 Jan 2001 19:42:19 +1100


Hi,

I have a Zope product, with a lot of ZClasses in it. I defined a Zope 
Permission in this product with id='change_my_objects_permission' and 
name='Change My Objects'. I assigned this permission to several 
classes - not sure which ones.

When I click on Security in the top Zope folder I get this:

     Error Type: AttributeError
     Error Value: __getitem__

Traceback (innermost last):
   File /opt/Zope-2.3.0-linux2-x86/lib/python/ZPublisher/Publish.py, 
line 222, in publish_module
   File /opt/Zope-2.3.0-linux2-x86/lib/python/ZPublisher/Publish.py, 
line 187, in publish
   File /opt/Zope-2.3.0-linux2-x86/lib/python/Zope/__init__.py, line 
221, in zpublisher_exception_hook
     (Object: ApplicationDefaultPermissions)
   File /opt/Zope-2.3.0-linux2-x86/lib/python/ZPublisher/Publish.py, 
line 171, in publish
   File /opt/Zope-2.3.0-linux2-x86/lib/python/ZPublisher/mapply.py, 
line 160, in mapply
     (Object: manage_access)
   File /opt/Zope-2.3.0-linux2-x86/lib/python/ZPublisher/Publish.py, 
line 112, in call_object
     (Object: manage_access)
   File /opt/Zope/lib/python/AccessControl/Role.py, line 262, in manage_access
     (Object: ApplicationDefaultPermissions)
   File 
/opt/Zope-2.3.0-linux2-x86/lib/python/Shared/DC/Scripts/Bindings.py, 
line 324, in __call__
     (Object: _normal_manage_access)
   File 
/opt/Zope-2.3.0-linux2-x86/lib/python/Shared/DC/Scripts/Bindings.py, 
line 353, in _bindAndExec
     (Object: _normal_manage_access)
   File /opt/Zope-2.3.0-linux2-x86/lib/python/App/special_dtml.py, 
line 236, in _exec
     (Object: _normal_manage_access)
   File 
/opt/Zope-2.3.0-linux2-x86/lib/python/DocumentTemplate/DT_With.py, 
line 146, in render
     (Object: _.namespace(valid_roles=valid_roles()))
   File /opt/Zope/lib/python/DocumentTemplate/DT_In.py, line 660, in renderwob
     (Object: permission_settings)
   File /opt/Zope/lib/python/AccessControl/Role.py, line 185, in 
permission_settings
     (Object: ApplicationDefaultPermissions)
   File /opt/Zope/lib/python/AccessControl/Role.py, line 180, in <lambda>
AttributeError: (see above)

I added this statement to permission_settings (line 176 of 
AccessControl/Role.py):

    print('name=%s, value=%s, roles=%s' % (name, value, roles))

When it gets to my permission it outputs this:

    name=Change My Objects, value=(), roles=<Rewrapper instance at 8735f30>

I deleted the problem permission and created a new one called Test. 
This time the Security page worked and I got:

    name=Test, value=(), roles=['Manager']

If I recreate the problem permission, the problem returns.

The only difference is that 'Change My Objects' is used somewhere in 
a ZClass. But a) I can't find out where it's used other than by 
manually checking 20 ZClasses, and b) why would that be a problem 
anyway? And what's this Rewrapper thing? And why am I suddenly 
attracting all these annoying bugs?
--
Itai Tavor                      -- "Je sautille, donc je suis."    --
itai@optusnet.com.au            --               - Kermit the Frog --
--                                                                 --
-- "Every day, once a day, give yourself a present"  - Dale Cooper --