Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EXDATE info type in prop.Event is inconsistent (can be list of vDDDLists or just one object instance) #224

Open
mlorant opened this issue May 4, 2017 · 3 comments

Comments

@mlorant
Copy link

mlorant commented May 4, 2017

I think a print trace of the problem is worth 1,000 words:

# Case 1
BEGIN:VEVENT
SUMMARY:Recurrence with 2 deleted days
DTSTART;TZID=Europe/Paris:20170502T100000
DTEND;TZID=Europe/Paris:20170502T110000
DTSTAMP:20170504T085344Z
UID:uid-0
EXDATE;TZID=Europe/Paris:20170523T100000
EXDATE;TZID=Europe/Paris:20170516T100000
RRULE:FREQ=WEEKLY;BYDAY=TU
STATUS:CONFIRMED
END:VEVENT

[<icalendar.prop.vDDDLists object at 0x7fe2ed87ef28>, <icalendar.prop.vDDDLists object at 0x7fe2ed87ebe0>]
type(event['EXDATE']) =  <class 'list'>

# Case 2
BEGIN:VEVENT
SUMMARY:Recurrence with one deleted day 
DTSTART;TZID=Europe/Paris:20170502T023000
DTEND;TZID=Europe/Paris:20170502T033000
DTSTAMP:20170504T085344Z
UID:uid-1
EXDATE;TZID=Europe/Paris:20170509T023000
RRULE:FREQ=WEEKLY;BYDAY=TU
STATUS:CONFIRMED
END:VEVENT

<icalendar.prop.vDDDLists object at 0x7fe2ed4234e0>
type(event['EXDATE']) =  <class 'icalendar.prop.vDDDLists'>

As you can see, we can't rely on the type of EXDATE, since it can either be a Python list of vDDDLists or just one vDDDLists instance. In my own application, I had to do this workaround to have a generic way of handling:

exdates = event['EXDATE']
if isinstance(event['EXDATE'], icalendar.prop.vDDDLists):
     exdates = [exdates]

Either vDDDLists objects should be merged in a single one (best abstraction API I think), either EXDATE should always return a list of lists. But not both behaviour...

@mlorant mlorant changed the title EXDATE info type in prop.Event is inconsistent return : can be either list of vDDDLists EXDATE info type in prop.Event is inconsistent : can be either list of vDDDLists May 4, 2017
@mlorant mlorant changed the title EXDATE info type in prop.Event is inconsistent : can be either list of vDDDLists EXDATE info type in prop.Event is inconsistent (can be list of vDDDLists or just one vDDDLists instance) May 4, 2017
@mlorant mlorant changed the title EXDATE info type in prop.Event is inconsistent (can be list of vDDDLists or just one vDDDLists instance) EXDATE info type in prop.Event is inconsistent (can be list of vDDDLists or just one object instance) May 4, 2017
@stlaz
Copy link
Collaborator

stlaz commented May 18, 2017

This will hopefully be resolved with #192 which should come next major release.

@4xel
Copy link

4xel commented Mar 27, 2018

+1

@niccokunzmann
Copy link
Member

See also: #662

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants