[Zope-dev] aq_inContextOf attribute error
Alex V Koval
alex@koval.kharkov.ua
Tue, 2 Jan 2001 10:16:12 +0200 (EET)
Hello All !
After installing latest stable version of Zope (2.2.4) I tried to
install ZFormulator version 0.2. And as result got 2 problems with
permissions system. First was in ZFormulator itself, and was corrected:
__roles__ = ('manager',)
was changed to
__roles__ = ('Manager',)
but this bug correction worked fine for previous versions of Zope,
and in current version adding of field produced error:
Attribute Error: aq_inContextOf in line 231 of
lib/python/AccessControl/User.py
I am nor Zope nor Python hacker, but I tried to correct this line a little,
and this worked for me. Please advice did I made it correct way or not.
User.py line 231:
----------------
Here was the original code (which produced error):
if not parent.aq_inContextOf(self.aq_parent.aq_parent,1):
Here is replacement (added check is attribute exists):
if hasattr(parent, 'aq_inContextOf') and not parent.aq_inContextOf(self.aq_parent.aq_parent,1):
After this correction everything works fine, but since I am not Zope/Python
guru, but just a user which wanted some program to start working, I keeping
changed locally, but of course I am interested was this correction OK.
Regards.
--
Alex V. Koval