You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I encountered an issue with special events with optional start and end dates.
For that I created a behavior which derives from plone.app.event.dx.behaviors.IEventBasic, which itself implements plone.app.event.dx.interfaces.IDXEvent, which itself derives from plone.event.interfaces.IEvent which is used as search criteria in plone.app.event.base.get_events.
When using get_events and sorting on start like so:
Traceback (innermost last):
Module ZPublisher.Publish, line 138, in publish
Module ZPublisher.mapply, line 77, in mapply
Module ZPublisher.Publish, line 48, in call_object
Module bda.aaf.services_nextroom.calendarexport, line 66, in __call__
Module bda.aaf.services_nextroom.calendarexport, line 56, in get_events
Module plone.app.event.base, line 163, in get_events
Module plone.app.event.base, line 291, in expand_events
TypeError: can't compare datetime.datetime to NoneType
Traceback (most recent call last):
File "/home/plone/.buildout/shared-eggs/Zope2-2.13.29-py2.7.egg/ZPublisher/Publish.py", line 138, in publish
request, bind=1)
File "/home/plone/.buildout/shared-eggs/Zope2-2.13.29-py2.7.egg/ZPublisher/mapply.py", line 77, in mapply
if debug is not None: return debug(object,args,context)
File "/home/plone/.buildout/shared-eggs/Zope2-2.13.29-py2.7.egg/ZPublisher/Publish.py", line 48, in call_object
result=apply(object,args) # Type s<cr> to step into published object.
File "/plone/buildout/src-aaf/bda.aaf.services_nextroom/src/bda/aaf/services_nextroom/calendarexport.py", line 66, in __call__
for event in self.get_events():
File "/plone/buildout/src-aaf/bda.aaf.services_nextroom/src/bda/aaf/services_nextroom/calendarexport.py", line 56, in get_events
path=path
File "/home/plone/.buildout/shared-eggs/plone.app.event-3.2.4-py2.7.egg/plone/app/event/base.py", line 163, in get_events
sort_reverse)
File "/home/plone/.buildout/shared-eggs/plone.app.event-3.2.4-py2.7.egg/plone/app/event/base.py", line 291, in expand_events
exp_result.sort(key=lambda x: _get_compare_attr(x, sort))
TypeError: can't compare datetime.datetime to NoneType
I see the following options:
using a key function in sorted(iterable, *, key=None, reverse=False) to transform missing values into a ceiling date
Not using ceiling dates when indexing start/end but not index them at all. Events with missing start/end dates wont then show up in event results when limiting to a time range.
No change but just requiring valid start/end dates for events - otherwise they are no events by definition. To allow for optional start/end dates on content types would then require dynamic behaviors or the behavior not implementing IDXEvent but setting IDXEvent dynamicaly after modification when start/end are valid datetimes.
I encountered an issue with special events with optional start and end dates.
For that I created a behavior which derives from plone.app.event.dx.behaviors.IEventBasic, which itself implements plone.app.event.dx.interfaces.IDXEvent, which itself derives from plone.event.interfaces.IEvent which is used as search criteria in plone.app.event.base.get_events.
When using
get_events
and sorting onstart
like so:it breaks with:
I see the following options:
sorted(iterable, *, key=None, reverse=False)
to transform missing values into a ceiling dateAny opinions?
/cc @jensens @ale-rt @mauritsvanrees
The text was updated successfully, but these errors were encountered: