[CMF-checkins] SVN: CMF/branches/CMF-1_5-branch/CMFCore/FSObject.py - FSObject.manage_doCustomize() was broken for folderish objects on Zope

Christian 'Tiran' Heimes christian at cheimes.de
Thu Jul 21 09:58:23 EDT 2005


Log message for revision 37359:
      - FSObject.manage_doCustomize() was broken for folderish objects on Zope
        2.8 because manage_permission requires a context to work.
        (see http://www.zope.org/Collectors/CMF/368)   

Changed:
  U   CMF/branches/CMF-1_5-branch/CMFCore/FSObject.py

-=-
Modified: CMF/branches/CMF-1_5-branch/CMFCore/FSObject.py
===================================================================
--- CMF/branches/CMF-1_5-branch/CMFCore/FSObject.py	2005-07-21 10:07:53 UTC (rev 37358)
+++ CMF/branches/CMF-1_5-branch/CMFCore/FSObject.py	2005-07-21 13:58:23 UTC (rev 37359)
@@ -23,6 +23,8 @@
 from AccessControl.Permission import Permission
 from Acquisition import Implicit
 from Acquisition import aq_base
+from Acquisition import aq_inner
+from Acquisition import aq_parent
 from OFS.Cache import Cacheable
 from OFS.SimpleItem import Item
 from DateTime import DateTime
@@ -81,6 +83,7 @@
         """
 
         obj = self._createZODBClone()
+        parent = aq_parent(aq_inner(self))
 
         # Preserve cache manager associations
         cachemgr_id = self.ZCacheable_getManagerId()
@@ -102,7 +105,10 @@
             rop_info = self.rolesOfPermission(old_perm)
             roles = [x['name'] for x in rop_info if x['selected'] != '']
             try:
-                obj.manage_permission(old_perm, roles=roles, acquire=acquired)
+                # if obj is based on OFS.ObjectManager an acquisition context is
+                # required for _subobject_permissions()
+                obj.__of__(parent).manage_permission(old_perm, roles=roles,
+                                                     acquire=acquired)
             except ValueError:
                 # The permission was invalid, never mind
                 pass



More information about the CMF-checkins mailing list