From 1a0f734aafddf86756232ace6f36ba63fdb8f4e1 Mon Sep 17 00:00:00 2001
From: Thomas Schneider <thomas@fsmpi.rwth-aachen.de>
Date: Wed, 11 Sep 2024 22:32:46 +0200
Subject: [PATCH] instance, views: Specify type for ident parameter

This fixes SQLite, as the implicit conversion from String to UUID does not work
with that.
---
 schilder2000/instance.py | 4 ++--
 schilder2000/views.py    | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/schilder2000/instance.py b/schilder2000/instance.py
index d869e36..05139e8 100644
--- a/schilder2000/instance.py
+++ b/schilder2000/instance.py
@@ -18,13 +18,13 @@ bp = Blueprint(
 )
 
 
-@bp.route("/schild/<ident>.html")
+@bp.route("/schild/<uuid:ident>.html")
 def schild_html(ident):
     schild = db.get_or_404(Schild, ident)
     return bp.render_template(schild.template, schild=schild)
 
 
-@bp.route("/schild/<ident>.pdf")
+@bp.route("/schild/<uuid:ident>.pdf")
 def schild_pdf(ident):
     return render_pdf(url_for(".schild_html", ident=ident))
 
diff --git a/schilder2000/views.py b/schilder2000/views.py
index 3874f67..fa26e05 100644
--- a/schilder2000/views.py
+++ b/schilder2000/views.py
@@ -38,7 +38,7 @@ def _do_schild_form(schild):
     return form
 
 
-@bp.route("/schild/<ident>", methods=["GET", "POST"])
+@bp.route("/schild/<uuid:ident>", methods=["GET", "POST"])
 def schild(ident):
     schild = db.get_or_404(Schild, ident)
     form = _do_schild_form(schild)
@@ -52,7 +52,7 @@ def schild(ident):
     )
 
 
-@bp.route("/schild/<ident>/print", methods=["POST"])
+@bp.route("/schild/<uuid:ident>/print", methods=["POST"])
 async def print(ident):
     form = PrintForm(request.form)
     form.printer.choices = list(app.config["PRINTERS"])
-- 
GitLab