migrate creation_date and modification_date too.
svn path=/plone.app.discussion/trunk/; revision=28019
This commit is contained in:
		
							parent
							
								
									18ee5159bd
								
							
						
					
					
						commit
						356db660b0
					
				@ -1,3 +1,5 @@
 | 
			
		||||
from datetime import datetime
 | 
			
		||||
 | 
			
		||||
from Acquisition import aq_inner, aq_parent
 | 
			
		||||
 | 
			
		||||
from Products.Five.browser import BrowserView
 | 
			
		||||
@ -49,9 +51,11 @@ class View(BrowserView):
 | 
			
		||||
                comment.title = reply.Title()
 | 
			
		||||
                comment.text = reply.text
 | 
			
		||||
                comment.creator = reply.Creator()
 | 
			
		||||
                #comment.author_name = author_username
 | 
			
		||||
                #comment.author_email = ""
 | 
			
		||||
                #comment.creation_date
 | 
			
		||||
 | 
			
		||||
                #comment.creation_date = datetime.fromtimestamp(reply.creation_date)
 | 
			
		||||
 | 
			
		||||
                comment.creation_date = datetime.fromtimestamp(reply.creation_date)
 | 
			
		||||
                comment.modification_date = datetime.fromtimestamp(reply.modification_date)
 | 
			
		||||
 | 
			
		||||
                comment.reply_to = in_reply_to
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1,3 +1,6 @@
 | 
			
		||||
from datetime import datetime
 | 
			
		||||
from DateTime import DateTime
 | 
			
		||||
 | 
			
		||||
import unittest
 | 
			
		||||
 | 
			
		||||
from zope.annotation.interfaces import IAnnotations
 | 
			
		||||
@ -40,6 +43,8 @@ class MigrationTest(PloneTestCase):
 | 
			
		||||
        #reply = talkback.objectValues()[0]
 | 
			
		||||
        reply = talkback.getReplies()[0]
 | 
			
		||||
        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.EditableBody(), 'My Text')
 | 
			
		||||
        self.failUnless('Jim' in reply.listCreators())
 | 
			
		||||
@ -62,6 +67,8 @@ class MigrationTest(PloneTestCase):
 | 
			
		||||
        self.assertEquals(comment1.Title(), 'My Title')
 | 
			
		||||
        self.assertEquals(comment1.text, 'My Text')
 | 
			
		||||
        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(
 | 
			
		||||
            [{'comment': comment1,     'depth': 0, 'id': long(comment1.id)},]
 | 
			
		||||
            , list(conversation.getThreads()))
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user