Compare commits
5 Commits
c5f17dc5e8
...
a2a466199c
Author | SHA1 | Date | |
---|---|---|---|
|
a2a466199c | ||
|
ee2d81d9fd | ||
|
9d0cc0425d | ||
|
c73a50d1d8 | ||
|
aa38be3ac2 |
@ -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)
|
||||||
--------------------
|
--------------------
|
||||||
|
|
||||||
|
@ -1 +0,0 @@
|
|||||||
Set timezones for creation and modification dates of comments [instification]
|
|
@ -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)
|
||||||
|
@ -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):
|
||||||
|
3
setup.py
3
setup.py
@ -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",
|
||||||
|
Loading…
Reference in New Issue
Block a user