Make sure only comments to the content object are removed from the catalog when the content object is moved.

svn path=/plone.app.discussion/trunk/; revision=51527
This commit is contained in:
Timo Stollenwerk
2011-08-04 15:53:21 +00:00
parent 0e47299c75
commit cdf2beda40
3 changed files with 38 additions and 17 deletions
+5 -1
View File
@@ -227,7 +227,11 @@ def notify_content_object_moved(obj, event):
return
# Remove comments at the old location from catalog
catalog = getToolByName(obj, 'portal_catalog')
for brain in catalog.searchResults(portal_type = 'Discussion Item'):
brains = catalog.searchResults(dict(
path={'query': '/'.join(event.oldParent.getPhysicalPath())},
portal_type="Discussion Item"
))
for brain in brains:
catalog.uncatalog_object(brain.getPath())
# Reindex comment at the new location
conversation = IConversation(obj)