parent
126a31c82a
commit
5cd43acb3c
@ -5,3 +5,9 @@ Fork of [VObject](https://github.com/eventable/vobject).
|
|||||||
Radicale VObject is licensed under the [Apache 2.0 license](http://www.apache.org/licenses/LICENSE-2.0).
|
Radicale VObject is licensed under the [Apache 2.0 license](http://www.apache.org/licenses/LICENSE-2.0).
|
||||||
|
|
||||||
Upstream git commit: [c4ae08b767](https://github.com/eventable/vobject/commit/c4ae08b7678bfdeec3c6b2dcbf74d383fd27ed14)
|
Upstream git commit: [c4ae08b767](https://github.com/eventable/vobject/commit/c4ae08b7678bfdeec3c6b2dcbf74d383fd27ed14)
|
||||||
|
|
||||||
|
Applied PRs:
|
||||||
|
|
||||||
|
* [RRULE: Fix VTODO without DTSTART (Fixes: #104)](https://github.com/eventable/vobject/pull/116) ([25379b7065](https://github.com/eventable/vobject/pull/116/commits/25379b7065c5503f44c2a019008a01fa0e9e6b7b))
|
||||||
|
* [RRULE: Fix floating UNTIL with dateutil > 2.6.1](https://github.com/eventable/vobject/pull/115) ([0ec6ad3f9e](https://github.com/eventable/vobject/pull/115/commits/0ec6ad3f9ea51179abd7816fa137394feac2ea58))
|
||||||
|
* [ignore escaped semi-colons in UNTIL value](https://github.com/eventable/vobject/pull/114) ([e07b94aa11](https://github.com/eventable/vobject/pull/114/commits/e07b94aa113cc709edde4e8e47053d6f778449ab))
|
@ -414,18 +414,6 @@ class RecurringComponent(Component):
|
|||||||
if addfunc is None:
|
if addfunc is None:
|
||||||
addfunc = getattr(rruleset, name)
|
addfunc = getattr(rruleset, name)
|
||||||
|
|
||||||
dtstart = self.dtstart.value
|
|
||||||
|
|
||||||
if name in DATENAMES:
|
|
||||||
if type(line.value[0]) == datetime.datetime:
|
|
||||||
list(map(addfunc, line.value))
|
|
||||||
elif type(line.value[0]) == datetime.date:
|
|
||||||
for dt in line.value:
|
|
||||||
addfunc(datetime.datetime(dt.year, dt.month, dt.day))
|
|
||||||
else:
|
|
||||||
# ignore RDATEs with PERIOD values for now
|
|
||||||
pass
|
|
||||||
elif name in RULENAMES:
|
|
||||||
try:
|
try:
|
||||||
dtstart = self.dtstart.value
|
dtstart = self.dtstart.value
|
||||||
except (AttributeError, KeyError):
|
except (AttributeError, KeyError):
|
||||||
@ -442,15 +430,32 @@ class RecurringComponent(Component):
|
|||||||
logging.error('failed to find DUE at all.')
|
logging.error('failed to find DUE at all.')
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
if name in DATENAMES:
|
||||||
|
if type(line.value[0]) == datetime.datetime:
|
||||||
|
list(map(addfunc, line.value))
|
||||||
|
elif type(line.value[0]) == datetime.date:
|
||||||
|
for dt in line.value:
|
||||||
|
addfunc(datetime.datetime(dt.year, dt.month, dt.day))
|
||||||
|
else:
|
||||||
|
# ignore RDATEs with PERIOD values for now
|
||||||
|
pass
|
||||||
|
elif name in RULENAMES:
|
||||||
# a Ruby iCalendar library escapes semi-colons in rrules,
|
# a Ruby iCalendar library escapes semi-colons in rrules,
|
||||||
# so also remove any backslashes
|
# so also remove any backslashes
|
||||||
value = line.value.replace('\\', '')
|
value = line.value.replace('\\', '')
|
||||||
rule = rrule.rrulestr(
|
|
||||||
value, dtstart=dtstart,
|
|
||||||
# If dtstart has no time zone, `until`
|
# If dtstart has no time zone, `until`
|
||||||
# shouldn't get one, either:
|
# shouldn't get one, either:
|
||||||
ignoretz=isinstance(dtstart, datetime.date))
|
ignoretz = (not isinstance(dtstart, datetime.datetime) or
|
||||||
until = rule._until
|
dtstart.tzinfo is None)
|
||||||
|
try:
|
||||||
|
until = rrule.rrulestr(value, ignoretz=ignoretz)._until
|
||||||
|
except ValueError:
|
||||||
|
# WORKAROUND: dateutil<=2.7.2 doesn't set the time zone
|
||||||
|
# of dtstart
|
||||||
|
if ignoretz:
|
||||||
|
raise
|
||||||
|
utc_now = datetime.datetime.now(datetime.timezone.utc)
|
||||||
|
until = rrule.rrulestr(value, dtstart=utc_now)._until
|
||||||
|
|
||||||
if until is not None and isinstance(dtstart,
|
if until is not None and isinstance(dtstart,
|
||||||
datetime.datetime) and \
|
datetime.datetime) and \
|
||||||
@ -458,7 +463,7 @@ class RecurringComponent(Component):
|
|||||||
# dateutil converts the UNTIL date to a datetime,
|
# dateutil converts the UNTIL date to a datetime,
|
||||||
# check to see if the UNTIL parameter value was a date
|
# check to see if the UNTIL parameter value was a date
|
||||||
vals = dict(pair.split('=') for pair in
|
vals = dict(pair.split('=') for pair in
|
||||||
line.value.upper().split(';'))
|
value.upper().split(';'))
|
||||||
if len(vals.get('UNTIL', '')) == 8:
|
if len(vals.get('UNTIL', '')) == 8:
|
||||||
until = datetime.datetime.combine(until.date(),
|
until = datetime.datetime.combine(until.date(),
|
||||||
dtstart.time())
|
dtstart.time())
|
||||||
@ -488,6 +493,11 @@ class RecurringComponent(Component):
|
|||||||
if dtstart.tzinfo is None:
|
if dtstart.tzinfo is None:
|
||||||
until = until.replace(tzinfo=None)
|
until = until.replace(tzinfo=None)
|
||||||
|
|
||||||
|
value_without_until = ';'.join(
|
||||||
|
pair for pair in value.split(';')
|
||||||
|
if pair.split('=')[0].upper() != 'UNTIL')
|
||||||
|
rule = rrule.rrulestr(value_without_until,
|
||||||
|
dtstart=dtstart, ignoretz=ignoretz)
|
||||||
rule._until = until
|
rule._until = until
|
||||||
|
|
||||||
# add the rrule or exrule to the rruleset
|
# add the rrule or exrule to the rruleset
|
||||||
|
2
setup.py
2
setup.py
@ -66,7 +66,7 @@ setup(
|
|||||||
packages=["radicale", "radicale_vobject"],
|
packages=["radicale", "radicale_vobject"],
|
||||||
package_data={"radicale": WEB_FILES},
|
package_data={"radicale": WEB_FILES},
|
||||||
entry_points={"console_scripts": ["radicale = radicale.__main__:run"]},
|
entry_points={"console_scripts": ["radicale = radicale.__main__:run"]},
|
||||||
install_requires=["python-dateutil==2.6.1"],
|
install_requires=["python-dateutil>=2.7.2"],
|
||||||
setup_requires=pytest_runner,
|
setup_requires=pytest_runner,
|
||||||
tests_require=tests_require,
|
tests_require=tests_require,
|
||||||
extras_require={
|
extras_require={
|
||||||
|
Loading…
Reference in New Issue
Block a user