Use the right event subscriber to make sure all comments are removed from the catalog, if their content object is deleted.

svn path=/plone.app.discussion/trunk/; revision=40485
This commit is contained in:
Timo Stollenwerk 2010-10-02 14:50:17 +00:00
parent 1edbf3a262
commit 51d6c60412
2 changed files with 10 additions and 5 deletions

View File

@ -39,7 +39,7 @@
<subscriber <subscriber
for="Products.CMFCore.interfaces.IContentish for="Products.CMFCore.interfaces.IContentish
zope.lifecycleevent.interfaces.IObjectAddedEvent" zope.lifecycleevent.interfaces.IObjectRemovedEvent"
handler=".comment.notify_content_object_deleted" handler=".comment.notify_content_object_deleted"
/> />

View File

@ -277,9 +277,14 @@ class CommentCatalogTest(PloneTestCase):
self.assertEquals(len(brains), 0) self.assertEquals(len(brains), 0)
def test_remove_comments_when_content_object_is_removed(self): def test_remove_comments_when_content_object_is_removed(self):
# Make sure all comments are removed from the catalog, if the content """Make sure all comments are removed from the catalog, if the content
# object is removed. object is removed.
pass """
brains = self.catalog.searchResults(portal_type = 'Discussion Item')
self.assertEquals(len(brains), 1)
self.portal.manage_delObjects(["doc1"])
brains = self.catalog.searchResults(portal_type = 'Discussion Item')
self.assertEquals(len(brains), 0)
def test_clear_and_rebuild_catalog(self): def test_clear_and_rebuild_catalog(self):
# Clear and rebuild catalog # Clear and rebuild catalog