Is it possible to find (date time) today in restricted python?
I need to sort for future events in a themingfragment.
PS: Other suggestions are welcome (for example, can I get the items for /events/aggregator or similar
Is it possible to find (date time) today in restricted python?
I need to sort for future events in a themingfragment.
PS: Other suggestions are welcome (for example, can I get the items for /events/aggregator or similar
Pretty sure it works. Just import it and use it.
For everything else we keep adding to https://github.com/collective/collective.trustedimports.
Looks like you are right.
I have always used pythons data time to find today, but it looks like it can be found with (something like):
from DateTime import DateTime
today = DateTime()
And
def get_items(self):
from DateTime import DateTime
date_range = {
'query': (
DateTime(),
),
'range': 'min',
}
return self.context.portal_catalog(portal_type='Event', end=date_range)
PS: I changed to 'end' instead of 'start' since it makes more sense to list it until it is finished.