diff --git a/CHANGES.txt b/CHANGES.txt index 86ae0c6..f70fe0b 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -4,6 +4,10 @@ Changelog 1.0RC1 (unreleased) ------------------- +- Always set the effective date of a comment to the same value as the creation + date. + [timo] + - Fix SMTP exception when an email is send to the moderator. [timo] diff --git a/plone/app/discussion/catalog.py b/plone/app/discussion/catalog.py index 08c5248..03441c4 100644 --- a/plone/app/discussion/catalog.py +++ b/plone/app/discussion/catalog.py @@ -90,8 +90,12 @@ def in_response_to(object): @indexer(IComment) def effective(object): # the catalog index needs Zope DateTime instead of Python datetime - # Todo!!! - return DateTime + return DateTime(object.creation_date.year, + object.creation_date.month, + object.creation_date.day, + object.creation_date.hour, + object.creation_date.minute, + object.creation_date.second) @indexer(IComment) def created(object): diff --git a/plone/app/discussion/tests/test_indexers.py b/plone/app/discussion/tests/test_indexers.py index 0f8b9c5..166a6ab 100644 --- a/plone/app/discussion/tests/test_indexers.py +++ b/plone/app/discussion/tests/test_indexers.py @@ -151,6 +151,8 @@ class CommentIndexersTest(PloneTestCase): # Test if created, modified, effective etc. are set correctly self.assertEquals(catalog.created(self.comment)(), DateTime(2006, 9, 17, 14, 18, 12)) + self.assertEquals(catalog.effective(self.comment)(), + DateTime(2006, 9, 17, 14, 18, 12)) self.assertEquals(catalog.modified(self.comment)(), DateTime(2008, 3, 12, 7, 32, 52))