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:
parent
1edbf3a262
commit
51d6c60412
@ -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"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
@ -277,10 +277,15 @@ 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
|
||||||
self.catalog.clearFindAndRebuild()
|
self.catalog.clearFindAndRebuild()
|
||||||
|
Loading…
Reference in New Issue
Block a user