forked from ScoDoc/ScoDoc
Update opolka/ScoDoc from ScoDoc/ScoDoc #2
@ -53,7 +53,9 @@ class CreateBugReport(FlaskForm):
|
|||||||
)
|
)
|
||||||
etab = StringField(label="Etablissement")
|
etab = StringField(label="Etablissement")
|
||||||
include_dump = BooleanField(
|
include_dump = BooleanField(
|
||||||
"Inclure une copie anonymisée de la base de données ? (ces données permettent aux développeur·euse·s de reproduire l'erreur rencontrée)",
|
"""Inclure une copie anonymisée de la base de données ?
|
||||||
|
Ces données faciliteront le traitement du problème et resteront strictement confidentielles.
|
||||||
|
""",
|
||||||
default=False,
|
default=False,
|
||||||
)
|
)
|
||||||
submit = SubmitField("Envoyer")
|
submit = SubmitField("Envoyer")
|
||||||
|
@ -36,18 +36,22 @@ Le principe est le suivant:
|
|||||||
informations fournies par l'utilisateur + quelques métadonnées.
|
informations fournies par l'utilisateur + quelques métadonnées.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import app.scodoc.sco_utils as scu, sco_version, requests
|
|
||||||
from flask import g
|
from flask import g
|
||||||
from flask_login import current_user
|
from flask_login import current_user
|
||||||
|
import requests
|
||||||
|
|
||||||
|
import app.scodoc.sco_utils as scu
|
||||||
|
import sco_version
|
||||||
|
|
||||||
from app import log
|
from app import log
|
||||||
from app.scodoc.sco_exceptions import ScoValueError
|
|
||||||
from app.scodoc.sco_dump_db import sco_dump_and_send_db
|
from app.scodoc.sco_dump_db import sco_dump_and_send_db
|
||||||
|
from app.scodoc.sco_exceptions import ScoValueError
|
||||||
|
|
||||||
|
|
||||||
def sco_bug_report(
|
def sco_bug_report(
|
||||||
title: str = "", message: str = "", etab: str = "", include_dump: bool = False
|
title: str = "", message: str = "", etab: str = "", include_dump: bool = False
|
||||||
) -> requests.Response:
|
) -> requests.Response:
|
||||||
|
"""Envoi d'un bug report (ticket)"""
|
||||||
dump_id = None
|
dump_id = None
|
||||||
|
|
||||||
if include_dump:
|
if include_dump:
|
||||||
@ -56,8 +60,9 @@ def sco_bug_report(
|
|||||||
try:
|
try:
|
||||||
dump_id = dump.json()["dump_id"]
|
dump_id = dump.json()["dump_id"]
|
||||||
except (requests.exceptions.JSONDecodeError, KeyError):
|
except (requests.exceptions.JSONDecodeError, KeyError):
|
||||||
dump_id = "inconnu"
|
dump_id = "inconnu (erreur)"
|
||||||
|
|
||||||
|
log(f"sco_bug_report: {scu.SCO_BUG_REPORT_URL} by {current_user.user_name}")
|
||||||
try:
|
try:
|
||||||
r = requests.post(
|
r = requests.post(
|
||||||
scu.SCO_BUG_REPORT_URL,
|
scu.SCO_BUG_REPORT_URL,
|
||||||
|
@ -297,7 +297,10 @@ div.effectif {
|
|||||||
rel="noopener noreferrer">Contact (Discord)</a>
|
rel="noopener noreferrer">Contact (Discord)</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a class="stdlink" href="sco_bug_report">Créer un ticket</a>
|
<a class="stdlink" href="sco_dump_and_send_db">Envoyer données</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a class="stdlink" href="sco_bug_report">Signaler une erreur ou suggérer une amélioration</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
@ -2571,7 +2571,7 @@ def sco_bug_report_form():
|
|||||||
|
|
||||||
form = CreateBugReport()
|
form = CreateBugReport()
|
||||||
if request.method == "POST" and form.cancel.data: # cancel button
|
if request.method == "POST" and form.cancel.data: # cancel button
|
||||||
return redirect(url_for("scodoc.index"))
|
return flask.redirect(url_for("scodoc.index"))
|
||||||
if form.validate_on_submit():
|
if form.validate_on_submit():
|
||||||
r = sco_bug_report.sco_bug_report(
|
r = sco_bug_report.sco_bug_report(
|
||||||
form.title.data, form.message.data, form.etab.data, form.include_dump.data
|
form.title.data, form.message.data, form.etab.data, form.include_dump.data
|
||||||
@ -2581,15 +2581,11 @@ def sco_bug_report_form():
|
|||||||
try:
|
try:
|
||||||
r_msg = r.json()["message"]
|
r_msg = r.json()["message"]
|
||||||
except (requests.exceptions.JSONDecodeError, KeyError):
|
except (requests.exceptions.JSONDecodeError, KeyError):
|
||||||
r_msg = (
|
log(f"sco_bug_report: error {status_code}")
|
||||||
"Erreur: code <tt>"
|
r_msg = f"""Erreur: code <tt>{status_code}</tt>
|
||||||
+ str(status_code)
|
Merci de contacter
|
||||||
+ '</tt> Merci de contacter <a href="mailto:'
|
<a href="mailto:{scu.SCO_DEV_MAIL}">{scu.SCO_DEV_MAIL}</a>
|
||||||
+ scu.SCO_DEV_MAIL
|
"""
|
||||||
+ '">'
|
|
||||||
+ scu.SCO_DEV_MAIL
|
|
||||||
+ "</a>"
|
|
||||||
)
|
|
||||||
|
|
||||||
H = [html_sco_header.sco_header(page_title="Assistance technique")]
|
H = [html_sco_header.sco_header(page_title="Assistance technique")]
|
||||||
if r.status_code >= 200 and r.status_code < 300:
|
if r.status_code >= 200 and r.status_code < 300:
|
||||||
|
Loading…
Reference in New Issue
Block a user