Compare commits

..

No commits in common. "a2a466199c598f948a02ac6e53fcf4a6b2d29899" and "c5f17dc5e86d8d90aafdf72a03e739a448745752" have entirely different histories.

5 changed files with 11 additions and 20 deletions

View File

@ -8,15 +8,6 @@ Changelog
.. towncrier release notes start
4.0.0 (2022-11-11)
------------------
Bug fixes:
- Set timezones for creation and modification dates of comments [instification] (#204)
4.0.0b3 (2022-10-11)
--------------------

1
news/204.bugfix Normal file
View File

@ -0,0 +1 @@
Set timezones for creation and modification dates of comments [instification]

View File

@ -109,7 +109,7 @@ def effective(object):
@indexer(IComment)
def created(object):
# the catalog index needs Zope DateTime instead of Python datetime
return DT(object.creation_date)
return DT(object.modification_date)
@indexer(IComment)

View File

@ -137,18 +137,18 @@ class CommentIndexersTest(unittest.TestCase):
# Set the portal timezone to something non-utc
reg_key = "plone.portal_timezone"
registry = getUtility(IRegistry)
registry[reg_key] = "America/Los_Angeles"
registry[reg_key] = "Europe/Berlin"
comment = createObject("plone.Comment")
comment.text = "Lorem ipsum dolor sit amet."
comment.creator = "jim"
comment.author_name = "Jim"
# Create date in PDT (ie daylight savings)
comment.creation_date = datetime(2006, 9, 17, 14, 18, 12).replace(tzinfo=tz.gettz("America/Los_Angeles"))
# Create date in CEST (ie not daylight savings = UTC+2)
comment.creation_date = datetime(2006, 9, 17, 14, 18, 12).replace(tzinfo=tz.gettz("Europe/Berlin"))
# Create date in PST (ie not daylight savings)
comment.modification_date = datetime(2008, 2, 12, 7, 32, 52).replace(tzinfo=tz.gettz("America/Los_Angeles"))
# Create date in CET (ie daylight savings = UTC+1)
comment.modification_date = datetime(2008, 3, 12, 7, 32, 52).replace(tzinfo=tz.gettz("Europe/Berlin"))
self.comment_id = conversation.addComment(comment)
self.comment = comment.__of__(conversation)
@ -182,15 +182,15 @@ class CommentIndexersTest(unittest.TestCase):
# Test if created, modified, effective etc. are set correctly
self.assertEqual(
catalog.created(self.comment)(),
DateTime(2006, 9, 17, 14, 18, 12, "America/Los_Angeles"),
DateTime(2006, 9, 17, 14, 18, 12, "GMT+2"),
)
self.assertEqual(
catalog.effective(self.comment)(),
DateTime(2006, 9, 17, 14, 18, 12, "America/Los_Angeles"),
DateTime(2006, 9, 17, 14, 18, 12, "GMT+2"),
)
self.assertEqual(
catalog.modified(self.comment)(),
DateTime(2008, 2, 12, 7, 32, 52, "America/Los_Angeles"),
DateTime(2008, 3, 12, 7, 32, 52, "GMT+1"),
)
def test_searchable_text(self):

View File

@ -2,7 +2,7 @@ from setuptools import find_packages
from setuptools import setup
version = "4.0.1.dev0"
version = "4.0.0b4.dev1"
install_requires = [
"setuptools",
@ -34,7 +34,6 @@ setup(
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
],
keywords="plone discussion",
author="Timo Stollenwerk - Plone Foundation",