diff --git a/app/decorators.py b/app/decorators.py index 4987f0d83..a72d82535 100644 --- a/app/decorators.py +++ b/app/decorators.py @@ -46,15 +46,15 @@ class ZRequest(object): # if current_app.config["DEBUG"]: # le ReverseProxied se charge maintenant de mettre le bon protocole http ou https - self.URL = request.base_url - self.BASE0 = request.url_root + # self.URL = request.base_url + # self.BASE0 = request.url_root # else: # self.URL = request.base_url.replace("http://", "https://") # self.BASE0 = request.url_root.replace("http://", "https://") - self.URL0 = self.URL + # self.URL0 = self.URL # query_string is bytes: - self.QUERY_STRING = request.query_string.decode("utf-8") - self.REQUEST_METHOD = request.method + # self.QUERY_STRING = request.query_string.decode("utf-8") + # self.REQUEST_METHOD = request.method self.AUTHENTICATED_USER = current_user self.REMOTE_ADDR = request.remote_addr if request.method == "POST": @@ -79,11 +79,7 @@ class ZRequest(object): self.RESPONSE = ZResponse() def __str__(self): - return """REQUEST - URL={r.URL} - QUERY_STRING={r.QUERY_STRING} - REQUEST_METHOD={r.REQUEST_METHOD} - AUTHENTICATED_USER={r.AUTHENTICATED_USER} + return """ZREQUEST form={r.form} """.format( r=self diff --git a/app/scodoc/sco_abs_views.py b/app/scodoc/sco_abs_views.py index a05d42c5e..f75e0b6bd 100644 --- a/app/scodoc/sco_abs_views.py +++ b/app/scodoc/sco_abs_views.py @@ -30,7 +30,7 @@ """ import datetime -from flask import url_for, g +from flask import url_for, g, request import app.scodoc.sco_utils as scu from app.scodoc import notesdb as ndb @@ -814,8 +814,8 @@ def ListeAbsEtud( etudid, datedebut, with_evals=with_evals, format=format ) if REQUEST: - base_url_nj = "%s?etudid=%s&absjust_only=0" % (REQUEST.URL0, etudid) - base_url_j = "%s?etudid=%s&absjust_only=1" % (REQUEST.URL0, etudid) + base_url_nj = "%s?etudid=%s&absjust_only=0" % (request.base_url, etudid) + base_url_j = "%s?etudid=%s&absjust_only=1" % (request.base_url, etudid) else: base_url_nj = base_url_j = "" tab_absnonjust = GenTable( diff --git a/app/scodoc/sco_archives.py b/app/scodoc/sco_archives.py index ca73ac6cb..e17cea63d 100644 --- a/app/scodoc/sco_archives.py +++ b/app/scodoc/sco_archives.py @@ -56,7 +56,7 @@ import shutil import time import flask -from flask import g +from flask import g, request import app.scodoc.sco_utils as scu from config import Config @@ -457,7 +457,7 @@ enregistrés et non modifiables, on peut les retrouver ultérieurement. ) tf = TrivialFormulator( - REQUEST.URL0, + request.base_url, REQUEST.form, descr, cancelbutton="Annuler", diff --git a/app/scodoc/sco_archives_etud.py b/app/scodoc/sco_archives_etud.py index 157d52173..fa41bb656 100644 --- a/app/scodoc/sco_archives_etud.py +++ b/app/scodoc/sco_archives_etud.py @@ -30,7 +30,7 @@ les dossiers d'admission et autres pièces utiles. """ import flask -from flask import url_for, g +from flask import url_for, g, request import app.scodoc.sco_utils as scu from app.scodoc import sco_import_etuds @@ -153,7 +153,7 @@ def etud_upload_file_form(REQUEST, etudid): % (scu.CONFIG.ETUD_MAX_FILE_SIZE // (1024 * 1024)), ] tf = TrivialFormulator( - REQUEST.URL0, + request.base_url, REQUEST.form, ( ("etudid", {"default": etudid, "input_type": "hidden"}), @@ -308,7 +308,7 @@ def etudarchive_import_files_form(group_id, REQUEST=None): ] F = html_sco_header.sco_footer() tf = TrivialFormulator( - REQUEST.URL0, + request.base_url, REQUEST.form, ( ("xlsfile", {"title": "Fichier Excel:", "input_type": "file", "size": 40}), diff --git a/app/scodoc/sco_bulletins.py b/app/scodoc/sco_bulletins.py index 215985b9e..6a5bbb96d 100644 --- a/app/scodoc/sco_bulletins.py +++ b/app/scodoc/sco_bulletins.py @@ -28,6 +28,7 @@ """Génération des bulletins de notes """ +from app.models import formsemestre import time import pprint import email @@ -38,7 +39,7 @@ from email.header import Header from reportlab.lib.colors import Color import urllib -from flask import g +from flask import g, request from flask import url_for from flask_login import current_user from flask_mail import Message @@ -143,7 +144,7 @@ def formsemestre_bulletinetud_dict( I["formsemestre_id"] = formsemestre_id I["sem"] = nt.sem if REQUEST: - I["server_name"] = REQUEST.BASE0 + I["server_name"] = request.url_root else: I["server_name"] = "" @@ -1032,7 +1033,7 @@ def _formsemestre_bulletinetud_header_html( ), """
""" % ( - REQUEST.URL0, + request.base_url, formsemestre_id, n_group_td, n_group_tp, @@ -190,7 +192,7 @@ def formsemestre_estim_cost( ) tab.html_before_table = h tab.base_url = "%s?formsemestre_id=%s&n_group_td=%s&n_group_tp=%s&coef_tp=%s" % ( - REQUEST.URL0, + request.base_url, formsemestre_id, n_group_td, n_group_tp, diff --git a/app/scodoc/sco_debouche.py b/app/scodoc/sco_debouche.py index df93897c7..2dc2f10a8 100644 --- a/app/scodoc/sco_debouche.py +++ b/app/scodoc/sco_debouche.py @@ -29,7 +29,7 @@ Rapport (table) avec dernier semestre fréquenté et débouché de chaque étudiant """ import http -from flask import url_for, g +from flask import url_for, g, request import app.scodoc.sco_utils as scu import app.scodoc.notesdb as ndb @@ -64,7 +64,7 @@ def report_debouche_date(start_year=None, format="html", REQUEST=None): "Généré par %s le " % sco_version.SCONAME + scu.timedate_human_repr() + "" ) tab.caption = "Récapitulatif débouchés à partir du 1/1/%s." % start_year - tab.base_url = "%s?start_year=%s" % (REQUEST.URL0, start_year) + tab.base_url = "%s?start_year=%s" % (request.base_url, start_year) return tab.make_page( title="""