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

RRULE: Fix VTODO without DTSTART #116

Merged
merged 1 commit into from
Jul 8, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 15 additions & 17 deletions vobject/icalendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,21 @@ def getrruleset(self, addRDate=False):
if addfunc is None:
addfunc = getattr(rruleset, name)

dtstart = self.dtstart.value
try:
dtstart = self.dtstart.value
except (AttributeError, KeyError):
# Special for VTODO - try DUE property instead
try:
if self.name == "VTODO":
dtstart = self.due.value
else:
# if there's no dtstart, just return None
logging.error('failed to get dtstart with VTODO')
return None
except (AttributeError, KeyError):
# if there's no due, just return None
logging.error('failed to find DUE at all.')
return None

if name in DATENAMES:
if type(line.value[0]) == datetime.datetime:
Expand All @@ -426,22 +440,6 @@ def getrruleset(self, addRDate=False):
# ignore RDATEs with PERIOD values for now
pass
elif name in RULENAMES:
try:
dtstart = self.dtstart.value
except (AttributeError, KeyError):
# Special for VTODO - try DUE property instead
try:
if self.name == "VTODO":
dtstart = self.due.value
else:
# if there's no dtstart, just return None
logging.error('failed to get dtstart with VTODO')
return None
except (AttributeError, KeyError):
# if there's no due, just return None
logging.error('failed to find DUE at all.')
return None

# a Ruby iCalendar library escapes semi-colons in rrules,
# so also remove any backslashes
value = line.value.replace('\\', '')
Expand Down