Andreas Jung wrote:
I can across the following problem while trying to fix the broken FTP service for Zope 2.8:
ObjectManager.manage_FTPstat() tries to access self.manage_FTPlist.__roles__ whose value is ('Manager',') in Zope 2.7. In 2.8 this attribute is not available. Can someone explain how and where is attribute in set Zope 2.7 and why it is no longer available in Zope 2.8 (has it anything to do with new-style classes in 2.8).
Dieter's response is right. Classic extenstion classes had a method-attribute mechanism that isn't available in new-style extension classes. There is a new API for getting the roles for an object: from AcessControl.ZopeSecurityPolicy import getRoles Now, suppose we wanted the roles for attribute 'x' on an object: roles = getRoles(ob, 'x', ob.x) This works for methods *and* for other objects that don't have their own '__roles__' attribute. For example, it could be used for attributes whos values are strings. It means that you can now protect *any* attribute. Technically, there is no longer a need for "unprotected subobjects". In this regard, Zope 2 has become a litte bit more like Zope 3. It also works for objects that do have theor own __roles__ attribute. It actually checkes for a __roles__ attribute on the third object passed. For now, this api is the prefered way to do what you want. Jim -- Jim Fulton mailto:jim@zope.com Python Powered! CTO (540) 361-1714 http://www.python.org Zope Corporation http://www.zope.com http://www.zope.org