revert 27204: change import for discussion modification_date from datetime to DateTime.

svn path=/plone.app.discussion/trunk/; revision=27213
This commit is contained in:
Timo Stollenwerk 2009-05-30 06:08:44 +00:00
parent 4b6b0aeb02
commit 751ae5a06a
1 changed files with 23 additions and 23 deletions

View File

@ -1,6 +1,6 @@
"""The default comment class and factory. """The default comment class and factory.
""" """
from DateTime import DateTime from datetime import datetime
from zope.interface import implements from zope.interface import implements
from zope.component.factory import Factory from zope.component.factory import Factory
@ -16,73 +16,73 @@ from Products.CMFCore.utils import getToolByName
class Comment(DynamicType, Traversable, RoleManager, Owned, Explicit): class Comment(DynamicType, Traversable, RoleManager, Owned, Explicit):
"""A comment. """A comment.
This object attempts to be as lightweight as possible. We implement a This object attempts to be as lightweight as possible. We implement a
number of standard methods instead of subclassing, to have total control number of standard methods instead of subclassing, to have total control
over what goes into the object. over what goes into the object.
""" """
implements(IComment) implements(IComment)
meta_type = portal_type = 'Discussion Item' meta_type = portal_type = 'Discussion Item'
__parent__ = None __parent__ = None
comment_id = None # long comment_id = None # long
in_reply_to = None # long in_reply_to = None # long
title = u"" title = u""
mime_type = "text/plain" mime_type = "text/plain"
text = u"" text = u""
creator = None creator = None
creation_date = None creation_date = None
modification_date = None modification_date = None
author_username = None author_username = None
author_name = None author_name = None
author_email = None author_email = None
# Note: we want to use zope.component.createObject() to instantiate # Note: we want to use zope.component.createObject() to instantiate
# comments as far as possible. comment_id and __parent__ are set via # comments as far as possible. comment_id and __parent__ are set via
# IConversation.addComment(). # IConversation.addComment().
def __init__(self): def __init__(self):
self.creation_date = self.modification_date = DateTime() self.creation_date = self.modification_date = datetime.now()
@property @property
def __name__(self): def __name__(self):
return self.comment_id and unicode(self.comment_id) or None return self.comment_id and unicode(self.comment_id) or None
@property @property
def id(self): def id(self):
return self.comment_id and str(self.comment_id) or None return self.comment_id and str(self.comment_id) or None
def getId(self): def getId(self):
"""The id of the comment, as a string """The id of the comment, as a string
""" """
return self.id return self.id
def Title(self): def Title(self):
"""The title of the comment """The title of the comment
""" """
return self.title return self.title
def Creator(self): def Creator(self):
"""The name of the person who wrote the comment """The name of the person who wrote the comment
""" """
return self.creator return self.creator
# CMF's event handlers assume any IDynamicType has these :( # CMF's event handlers assume any IDynamicType has these :(
def opaqueItems(self): def opaqueItems(self):
return [] return []
def opaqueIds(self): def opaqueIds(self):
return [] return []
def opaqueValues(self): def opaqueValues(self):
return [] return []