From 97446272af0ff8f9e1e05350bfdbf2d878e3cf5d Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Mon, 26 Jul 2021 16:32:55 +0300 Subject: [PATCH] Fix: codage chaine interrogation portail --- app/scodoc/sco_photos.py | 2 +- app/scodoc/sco_portal_apogee.py | 13 ++----------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/app/scodoc/sco_photos.py b/app/scodoc/sco_photos.py index 5c1cfacfb..6028568f0 100644 --- a/app/scodoc/sco_photos.py +++ b/app/scodoc/sco_photos.py @@ -292,7 +292,7 @@ def suppress_photo(context, etud, REQUEST=None): def save_image(context, etudid, data): - """img_file is a file-like object. + """data is a bytes string. Save image in JPEG in 2 sizes (original and h90). Returns filename (relative to PHOTO_DIR), without extension """ diff --git a/app/scodoc/sco_portal_apogee.py b/app/scodoc/sco_portal_apogee.py index 898b79c31..995dc856a 100644 --- a/app/scodoc/sco_portal_apogee.py +++ b/app/scodoc/sco_portal_apogee.py @@ -267,20 +267,14 @@ def xml_to_list_of_dicts(doc, req=None): def get_infos_apogee_allaccents(context, nom, prenom): "essai recup infos avec differents codages des accents" if nom: - unom = six.text_type(nom, scu.SCO_ENCODING) - nom_noaccents = scu.suppress_accents(unom) - nom_utf8 = unom.encode("utf-8") + nom_noaccents = scu.suppress_accents(nom) else: nom_noaccents = nom - nom_utf8 = nom if prenom: - uprenom = six.text_type(prenom, scu.SCO_ENCODING) - prenom_noaccents = scu.suppress_accents(uprenom) - prenom_utf8 = uprenom.encode("utf-8") + prenom_noaccents = scu.suppress_accents(prenom) else: prenom_noaccents = prenom - prenom_utf8 = prenom # avec accents infos = query_apogee_portal(context, nom=nom, prenom=prenom) @@ -289,9 +283,6 @@ def get_infos_apogee_allaccents(context, nom, prenom): infos += query_apogee_portal( context, nom=nom_noaccents, prenom=prenom_noaccents ) - # avec accents en UTF-8 - if nom_utf8 != nom_noaccents or prenom_utf8 != prenom_noaccents: - infos += query_apogee_portal(context, nom=nom_utf8, prenom=prenom_utf8) return infos