Use plone.app.event.base.DT to convert datetime -> DateTime
This commit is contained in:
parent
a069f49719
commit
ab92def1a6
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user