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
for="Products.CMFCore.interfaces.IContentish
zope.lifecycleevent.interfaces.IObjectAddedEvent"
zope.lifecycleevent.interfaces.IObjectRemovedEvent"
handler=".comment.notify_content_object_deleted"
/>

View File

@ -277,10 +277,15 @@ class CommentCatalogTest(PloneTestCase):
self.assertEquals(len(brains), 0)
def test_remove_comments_when_content_object_is_removed(self):
# Make sure all comments are removed from the catalog, if the content
# object is removed.
pass
"""Make sure all comments are removed from the catalog, if the content
object is removed.
"""
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):
# Clear and rebuild catalog
self.catalog.clearFindAndRebuild()