Compare commits

..

5 Commits

Author SHA1 Message Date
Maurits van Rees
a2a466199c
Back to development: 4.0.1
[ci skip]
2022-11-11 00:30:32 +01:00
Maurits van Rees
ee2d81d9fd
Preparing release 4.0.0
[ci skip]
2022-11-11 00:23:30 +01:00
Maurits van Rees
9d0cc0425d
Added Python 3.11 to classifiers in setup.py.
[ci skip]
2022-11-11 00:23:08 +01:00
David Glick
c73a50d1d8
Merge pull request #204 from plone/set_timezone
Set timezone for creation and modification dates of comments
2022-10-24 15:38:11 -07:00
Jon Pentland
aa38be3ac2 Use correct date when indexing. Update comment indexes to use America/Los_Angeles 2022-10-24 23:43:35 +02:00
5 changed files with 20 additions and 11 deletions

View File

@ -8,6 +8,15 @@ Changelog
.. towncrier release notes start .. 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) 4.0.0b3 (2022-10-11)
-------------------- --------------------

View File

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

View File

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

View File

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

View File

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