Modify ↓
#14122 closed enhancement (fixed)
WeekPlanPlugin: ical recurring events support
Reported by: | anonymous | Owned by: | lucid |
---|---|---|---|
Priority: | normal | Component: | WeekPlanPlugin |
Severity: | normal | Keywords: | ical |
Cc: | Trac Release: |
Description
#14110 added ical support, but not for recurring events.
pypi:recurring-ical-events could be used to support recurring events.
Attachments (0)
Change History (4)
comment:1 Changed 3 years ago by
comment:2 Changed 2 years ago by
The first library above seems to work:
-
setup.py
diff -r 86ee9613a30f -r cf7c273c3fcb setup.py
a b 19 19 'weekplan.ical_provider = weekplan.ical_provider', 20 20 ] 21 21 }, 22 install_requires=['icalendar' ],22 install_requires=['icalendar', 'recurring-ical-events'], 23 23 ) -
weekplan/ical_provider.py
diff -r 86ee9613a30f -r cf7c273c3fcb weekplan/ical_provider.py
a b 2 2 import datetime 3 3 4 4 from icalendar import Calendar 5 import recurring_ical_events 5 6 6 7 from trac.config import ConfigSection 7 8 from trac.core import Component, implements … … 35 36 f = urllib.urlopen(ical_url) 36 37 content = f.read() 37 38 calendar = Calendar.from_ical(content) 38 return calendar.walk() 39 entries = calendar.walk() 40 if range is not None: 41 r0, r1 = range 42 recurring_events = recurring_ical_events.of(calendar).between(r0, r1) 43 entries.extend(recurring_events) 44 return entries 39 45 40 46 def is_relevant(entry): 41 47 if entry.name != "VEVENT":
comment:4 Changed 2 years ago by
Apparently this library already returns also non-recurring events, so those now appear twice by mistake. The calendar.walk()
should be skipped when this library is used.
Note: See
TracTickets for help on using
tickets.
pypi:icalendar also links another library pypi:icalevents