aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Grassel <jens@wegtam.com>2022-03-24 12:41:24 +0100
committerRobin Jarry <robin@jarry.cc>2022-03-24 15:30:42 +0100
commit037676f7ccdd1ec00a3328ee7062000d5b8aab51 (patch)
treebe681689279719fd54dfae51d8dab59aba2475e8
parentd64ceba2cc8d8d1624348a76c7e7a02e385e6d0a (diff)
downloadaerc-037676f7ccdd1ec00a3328ee7062000d5b8aab51.tar.gz
show-ics-details.py: fix error with python < 3.9
Change the pattern matching into a if/elif construct because pattern matching is not supported on python < 3.9. Signed-off-by: Jens Grassel <jens@wegtam.com> Acked-by: Robin Jarry <robin@jarry.cc>
-rwxr-xr-xfilters/show-ics-details.py32
1 files changed, 16 insertions, 16 deletions
diff --git a/filters/show-ics-details.py b/filters/show-ics-details.py
index bb3ad3d8..18b2b760 100755
--- a/filters/show-ics-details.py
+++ b/filters/show-ics-details.py
@@ -41,22 +41,22 @@ def extract_field(cal: vobject.icalendar.VCalendar2_0, name: str) -> str:
name -- The field name.
"""
try:
- match name.strip():
- case 'attendees':
- attendees = []
- for attendee in cal.vevent.attendee_list:
- attendees.append(remove_mailto(attendee.valueRepr()).strip())
- return ', '.join(attendees)
- case 'description':
- return cal.vevent.description.valueRepr().strip()
- case 'dtstart':
- return str(cal.vevent.dtstart.valueRepr()).strip()
- case 'organizer':
- return remove_mailto(cal.vevent.organizer.valueRepr()).strip()
- case 'summary':
- return cal.vevent.summary.valueRepr().strip()
- case _:
- return ''
+ name = name.strip()
+ if name == 'attendees':
+ attendees = []
+ for attendee in cal.vevent.attendee_list:
+ attendees.append(remove_mailto(attendee.valueRepr()).strip())
+ return ', '.join(attendees)
+ elif name == 'description':
+ return cal.vevent.description.valueRepr().strip()
+ elif name == 'dtstart':
+ return str(cal.vevent.dtstart.valueRepr()).strip()
+ elif name == 'organizer':
+ return remove_mailto(cal.vevent.organizer.valueRepr()).strip()
+ elif name == 'summary':
+ return cal.vevent.summary.valueRepr().strip()
+ else:
+ return ''
except AttributeError:
return ''