From c1e6b67f20f366d7d676f322289d859f45313433 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Fri, 23 Aug 2024 19:01:10 +0200 Subject: [PATCH] =?UTF-8?q?Am=C3=A9liore=20page=20affichage=20ScoValueErro?= =?UTF-8?q?r?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/scodoc/sco_exceptions.py | 6 ++++-- app/templates/sco_value_error.j2 | 14 ++++++++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/app/scodoc/sco_exceptions.py b/app/scodoc/sco_exceptions.py index 741ad9fdb..a70578838 100644 --- a/app/scodoc/sco_exceptions.py +++ b/app/scodoc/sco_exceptions.py @@ -52,10 +52,12 @@ class ScoValueError(ScoException): # mal nommée: super classe de toutes les exceptions avec page # d'erreur gentille. - def __init__(self, msg, dest_url=None, safe=False): + def __init__(self, msg, dest_url=None, dest_label=None, safe=False): super().__init__(msg) + # champs utilisés par template sco_value_error.j2 self.dest_url = dest_url - self.safe = safe # utilisé par template sco_value_error.j2 + self.dest_label = dest_label + self.safe = safe class ScoPermissionDenied(ScoValueError): diff --git a/app/templates/sco_value_error.j2 b/app/templates/sco_value_error.j2 index 2a488c933..15b3fdeeb 100644 --- a/app/templates/sco_value_error.j2 +++ b/app/templates/sco_value_error.j2 @@ -11,15 +11,21 @@ {{ exc }} {% endif %} +{% if exc.dest_url is not string or exc.dest_url|length > 0 %}
- {% if g.scodoc_dept %} - continuer - {% elif exc.dest_url %} - continuer + {% if exc.dest_url %} + + {{exc.dest_label or 'continuer'}} + + {% elif g.scodoc_dept %} + retour page département {% else %} retour page d'accueil {% endif %}
+{% endif %}

Si le problème persiste, merci de contacter le support ScoDoc via