Commit d6b87cd5 authored by Jérome Perrin's avatar Jérome Perrin

CMFCategory: do not keep a category link to the original when moving a category

This extends the fix from 7f2e8eb2 to
the case where category is cut and pasted somewhere else ( in this case,
afterClone hooks are not called )
parent c0438640
...@@ -154,6 +154,12 @@ class Category(Folder): ...@@ -154,6 +154,12 @@ class Category(Folder):
meta_types.append(meta_type) meta_types.append(meta_type)
return meta_types return meta_types
def _postCopy(self, container, op=0):
# This method is a hook from CopySupport.
# When category is cloned or moved, we have to update the category membership to itself.
self.setCategoryMembership(self.getBaseCategoryId(), None)
return super(Category, self)._postCopy(container, op)
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getLogicalPath') 'getLogicalPath')
def getLogicalPath(self, item_method = 'getTitle'): def getLogicalPath(self, item_method = 'getTitle'):
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Category_afterClone</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment