diff --git a/CHANGES.txt b/CHANGES.txt index 649d2ff..9db1d65 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -4,6 +4,10 @@ Changelog 2.0b1 (Unreleased) ------------------ +- When returning a comment's title, give preference to its title attribute + if set. + [davisagli] + - Use the cooked text of legacy comments when migrating. [davisagli] diff --git a/plone/app/discussion/comment.py b/plone/app/discussion/comment.py index 81e9cfc..9aa016c 100644 --- a/plone/app/discussion/comment.py +++ b/plone/app/discussion/comment.py @@ -137,6 +137,10 @@ class Comment(CatalogAware, WorkflowAware, DynamicType, Traversable, def Title(self): """The title of the comment. """ + + if self.title: + return self.title + if not self.creator: creator = translate(Message(_(u"label_anonymous", default=u"Anonymous"))) diff --git a/plone/app/discussion/tests/test_migration.py b/plone/app/discussion/tests/test_migration.py index 8df9e16..2bb32c9 100644 --- a/plone/app/discussion/tests/test_migration.py +++ b/plone/app/discussion/tests/test_migration.py @@ -68,7 +68,7 @@ class MigrationTest(PloneTestCase): self.failUnless(conversation.getComments().next()) comment1 = conversation.values()[0] self.assert_(IComment.providedBy(comment1)) - self.assertEquals(comment1.Title(), 'Jim on Document 1') + self.assertEquals(comment1.Title(), 'My Title') self.assertEquals(comment1.text, '

My Text

\n') self.assertEquals(comment1.mime_type, 'text/html') self.assertEquals(comment1.Creator(), 'Jim')