Generate iCalendar for Thunderbird, etc.
This commit is contained in:
parent
97933cfe8f
commit
77ea6a8afa
3 changed files with 348 additions and 11 deletions
10
web_view.py
10
web_view.py
|
|
@ -423,6 +423,16 @@ def trip_list() -> werkzeug.Response:
|
|||
return flask.redirect(flask.url_for("trip_future_list"))
|
||||
|
||||
|
||||
@app.route("/trip/ical")
|
||||
def trip_ical() -> werkzeug.Response:
|
||||
"""Return trip components in iCal format."""
|
||||
trips = get_trip_list()
|
||||
ical_data = agenda.trip.build_trip_ical(trips)
|
||||
response = flask.Response(ical_data, mimetype="text/calendar")
|
||||
response.headers["Content-Disposition"] = "inline; filename=trips.ics"
|
||||
return response
|
||||
|
||||
|
||||
def calc_total_distance(trips: list[Trip]) -> float:
|
||||
"""Total distance for trips."""
|
||||
total = 0.0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue