diff options
-rwxr-xr-x | calendar-cli.py | 6 | ||||
-rwxr-xr-x | tests/script_test.sh | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/calendar-cli.py b/calendar-cli.py index 77e33c2..27a037d 100755 --- a/calendar-cli.py +++ b/calendar-cli.py @@ -35,13 +35,13 @@ import sys import re import urllib3 from getpass import getpass +from caldav.lib.python_utilities import to_normal_str ## ref https://github.com/tobixen/calendar-cli/issues/33, python3-compatibility try: raw_input except NameError: raw_input = input - sys.stderr.write("here be dragons - calendar-cli is not properly tested for python3. See https://github.com/tobixen/calendar-cli/issues/33") try: unicode @@ -526,7 +526,7 @@ def calendar_agenda(caldav_conn, args): ## TODO: this will probably break and is probably moot on python3? for attr in vcal_txt_one + ['summary']: if isinstance(event[attr], unicode): - event[attr] = event[attr].encode('utf-8') + event[attr] = to_normal_str(event[attr]) print(args.event_template.format(**event)) def todo_select(caldav_conn, args): @@ -670,7 +670,7 @@ def todo_list(caldav_conn, args): t['uid'] = task.instance.vtodo.uid.value ## TODO: this will probably break and is probably moot on python3? if hasattr(t['summary'], 'encode') and isinstance(t['summary'], unicode): - t['summary'] = t['summary'].encode('utf-8') + t['summary'] = to_normal_str(t['summary']) print(args.todo_template.format(**t)) def todo_complete(caldav_conn, args): diff --git a/tests/script_test.sh b/tests/script_test.sh index a32bc64..3a3f91a 100755 --- a/tests/script_test.sh +++ b/tests/script_test.sh @@ -25,7 +25,7 @@ calendar_cli() { ## CLEANUP from earlier failed test runs -for uid in $($calendar_cli calendar agenda --from-time=2010-10-10 --agenda-days=1 --event-template='{uid}') ; do calendar_cli calendar delete --event-uid=$uid ; done +for uid in $($calendar_cli calendar agenda --from-time=2010-10-10 --agenda-days=4 --event-template='{uid}') ; do calendar_cli calendar delete --event-uid=$uid ; done calendar_cli todo --categories scripttest delete ## TESTING |