[ZCM] [ZC] 236/ 2 Comment "Owned.changeOwnership buggy ?"
Collector: Zope Bugs and Patches ...
zope-coders@zope.org
Wed, 20 Feb 2002 16:35:39 -0500
Issue #236 Update (Comment) "Owned.changeOwnership buggy ?"
Status Pending, Zope/bug medium
To followup, visit:
http://collector.zope.org/Zope/236
==============================================================
= Comment - Entry #2 by gillou on Feb 20, 2002 4:35 pm
Jerôme Alet gently replyed in zope@zope.org he already noticed this behavior in former Zope releases.
http://zope.nipltd.com/public/lists/zope-archive.nsf/47ba74c812dbc5dd8025687f0024bb5f/1253144daa5a47e280256ae7003c96cd?OpenDocument&Highlight=2,jerome,patch
http://zope.nipltd.com/public/lists/zope-archive.nsf/47ba74c812dbc5dd8025687f0024bb5f/124aa6e6063c68c180256ac6005913e9?OpenDocument&Highlight=2,jerome,patch
________________________________________
= Request - Entry #1 by gillou on Feb 20, 2002 4:31 pm
Hi,
When trying to give (with an externat method) an authentified user the ownership of a folder and - recursively - its content, I noticed that when that folder is already owned by that user, the somefolder.changeOwnership(someuser, recursive=1) did not work on objects contained in that folder (always owned by the former owner).
When reading the source (lib/python/AccessControl/Owned.py), I noticed this (lines 106...108) in changeOwnership():
old=aq_get(self, '_owner', None, 1)
if old==new: return
if old is UnownableOwner: return
Means that if the new owner is the former owner, changeOwnership stops immediately, even if recursive=1.
So I commented out line 107 (# if old==new: return) and it works. I mean the owner of the folder is changed as well as the contained objects, like stated in the method's docstring, whatever's the current folder owner.
==============================================================