merge -r46947 from davisagli-features: preserve legacy titles on migrated comments
svn path=/plone.app.discussion/trunk/; revision=48357
This commit is contained in:
parent
eb004aab44
commit
9d83b4f0e6
@ -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]
|
||||
|
||||
|
@ -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")))
|
||||
|
@ -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, '<p>My Text</p>\n')
|
||||
self.assertEquals(comment1.mime_type, 'text/html')
|
||||
self.assertEquals(comment1.Creator(), 'Jim')
|
||||
|
Loading…
Reference in New Issue
Block a user