From 037676f7ccdd1ec00a3328ee7062000d5b8aab51 Mon Sep 17 00:00:00 2001 From: Jens Grassel Date: Thu, 24 Mar 2022 12:41:24 +0100 Subject: [PATCH] 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 Acked-by: Robin Jarry --- filters/show-ics-details.py | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/filters/show-ics-details.py b/filters/show-ics-details.py index bb3ad3d..18b2b76 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 ''