Commit bccfbd86 authored by Bram Schoenmakers's avatar Bram Schoenmakers

Disable iCalendar support when a SyntaxError is caught.

The icalendar package does not support Python 3.2 throwing a
SyntaxError.
parent f2f47619
...@@ -60,11 +60,13 @@ For the supported options, please refer to the help text of 'ls' ...@@ -60,11 +60,13 @@ For the supported options, please refer to the help text of 'ls'
While specifying the sort order is supported (-s flag), like in 'ls', this is While specifying the sort order is supported (-s flag), like in 'ls', this is
not meaningful in the context of an iCalendar file. not meaningful in the context of an iCalendar file.
Note: be aware that this is not necessarily a read-only operation. This Note 1 : be aware that this is not necessarily a read-only operation. This
subcommand may add ical tags to the printed todo items containing a unique ID. subcommand may add ical tags to the printed todo items containing a unique ID.
Completed todo items may be archived. Completed todo items may be archived.
Note: topydo does not support reading iCal files, this is merely a dump. Note 2: topydo does not support reading iCal files, this is merely a dump.
Changes made with other iCalendar enabled applications will not be processed. Changes made with other iCalendar enabled applications will not be processed.
Suggested usage is to use the output as a read-only calendar. Suggested usage is to use the output as a read-only calendar.
Note 3: The ical subcommand only works for Python 2.7 and 3.3+.
""" """
...@@ -22,7 +22,10 @@ file according to RFC 2445. ...@@ -22,7 +22,10 @@ file according to RFC 2445.
try: try:
import icalendar as ical import icalendar as ical
ICAL_PRESENT = True ICAL_PRESENT = True
except ImportError: except (SyntaxError, ImportError):
# icalendar does not support Python 3.2 resulting in a SyntaxError. Since
# this is an optional dependency, dropping Python 3.2 support altogether is
# too much. Therefore just disable the iCalendar functionality
ICAL_PRESENT = False ICAL_PRESENT = False
from datetime import datetime, time from datetime import datetime, time
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment