migrate creation_date and modification_date too.

svn path=/plone.app.discussion/trunk/; revision=28019
This commit is contained in:
Timo Stollenwerk 2009-07-12 17:55:54 +00:00
parent 18ee5159bd
commit 356db660b0
2 changed files with 14 additions and 3 deletions

View File

@ -1,3 +1,5 @@
from datetime import datetime
from Acquisition import aq_inner, aq_parent from Acquisition import aq_inner, aq_parent
from Products.Five.browser import BrowserView from Products.Five.browser import BrowserView
@ -49,9 +51,11 @@ class View(BrowserView):
comment.title = reply.Title() comment.title = reply.Title()
comment.text = reply.text comment.text = reply.text
comment.creator = reply.Creator() comment.creator = reply.Creator()
#comment.author_name = author_username
#comment.author_email = "" #comment.creation_date = datetime.fromtimestamp(reply.creation_date)
#comment.creation_date
comment.creation_date = datetime.fromtimestamp(reply.creation_date)
comment.modification_date = datetime.fromtimestamp(reply.modification_date)
comment.reply_to = in_reply_to comment.reply_to = in_reply_to

View File

@ -1,3 +1,6 @@
from datetime import datetime
from DateTime import DateTime
import unittest import unittest
from zope.annotation.interfaces import IAnnotations from zope.annotation.interfaces import IAnnotations
@ -40,6 +43,8 @@ class MigrationTest(PloneTestCase):
#reply = talkback.objectValues()[0] #reply = talkback.objectValues()[0]
reply = talkback.getReplies()[0] reply = talkback.getReplies()[0]
reply.setReplyTo(self.doc) reply.setReplyTo(self.doc)
reply.creation_date = DateTime(2003, 3, 11, 9, 28, 6)
reply.modification_date = DateTime(2009, 7, 12, 19, 38, 7)
self.assertEquals(reply.Title(), 'My Title') self.assertEquals(reply.Title(), 'My Title')
self.assertEquals(reply.EditableBody(), 'My Text') self.assertEquals(reply.EditableBody(), 'My Text')
self.failUnless('Jim' in reply.listCreators()) self.failUnless('Jim' in reply.listCreators())
@ -62,6 +67,8 @@ class MigrationTest(PloneTestCase):
self.assertEquals(comment1.Title(), 'My Title') self.assertEquals(comment1.Title(), 'My Title')
self.assertEquals(comment1.text, 'My Text') self.assertEquals(comment1.text, 'My Text')
self.assertEquals(comment1.Creator(), 'Jim') self.assertEquals(comment1.Creator(), 'Jim')
self.assertEquals(comment1.creation_date, datetime(2003, 3, 11, 9, 28, 6))
self.assertEquals(comment1.modification_date, datetime(2009, 7, 12, 19, 38, 7))
self.assertEquals( self.assertEquals(
[{'comment': comment1, 'depth': 0, 'id': long(comment1.id)},] [{'comment': comment1, 'depth': 0, 'id': long(comment1.id)},]
, list(conversation.getThreads())) , list(conversation.getThreads()))