Use local timezone when setting dates
This commit is contained in:
parent
45ef9a51c4
commit
fd1cfa8cad
@ -11,6 +11,7 @@ from plone.app.discussion.interfaces import IComment
|
|||||||
from plone.app.discussion.interfaces import IConversation
|
from plone.app.discussion.interfaces import IConversation
|
||||||
from plone.app.discussion.interfaces import IDiscussionSettings
|
from plone.app.discussion.interfaces import IDiscussionSettings
|
||||||
from plone.app.discussion.interfaces import IReplies
|
from plone.app.discussion.interfaces import IReplies
|
||||||
|
from plone.app.event.base import localized_now
|
||||||
from plone.app.layout.viewlets.common import ViewletBase
|
from plone.app.layout.viewlets.common import ViewletBase
|
||||||
from plone.base.utils import safe_text
|
from plone.base.utils import safe_text
|
||||||
from plone.registry.interfaces import IRegistry
|
from plone.registry.interfaces import IRegistry
|
||||||
@ -193,8 +194,8 @@ class CommentForm(extensible.ExtensibleForm, form.Form):
|
|||||||
setattr(comment, attribute, data[attribute])
|
setattr(comment, attribute, data[attribute])
|
||||||
|
|
||||||
# Set dates
|
# Set dates
|
||||||
comment.creation_date = datetime.now(timezone.utc)
|
comment.creation_date = localized_now()
|
||||||
comment.modification_date = datetime.now(timezone.utc)
|
comment.modification_date = localized_now()
|
||||||
|
|
||||||
# Get author name and email
|
# Get author name and email
|
||||||
comment.author_name, comment.author_email = self.get_author(data)
|
comment.author_name, comment.author_email = self.get_author(data)
|
||||||
|
@ -21,6 +21,7 @@ from plone.app.discussion.events import ReplyRemovedEvent
|
|||||||
from plone.app.discussion.interfaces import IComment
|
from plone.app.discussion.interfaces import IComment
|
||||||
from plone.app.discussion.interfaces import IConversation
|
from plone.app.discussion.interfaces import IConversation
|
||||||
from plone.app.discussion.interfaces import IDiscussionSettings
|
from plone.app.discussion.interfaces import IDiscussionSettings
|
||||||
|
from plone.app.event.base import localized_now
|
||||||
from plone.base.interfaces.controlpanel import IMailSchema
|
from plone.base.interfaces.controlpanel import IMailSchema
|
||||||
from plone.base.utils import safe_text
|
from plone.base.utils import safe_text
|
||||||
from plone.registry.interfaces import IRegistry
|
from plone.registry.interfaces import IRegistry
|
||||||
@ -120,7 +121,7 @@ class Comment(
|
|||||||
# IConversation.addComment().
|
# IConversation.addComment().
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.creation_date = self.modification_date = datetime.now(timezone.utc)
|
self.creation_date = self.modification_date = localized_now()
|
||||||
self.mime_type = "text/plain"
|
self.mime_type = "text/plain"
|
||||||
|
|
||||||
user = getSecurityManager().getUser()
|
user = getSecurityManager().getUser()
|
||||||
|
Loading…
Reference in New Issue
Block a user