Exception si erreur connexion vers assistance

This commit is contained in:
Emmanuel Viennet 2022-02-28 09:22:17 +01:00
parent 00fa91e598
commit 68680e89d3

View File

@ -186,18 +186,28 @@ def _send_db(ano_db_name):
log("uploading anonymized dump...") log("uploading anonymized dump...")
files = {"file": (ano_db_name + ".dump", dump)} files = {"file": (ano_db_name + ".dump", dump)}
r = requests.post( try:
scu.SCO_DUMP_UP_URL, r = requests.post(
files=files, scu.SCO_DUMP_UP_URL,
data={ files=files,
"dept_name": sco_preferences.get_preference("DeptName"), data={
"serial": _get_scodoc_serial(), "dept_name": sco_preferences.get_preference("DeptName"),
"sco_user": str(current_user), "serial": _get_scodoc_serial(),
"sent_by": sco_users.user_info(str(current_user))["nomcomplet"], "sco_user": str(current_user),
"sco_version": sco_version.SCOVERSION, "sent_by": sco_users.user_info(str(current_user))["nomcomplet"],
"sco_fullversion": scu.get_scodoc_version(), "sco_version": sco_version.SCOVERSION,
}, "sco_fullversion": scu.get_scodoc_version(),
) },
)
except requests.exceptions.ConnectionError as exc:
raise ScoValueError(
"""
Impossible de joindre le serveur d'assistance (scodoc.org).
Veuillez contacter le service informatique de votre établissement pour
corriger la configuration de ScoDoc. Dans la plupart des cas, il
s'agit d'un proxy mal configuré.
"""
) from exc
return r return r