Modify

Opened 3 years ago

Closed 2 years ago

Last modified 2 years ago

#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 anonymous

pypi:icalendar also links another library pypi:icalevents

comment:2 Changed 2 years ago by anonymous

The first library above seems to work:

  • setup.py

    diff -r 86ee9613a30f -r cf7c273c3fcb setup.py
    a b  
    1919            'weekplan.ical_provider = weekplan.ical_provider',
    2020        ]
    2121    },
    22     install_requires=['icalendar'],
     22    install_requires=['icalendar', 'recurring-ical-events'],
    2323)
  • weekplan/ical_provider.py

    diff -r 86ee9613a30f -r cf7c273c3fcb weekplan/ical_provider.py
    a b  
    22import datetime
    33
    44from icalendar import Calendar
     5import recurring_ical_events
    56
    67from trac.config import ConfigSection
    78from trac.core import Component, implements
     
    3536            f = urllib.urlopen(ical_url)
    3637            content = f.read()
    3738            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
    3945
    4046        def is_relevant(entry):
    4147            if entry.name != "VEVENT":

comment:3 Changed 2 years ago by lucid

Resolution: fixed
Status: newclosed

In 18497:

WeekPlanPlugin: ical recurring events support
(fix #14122)

Fix AttributeError: 'datetime.date' object has no attribute 'date' (fix #14149)

Fix extras_require (see #14110)

comment:4 Changed 2 years ago by anonymous

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.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain lucid.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.