Fix unindexing of comments when deleting content resulting from

iterating over a BTree while modifying it. Fixes #11402.

svn path=/plone.app.discussion/trunk/; revision=48845
This commit is contained in:
Ross Patterson
2011-04-14 21:30:32 +00:00
parent 82b4a7ca70
commit 7354ca4298
3 changed files with 49 additions and 7 deletions
+4 -2
View File
@@ -195,14 +195,16 @@ def notify_content_object(obj, event):
'last_comment_date',
'commentators',))
def notify_content_object_deleted(obj, event):
"""Remove all comments of a content object when the content object has been
deleted.
"""
if IAnnotatable.providedBy(obj):
conversation = IConversation(obj)
for comment in conversation.getComments():
del conversation[comment.id]
while conversation:
del conversation[conversation.keys()[0]]
def notify_user(obj, event):
"""Tell users when a comment has been added.