summaryrefslogtreecommitdiff
path: root/calendar-cli.py
diff options
context:
space:
mode:
authorTobias Brox <tobias@redpill-linpro.com>2018-12-17 10:56:55 +0100
committerTobias Brox <tobias@redpill-linpro.com>2018-12-17 10:56:55 +0100
commitf713dfd5b75faec29519b0601f05a0513a86340c (patch)
tree492356b069f094f71ae06407653cca6979f9ab46 /calendar-cli.py
parent3a7827e0a08427b680b9eb5d0bf4795b5240065f (diff)
downloadcalendar-cli-f713dfd5b75faec29519b0601f05a0513a86340c.zip
more fixing, ref https://github.com/tobixen/calendar-cli/issues/45
Diffstat (limited to 'calendar-cli.py')
-rwxr-xr-xcalendar-cli.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/calendar-cli.py b/calendar-cli.py
index 63c1cc6..d1843fa 100755
--- a/calendar-cli.py
+++ b/calendar-cli.py
@@ -488,17 +488,20 @@ def calendar_agenda(caldav_conn, args):
event[timeattr] = event[timeattr].strftime(args.timestamp_format)
else:
event[timeattr] = '-'
- for textattr in ('description', 'location'):
+ for textattr in vcal_txt_one:
if hasattr(event['instance'], textattr):
event[textattr] = getattr(event['instance'], textattr).value
+ else:
+ event[textattr] = '-'
for summary_attr in ('summary', 'location', 'description'):
if hasattr(event['instance'], summary_attr):
event['summary'] = getattr(event['instance'], summary_attr).value
break
event['uid'] = event['instance'].uid.value if hasattr(event['instance'], 'uid') else '<no uid>'
## TODO: this will probably break and is probably moot on python3?
- if isinstance(event['summary'], unicode):
- event['summary'] = event['summary'].encode('utf-8')
+ for attr in vcal_txt_one + ['summary']:
+ if isinstance(event['summary'], unicode):
+ event['summary'] = event['summary'].encode('utf-8')
print(args.event_template.format(**event))
def todo_select(caldav_conn, args):