pigeonflight
(David Bain (Will Theme Plone Sites))
May 24, 2016, 10:47pm
1
Just wondering if anyone has worked with querying date fields using souper.plone. I'm looking for an example.
pigeonflight
(David Bain (Will Theme Plone Sites))
May 24, 2016, 10:55pm
2
It looks like date fields are not managed directly by repoze.catalog (the technology that powers souper.plone).
I think this is a good example of how to handle this:
# we can't store datetimes directly in the catalog because they
# can't be compared with anything
timetime = time.mktime(date.timetuple())
# creation "minute" actually to prevent too-granular storage
date = int(str(int(timetime))[:-2])
return date
def get_modified_date(object, default):
return _get_date(object, default, 'modified')
def get_created_date(object, default):
return _get_date(object, default, 'created')