mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-06-15 17:25:26 -04:00
Fix Python 3.11 compatibility in calendar .ics export
calendar_routes.py used a backslash inside an f-string expression, valid only on Python 3.12+. Hoist the newline-escaping out of the f-string so the app imports on Python 3.11, as the README states. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -902,7 +902,11 @@ def setup_calendar_routes() -> APIRouter:
|
||||
lines.append(f"DTSTART:{ev.dtstart.strftime('%Y%m%dT%H%M%S')}")
|
||||
lines.append(f"DTEND:{ev.dtend.strftime('%Y%m%dT%H%M%S')}")
|
||||
if ev.description:
|
||||
lines.append(f"DESCRIPTION:{ev.description.replace(chr(10), '\\n')}")
|
||||
# Escape newlines to the literal \n the iCalendar spec wants.
|
||||
# Kept out of the f-string expression so this stays valid on
|
||||
# Python 3.11 (backslashes in f-string expressions need 3.12+).
|
||||
_desc = ev.description.replace(chr(10), "\\n")
|
||||
lines.append(f"DESCRIPTION:{_desc}")
|
||||
if ev.location:
|
||||
lines.append(f"LOCATION:{ev.location}")
|
||||
if ev.rrule:
|
||||
|
||||
Reference in New Issue
Block a user