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>
This commit is contained in:
parent
d64ceba2cc
commit
037676f7cc
1 changed files with 16 additions and 16 deletions
|
@ -41,21 +41,21 @@ def extract_field(cal: vobject.icalendar.VCalendar2_0, name: str) -> str:
|
||||||
name -- The field name.
|
name -- The field name.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
match name.strip():
|
name = name.strip()
|
||||||
case 'attendees':
|
if name == 'attendees':
|
||||||
attendees = []
|
attendees = []
|
||||||
for attendee in cal.vevent.attendee_list:
|
for attendee in cal.vevent.attendee_list:
|
||||||
attendees.append(remove_mailto(attendee.valueRepr()).strip())
|
attendees.append(remove_mailto(attendee.valueRepr()).strip())
|
||||||
return ', '.join(attendees)
|
return ', '.join(attendees)
|
||||||
case 'description':
|
elif name == 'description':
|
||||||
return cal.vevent.description.valueRepr().strip()
|
return cal.vevent.description.valueRepr().strip()
|
||||||
case 'dtstart':
|
elif name == 'dtstart':
|
||||||
return str(cal.vevent.dtstart.valueRepr()).strip()
|
return str(cal.vevent.dtstart.valueRepr()).strip()
|
||||||
case 'organizer':
|
elif name == 'organizer':
|
||||||
return remove_mailto(cal.vevent.organizer.valueRepr()).strip()
|
return remove_mailto(cal.vevent.organizer.valueRepr()).strip()
|
||||||
case 'summary':
|
elif name == 'summary':
|
||||||
return cal.vevent.summary.valueRepr().strip()
|
return cal.vevent.summary.valueRepr().strip()
|
||||||
case _:
|
else:
|
||||||
return ''
|
return ''
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
return ''
|
return ''
|
||||||
|
|
Loading…
Reference in a new issue