From ab92def1a6a6791a7bad0c5c9e685846d055ec1f Mon Sep 17 00:00:00 2001 From: Jon Pentland Date: Mon, 24 Oct 2022 21:10:12 +0100 Subject: [PATCH] Use plone.app.event.base.DT to convert datetime -> DateTime --- plone/app/discussion/catalog.py | 31 ++++--------------------------- 1 file changed, 4 insertions(+), 27 deletions(-) diff --git a/plone/app/discussion/catalog.py b/plone/app/discussion/catalog.py index bc7bdeb..59a83a6 100644 --- a/plone/app/discussion/catalog.py +++ b/plone/app/discussion/catalog.py @@ -6,6 +6,7 @@ Also provide event handlers to actually catalog the comments. from DateTime import DateTime from plone.app.discussion.interfaces import IComment from plone.app.discussion.interfaces import IConversation +from plone.app.event.base import DT from plone.base.utils import safe_text from plone.indexer import indexer from plone.uuid.interfaces import IUUID @@ -102,43 +103,19 @@ def in_response_to(object): @indexer(IComment) def effective(object): # the catalog index needs Zope DateTime instead of Python datetime - return DateTime( - object.creation_date.year, - object.creation_date.month, - object.creation_date.day, - object.creation_date.hour, - object.creation_date.minute, - object.creation_date.second, - object.creation_date.tzname(), - ) + return DT( object.creation_date ) @indexer(IComment) def created(object): # the catalog index needs Zope DateTime instead of Python datetime - return DateTime( - object.creation_date.year, - object.creation_date.month, - object.creation_date.day, - object.creation_date.hour, - object.creation_date.minute, - object.creation_date.second, - object.creation_date.tzname(), - ) + return DT(object.modification_date) @indexer(IComment) def modified(object): # the catalog index needs Zope DateTime instead of Python datetime - return DateTime( - object.modification_date.year, - object.modification_date.month, - object.modification_date.day, - object.modification_date.hour, - object.modification_date.minute, - object.modification_date.second, - object.modification_date.tzname(), - ) + return DT(object.modification_date) # Override the conversation indexers for comments