[Zope] problem with manage_permission

Jerome Alet alet@unice.fr
Wed, 26 Jul 2000 13:30:01 +0200 (MET DST)


Hi,

I'm currently trying to create a python product.

I've got a class named MyClass, and in the __init__ method I've got the
following code:

self.manage_addFolder(id="data", title="MyClass instance's datas")        
self._addRole('admin')  
self.manage_permission(permission_to_manage = 
  "Access contents information" , roles = [ 'Manager', 'admin' ]) 

MyClass inherits from Folder. 

I want to programmatically create a 'data' Folder and an 'admin' role in
each new instance of MyClass, and give this role and Manager (but not
Anonymous)  the "Access contents information"  permission.

The manage_addFolder and _addRole work fine, but the manage_permission
call gives me the following traceback: 

Error Type: AttributeError
Error Value: aq_acquire

Traceback (innermost last):
  File /usr/local/zope/lib/python/ZPublisher/Publish.py, line 214, in
publish_module
  File /usr/local/zope/lib/python/ZPublisher/Publish.py, line 179, in
publish
  File /usr/local/zope/lib/python/Zope/__init__.py, line 202, in
zpublisher_exception_hook
  File /usr/local/zope/lib/python/ZPublisher/Publish.py, line 165, in
publish
  File /usr/local/zope/lib/python/ZPublisher/mapply.py, line 160, in
mapply
    (Object: manage_addMyClass)
  File /usr/local/zope/lib/python/ZPublisher/Publish.py, line 102, in
call_object
    (Object: manage_addMyClass)
  File /usr/local/zope/lib/python/Products/MyClass/MyClass.py, line
45, in
manage_addMyClass
  File /usr/local/zope/lib/python/Products/MyClass/MyClass.py, line 153,
in __init__
    (Object: ElementWithAttributes)
  File /usr/local/zope/lib/python/AccessControl/Role.py, line 208, in
manage_permission
    (Object: ElementWithAttributes)
  File /usr/local/zope/lib/python/AccessControl/Role.py, line 136, in
ac_inherited_permissions
    (Object: ElementWithAttributes)
  File /usr/local/zope/lib/python/OFS/ObjectManager.py, line 173, in
_subobject_permissions
    (Object: ElementWithAttributes)
AttributeError: (see above)

Surprisingly, if I delete the manage_permission line, restart Zope, re-add
an instance of MyClass (it works), then try to manually modify the
permissions using the MyClass instance's security tab, then it works
flawlessly. 

Does anyone have got an idea about where the problem may come from ?

thanks in advance.

Jerome ALET - alet@unice.fr - http://cortex.unice.fr/~jerome
Faculte de Medecine de Nice - http://noe.unice.fr - Tel: 04 93 37 76 30 
28 Avenue de Valombrose - 06107 NICE Cedex 2 - FRANCE