Basing event equality on uid
vinraspa opened this issue · comments
Hi,
Short question:
currently, event equality is based on comparison of all fields but uid
:
return (self.name == other.name
and self.begin == other.begin
and self.end == other.end
and self.duration == other.duration
and self.description == other.description
and self.created == other.created
and self.last_modified == other.last_modified
and self.location == other.location
and self.url == other.url
and self.transparent == other.transparent
and self.alarms == other.alarms
and self.attendees == other.attendees
and self.categories == other.categories
and self.status == other.status
and self.organizer == other.organizer)
uid
being unique, does it make sense testing equality of all fields and living uid
aside?
Is it possible, at least, to give the user the choice?
It would also be less time-consuming.
More details about my request:
I am working with ics.py to deal with iCalendar files from ADEsoft (software managing resources et agendas in universities).
When the ics files are downloaded, the DTSTAMP
field of all the events in this calendar is set to the download time.
Multiple iCalendar files may contain the same event. Problem, if they have been downloaded at different times (even 1 second apart), the equality test fails (and so does the set intersection) while the events share the same uid
.
Currently, the workaround is to manually set every created
attribute to some constant value when the cal is imported.
Hi !
This will be the case in the next version ! (see https://github.com/ics-py/ics-py/blob/main/doc/event-cmp.rst#equality)
(I'm closing as this is already fixed, but feel free to continue the discussion over here)