diff --git a/app/decorators.py b/app/decorators.py index 4987f0d8..a72d8253 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 a05d42c5..f75e0b6b 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 f69041e9..e17cea63 100644 --- a/app/scodoc/sco_archives.py +++ b/app/scodoc/sco_archives.py @@ -29,19 +29,19 @@ Archives are plain files, stored in - /archives/ - (where is usually /opt/scodoc-data, and a departement id) + /archives/ + (where is usually /opt/scodoc-data, and a departement id (int)) Les PV de jurys et documents associés sont stockées dans un sous-repertoire de la forme /// (formsemestre_id est ici FormSemestre.id) Les documents liés à l'étudiant sont dans - /docetuds/// + /docetuds/// (etudid est ici Identite.id) Les maquettes Apogée pour l'export des notes sont dans - /apo_csv//-//.csv + /apo_csv//-//.csv Un répertoire d'archive contient des fichiers quelconques, et un fichier texte nommé _description.txt qui est une description (humaine, format libre) de l'archive. @@ -56,11 +56,12 @@ 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 from app import log +from app.models import Departement from app.scodoc.TrivialFormulator import TrivialFormulator from app.scodoc.sco_exceptions import ( AccessDenied, @@ -109,7 +110,8 @@ class BaseArchiver(object): If directory does not yet exist, create it. """ self.initialize() - dept_dir = os.path.join(self.root, g.scodoc_dept) + dept = Departement.query.filter_by(acronym=g.scodoc_dept).first() + dept_dir = os.path.join(self.root, str(dept.id)) try: scu.GSL.acquire() if not os.path.isdir(dept_dir): @@ -128,7 +130,8 @@ class BaseArchiver(object): :return: list of archive oids """ self.initialize() - base = os.path.join(self.root, g.scodoc_dept) + os.path.sep + dept = Departement.query.filter_by(acronym=g.scodoc_dept).first() + base = os.path.join(self.root, str(dept.id)) + os.path.sep dirs = glob.glob(base + "*") return [os.path.split(x)[1] for x in dirs] @@ -454,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 d2482a8f..0d871cda 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"}), @@ -313,7 +313,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 215985b9..6a5bbb96 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, f"""Bulletin """) # Menu endpoint = "notes.formsemestre_bulletinetud" - url = REQUEST.URL0 - qurl = urllib.parse.quote_plus(url + "?" + REQUEST.QUERY_STRING) menuBul = [ { "title": "Réglages bulletins", "endpoint": "notes.formsemestre_edit_options", - "args": {"formsemestre_id": formsemestre_id, "target_url": qurl}, + "args": { + "formsemestre_id": formsemestre_id, + # "target_url": url_for( + # "notes.formsemestre_bulletinetud", + # scodoc_dept=g.scodoc_dept, + # formsemestre_id=formsemestre_id, + # etudid=etudid, + # ), + }, "enabled": (current_user.id in sem["responsables"]) or current_user.has_permission(Permission.ScoImplement), }, @@ -1187,9 +1194,14 @@ def _formsemestre_bulletinetud_header_html( H.append( ' %s' % ( - url - + "?formsemestre_id=%s&etudid=%s&format=pdf&version=%s" - % (formsemestre_id, etudid, version), + url_for( + "notes.formsemestre_bulletinetud", + scodoc_dept=g.scodoc_dept, + formsemestre_id=formsemestre_id, + etudid=etudid, + format="pdf", + version=version, + ), scu.ICON_PDF, ) ) diff --git a/app/scodoc/sco_bulletins_generator.py b/app/scodoc/sco_bulletins_generator.py index bea049a5..783c4986 100644 --- a/app/scodoc/sco_bulletins_generator.py +++ b/app/scodoc/sco_bulletins_generator.py @@ -52,6 +52,8 @@ import reportlab from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Frame, PageBreak from reportlab.platypus import Table, TableStyle, Image, KeepInFrame +from flask import request + from app.scodoc import sco_utils as scu from app.scodoc.sco_exceptions import NoteProcessError from app import log @@ -289,7 +291,7 @@ def make_formsemestre_bulletinetud( authuser=REQUEST.AUTHENTICATED_USER, version=version, filigranne=infos["filigranne"], - server_name=REQUEST.BASE0, + server_name=request.url_root, ) if format not in bul_generator.supported_formats: # use standard generator @@ -304,7 +306,7 @@ def make_formsemestre_bulletinetud( authuser=REQUEST.AUTHENTICATED_USER, version=version, filigranne=infos["filigranne"], - server_name=REQUEST.BASE0, + server_name=request.url_root, ) data = bul_generator.generate(format=format, stand_alone=stand_alone) diff --git a/app/scodoc/sco_bulletins_pdf.py b/app/scodoc/sco_bulletins_pdf.py index fd21a70c..719b20a3 100644 --- a/app/scodoc/sco_bulletins_pdf.py +++ b/app/scodoc/sco_bulletins_pdf.py @@ -58,7 +58,7 @@ import traceback from reportlab.platypus.doctemplate import PageTemplate, BaseDocTemplate -from flask import g, url_for +from flask import g, url_for, request import app.scodoc.sco_utils as scu from app import log @@ -193,7 +193,7 @@ def get_formsemestre_bulletins_pdf(formsemestre_id, REQUEST, version="selectedev # infos = {"DeptName": sco_preferences.get_preference("DeptName", formsemestre_id)} if REQUEST: - server_name = REQUEST.BASE0 + server_name = request.url_root else: server_name = "" try: @@ -243,7 +243,7 @@ def get_etud_bulletins_pdf(etudid, REQUEST, version="selectedevals"): i = i + 1 infos = {"DeptName": sco_preferences.get_preference("DeptName")} if REQUEST: - server_name = REQUEST.BASE0 + server_name = request.url_root else: server_name = "" try: diff --git a/app/scodoc/sco_cost_formation.py b/app/scodoc/sco_cost_formation.py index a702eaed..7c442f81 100644 --- a/app/scodoc/sco_cost_formation.py +++ b/app/scodoc/sco_cost_formation.py @@ -30,6 +30,8 @@ (coût théorique en heures équivalent TD) """ +from flask import request + import app.scodoc.sco_utils as scu from app.scodoc.gen_tables import GenTable from app.scodoc import sco_formsemestre @@ -182,7 +184,7 @@ def formsemestre_estim_cost(
""" % ( - 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 df93897c..2dc2f10a 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="""

Débouchés étudiants

""", init_qtip=True, diff --git a/app/scodoc/sco_dept.py b/app/scodoc/sco_dept.py index 349ad009..3d342dcc 100644 --- a/app/scodoc/sco_dept.py +++ b/app/scodoc/sco_dept.py @@ -28,7 +28,7 @@ """Page accueil département (liste des semestres, etc) """ -from flask import g +from flask import g, request from flask_login import current_user import app @@ -131,7 +131,7 @@ def index_html(REQUEST=None, showcodes=0, showsemtable=0): if not showsemtable: H.append( '

Voir tous les semestres

' - % REQUEST.URL0 + % request.base_url ) H.append( @@ -242,7 +242,7 @@ def _sem_table_gt(sems, showcodes=False): rows=sems, html_class="table_leftalign semlist", html_sortable=True, - # base_url = '%s?formsemestre_id=%s' % (REQUEST.URL0, formsemestre_id), + # base_url = '%s?formsemestre_id=%s' % (request.base_url, formsemestre_id), # caption='Maquettes enregistrées', preferences=sco_preferences.SemPreferences(), ) diff --git a/app/scodoc/sco_edit_formation.py b/app/scodoc/sco_edit_formation.py index b52c3a53..3ee23575 100644 --- a/app/scodoc/sco_edit_formation.py +++ b/app/scodoc/sco_edit_formation.py @@ -29,7 +29,7 @@ (portage from DTML) """ import flask -from flask import g, url_for +from flask import g, url_for, request import app.scodoc.notesdb as ndb import app.scodoc.sco_utils as scu @@ -159,7 +159,7 @@ def formation_edit(formation_id=None, create=False, REQUEST=None): ) tf = TrivialFormulator( - REQUEST.URL0, + request.base_url, REQUEST.form, ( ("formation_id", {"default": formation_id, "input_type": "hidden"}), diff --git a/app/scodoc/sco_edit_matiere.py b/app/scodoc/sco_edit_matiere.py index 6b9e7d43..f3fbabe0 100644 --- a/app/scodoc/sco_edit_matiere.py +++ b/app/scodoc/sco_edit_matiere.py @@ -29,7 +29,7 @@ (portage from DTML) """ import flask -from flask import g, url_for +from flask import g, url_for, request import app.scodoc.notesdb as ndb import app.scodoc.sco_utils as scu @@ -116,7 +116,7 @@ associé.

""", ] tf = TrivialFormulator( - REQUEST.URL0, + request.base_url, REQUEST.form, ( ("ue_id", {"input_type": "hidden", "default": ue_id}), @@ -202,7 +202,7 @@ def matiere_delete(matiere_id=None, REQUEST=None): ] dest_url = scu.NotesURL() + "/ue_list?formation_id=" + str(UE["formation_id"]) tf = TrivialFormulator( - REQUEST.URL0, + request.base_url, REQUEST.form, (("matiere_id", {"input_type": "hidden"}),), initvalues=M, @@ -256,7 +256,7 @@ des notes. associé.

""" tf = TrivialFormulator( - REQUEST.URL0, + request.base_url, REQUEST.form, ( ("matiere_id", {"input_type": "hidden"}), @@ -323,4 +323,4 @@ def matiere_is_locked(matiere_id): """, {"matiere_id": matiere_id}, ) - return len(r) > 0 \ No newline at end of file + return len(r) > 0 diff --git a/app/scodoc/sco_edit_module.py b/app/scodoc/sco_edit_module.py index 3b4ce254..b0b6ca76 100644 --- a/app/scodoc/sco_edit_module.py +++ b/app/scodoc/sco_edit_module.py @@ -29,7 +29,7 @@ (portage from DTML) """ import flask -from flask import url_for, g +from flask import url_for, g, request import app.scodoc.notesdb as ndb import app.scodoc.sco_utils as scu @@ -143,7 +143,7 @@ def module_create(matiere_id=None, REQUEST=None): else: default_num = 10 tf = TrivialFormulator( - REQUEST.URL0, + request.base_url, REQUEST.form, ( ( @@ -294,7 +294,7 @@ def module_delete(module_id=None, REQUEST=None): dest_url = scu.NotesURL() + "/ue_list?formation_id=" + str(Mod["formation_id"]) tf = TrivialFormulator( - REQUEST.URL0, + request.base_url, REQUEST.form, (("module_id", {"input_type": "hidden"}),), initvalues=Mod, @@ -388,7 +388,7 @@ def module_edit(module_id=None, REQUEST=None): ) tf = TrivialFormulator( - REQUEST.URL0, + request.base_url, REQUEST.form, ( ( diff --git a/app/scodoc/sco_edit_ue.py b/app/scodoc/sco_edit_ue.py index db19d56b..6f51ee4d 100644 --- a/app/scodoc/sco_edit_ue.py +++ b/app/scodoc/sco_edit_ue.py @@ -29,7 +29,7 @@ """ import flask -from flask import g, url_for +from flask import g, url_for, request from flask_login import current_user import app.scodoc.notesdb as ndb @@ -326,7 +326,11 @@ def ue_edit(ue_id=None, create=False, formation_id=None, REQUEST=None): ) ) tf = TrivialFormulator( - REQUEST.URL0, REQUEST.form, fw, initvalues=initvalues, submitlabel=submitlabel + request.base_url, + REQUEST.form, + fw, + initvalues=initvalues, + submitlabel=submitlabel, ) if tf[0] == 0: X = """
@@ -1033,7 +1037,7 @@ def formation_table_recap(formation_id, format="html", REQUEST=None): caption=title, html_caption=title, html_class="table_leftalign", - base_url="%s?formation_id=%s" % (REQUEST.URL0, formation_id), + base_url="%s?formation_id=%s" % (request.base_url, formation_id), page_title=title, html_title="

" + title + "

", pdf_title=title, diff --git a/app/scodoc/sco_etape_apogee.py b/app/scodoc/sco_etape_apogee.py index 5409c58e..582497e9 100644 --- a/app/scodoc/sco_etape_apogee.py +++ b/app/scodoc/sco_etape_apogee.py @@ -32,11 +32,11 @@ Voir sco_apogee_csv.py pour la structure du fichier Apogée. Stockage: utilise sco_archive.py - => /opt/scodoc/var/scodoc/archives/apo_csv/RT/2016-1/2016-07-03-16-12-19/V3ASR.csv + => /opt/scodoc/var/scodoc/archives/apo_csv//2016-1/2016-07-03-16-12-19/V3ASR.csv pour une maquette de l'année scolaire 2016, semestre 1, etape V3ASR ou bien (à partir de ScoDoc 1678) : - /opt/scodoc/var/scodoc/archives/apo_csv/RT/2016-1/2016-07-03-16-12-19/V3ASR!111.csv + /opt/scodoc/var/scodoc/archives/apo_csv//2016-1/2016-07-03-16-12-19/V3ASR!111.csv pour une maquette de l'étape V3ASR version VDI 111. La version VDI sera ignorée sauf si elle est indiquée dans l'étape du semestre. diff --git a/app/scodoc/sco_etape_apogee_view.py b/app/scodoc/sco_etape_apogee_view.py index 1b625bcd..a4440bf7 100644 --- a/app/scodoc/sco_etape_apogee_view.py +++ b/app/scodoc/sco_etape_apogee_view.py @@ -32,7 +32,7 @@ import io from zipfile import ZipFile import flask -from flask import url_for, g, send_file +from flask import url_for, g, send_file, request # from werkzeug.utils import send_file @@ -250,7 +250,7 @@ def apo_semset_maq_status( """
""", ) - tab.base_url = "%s?etape_apo=%s" % (REQUEST.URL0, etape_apo or "") + tab.base_url = "%s?etape_apo=%s" % (request.base_url, etape_apo or "") return tab.make_page(format=format) diff --git a/app/scodoc/sco_formsemestre_custommenu.py b/app/scodoc/sco_formsemestre_custommenu.py index 7600420b..fea675e0 100644 --- a/app/scodoc/sco_formsemestre_custommenu.py +++ b/app/scodoc/sco_formsemestre_custommenu.py @@ -28,7 +28,7 @@ """Menu "custom" (défini par l'utilisateur) dans les semestres """ import flask -from flask import g, url_for +from flask import g, url_for, request import app.scodoc.sco_utils as scu import app.scodoc.notesdb as ndb @@ -119,7 +119,7 @@ def formsemestre_custommenu_edit(formsemestre_id, REQUEST=None): initvalues["title_" + str(item["custommenu_id"])] = item["title"] initvalues["url_" + str(item["custommenu_id"])] = item["url"] tf = TrivialFormulator( - REQUEST.URL0, + request.base_url, REQUEST.form, descr, initvalues=initvalues, diff --git a/app/scodoc/sco_formsemestre_edit.py b/app/scodoc/sco_formsemestre_edit.py index 57740a0f..c0a01fc7 100644 --- a/app/scodoc/sco_formsemestre_edit.py +++ b/app/scodoc/sco_formsemestre_edit.py @@ -28,7 +28,7 @@ """Form choix modules / responsables et creation formsemestre """ import flask -from flask import url_for, g +from flask import url_for, g, request from flask_login import current_user from app.auth.models import User @@ -661,7 +661,7 @@ def do_formsemestre_createwithmodules(REQUEST=None, edit=False): # tf = TrivialFormulator( - REQUEST.URL0, + request.base_url, REQUEST.form, modform, submitlabel=submitlabel, @@ -966,7 +966,7 @@ def formsemestre_clone(formsemestre_id, REQUEST=None): ), ] tf = TrivialFormulator( - REQUEST.URL0, + request.base_url, REQUEST.form, descr, submitlabel="Dupliquer ce semestre", @@ -1268,7 +1268,7 @@ def formsemestre_delete(formsemestre_id, REQUEST=None): else: submit_label = "Confirmer la suppression du semestre" tf = TrivialFormulator( - REQUEST.URL0, + request.base_url, REQUEST.form, (("formsemestre_id", {"input_type": "hidden"}),), initvalues=F, @@ -1428,7 +1428,7 @@ def do_formsemestre_delete(formsemestre_id): # --------------------------------------------------------------------------------------- -def formsemestre_edit_options(formsemestre_id, target_url=None, REQUEST=None): +def formsemestre_edit_options(formsemestre_id, REQUEST=None): """dialog to change formsemestre options (accessible par ScoImplement ou dir. etudes) """ @@ -1583,7 +1583,7 @@ def formsemestre_edit_uecoefs(formsemestre_id, err_ue_id=None, REQUEST=None): form.append(("ue_" + str(ue["ue_id"]), descr)) tf = TrivialFormulator( - REQUEST.URL0, + request.base_url, REQUEST.form, form, submitlabel="Changer les coefficients", diff --git a/app/scodoc/sco_formsemestre_exterieurs.py b/app/scodoc/sco_formsemestre_exterieurs.py index 2ab82d87..8f8ea567 100644 --- a/app/scodoc/sco_formsemestre_exterieurs.py +++ b/app/scodoc/sco_formsemestre_exterieurs.py @@ -34,7 +34,7 @@ Ces semestres n'auront qu'un seul inscrit ! import time import flask -from flask import url_for, g +from flask import url_for, g, request from flask_login import current_user import app.scodoc.sco_utils as scu @@ -181,7 +181,7 @@ def formsemestre_ext_create_form(etudid, formsemestre_id, REQUEST=None): ] tf = TrivialFormulator( - REQUEST.URL0, + request.base_url, REQUEST.form, descr, cancelbutton="Annuler", @@ -231,7 +231,7 @@ def formsemestre_ext_edit_ue_validations(formsemestre_id, etudid, REQUEST=None): else: initvalues = {} tf = TrivialFormulator( - REQUEST.URL0, + request.base_url, REQUEST.form, descr, cssclass="tf_ext_edit_ue_validations", diff --git a/app/scodoc/sco_formsemestre_inscriptions.py b/app/scodoc/sco_formsemestre_inscriptions.py index f8b29dd4..536e4743 100644 --- a/app/scodoc/sco_formsemestre_inscriptions.py +++ b/app/scodoc/sco_formsemestre_inscriptions.py @@ -30,7 +30,7 @@ import time import flask -from flask import url_for, g +from flask import url_for, g, request import app.scodoc.sco_utils as scu from app import log @@ -415,7 +415,7 @@ def formsemestre_inscription_with_modules( """ - % (REQUEST.URL0, etudid, formsemestre_id) + % (request.base_url, etudid, formsemestre_id) ) H.append(sco_groups.form_group_choice(formsemestre_id, allow_none=True)) @@ -533,7 +533,7 @@ function chkbx_select(field_id, state) { """ ) tf = TrivialFormulator( - REQUEST.URL0, + request.base_url, REQUEST.form, descr, initvalues, diff --git a/app/scodoc/sco_formsemestre_status.py b/app/scodoc/sco_formsemestre_status.py index d54629c9..b689dbf8 100644 --- a/app/scodoc/sco_formsemestre_status.py +++ b/app/scodoc/sco_formsemestre_status.py @@ -698,7 +698,7 @@ def formsemestre_description_table(formsemestre_id, REQUEST=None, with_evals=Fal html_caption=title, html_class="table_leftalign formsemestre_description", base_url="%s?formsemestre_id=%s&with_evals=%s" - % (REQUEST.URL0, formsemestre_id, with_evals), + % (request.base_url, formsemestre_id, with_evals), page_title=title, html_title=html_sco_header.html_sem_header( REQUEST, "Description du semestre", sem, with_page_header=False @@ -721,7 +721,7 @@ def formsemestre_description( tab.html_before_table = """
Renommer une partition"] tf = TrivialFormulator( - REQUEST.URL0, + request.base_url, REQUEST.form, ( ("partition_id", {"default": partition_id, "input_type": "hidden"}), @@ -1188,7 +1188,7 @@ def group_rename(group_id, REQUEST=None): raise AccessDenied("Vous n'avez pas le droit d'effectuer cette opération !") H = ["

Renommer un groupe de %s

" % group["partition_name"]] tf = TrivialFormulator( - REQUEST.URL0, + request.base_url, REQUEST.form, ( ("group_id", {"default": group_id, "input_type": "hidden"}), @@ -1268,7 +1268,7 @@ def groups_auto_repartition(partition_id=None, REQUEST=None): ] tf = TrivialFormulator( - REQUEST.URL0, + request.base_url, REQUEST.form, descr, {}, diff --git a/app/scodoc/sco_groups_view.py b/app/scodoc/sco_groups_view.py index 219f103c..f1962212 100644 --- a/app/scodoc/sco_groups_view.py +++ b/app/scodoc/sco_groups_view.py @@ -719,7 +719,7 @@ def groups_table( partitions=groups_infos.partitions, with_codes=with_codes, with_paiement=with_paiement, - server_name=REQUEST.BASE0, + server_name=request.url_root, ) filename = "liste_%s" % groups_infos.groups_filename + ".xlsx" return scu.send_file( @@ -794,10 +794,7 @@ def groups_table( title = "etudiants_%s" % groups_infos.groups_filename xls = sco_excel.excel_simple_table(titles=titles, lines=L, sheet_name=title) filename = title + scu.XLSX_SUFFIX - return scu.send_file( - xls, filename, scu.XLSX_SUFFIX, scu.XLSX_MIMETYPE, attached=True - ) - # return sco_excel.send_excel_file(REQUEST, xls, filename) + return sco_excel.send_excel_file(REQUEST, xls, filename) else: raise ValueError("unsupported format") @@ -919,12 +916,12 @@ def form_choix_saisie_semaine(groups_infos, REQUEST=None): return "" # construit l'URL "destination" # (a laquelle on revient apres saisie absences) - query_args = parse_qs(REQUEST.QUERY_STRING) + query_args = parse_qs(request.query_string) moduleimpl_id = query_args.get("moduleimpl_id", [""])[0] if "head_message" in query_args: del query_args["head_message"] destination = "%s?%s" % ( - REQUEST.URL, + request.base_url, urllib.parse.urlencode(query_args, True), ) destination = destination.replace( diff --git a/app/scodoc/sco_inscr_passage.py b/app/scodoc/sco_inscr_passage.py index 04cd2dcd..a6c9cdc8 100644 --- a/app/scodoc/sco_inscr_passage.py +++ b/app/scodoc/sco_inscr_passage.py @@ -31,7 +31,7 @@ import datetime from operator import itemgetter -from flask import url_for, g +from flask import url_for, g, request import app.scodoc.notesdb as ndb import app.scodoc.sco_utils as scu @@ -414,7 +414,7 @@ def build_page( html_sco_header.html_sem_header( REQUEST, "Passages dans le semestre", sem, with_page_header=False ), - """""" % REQUEST.URL0, + """""" % request.base_url, """  aide diff --git a/app/scodoc/sco_liste_notes.py b/app/scodoc/sco_liste_notes.py index 9932b9c8..e7319614 100644 --- a/app/scodoc/sco_liste_notes.py +++ b/app/scodoc/sco_liste_notes.py @@ -31,7 +31,7 @@ from operator import itemgetter import urllib import flask -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 @@ -177,7 +177,7 @@ def do_evaluation_listenotes(REQUEST): ), ] tf = TrivialFormulator( - REQUEST.URL0, + request.base_url, REQUEST.form, descr, cancelbutton=None, diff --git a/app/scodoc/sco_lycee.py b/app/scodoc/sco_lycee.py index 99f939b4..744c3879 100644 --- a/app/scodoc/sco_lycee.py +++ b/app/scodoc/sco_lycee.py @@ -31,7 +31,7 @@ """ from operator import itemgetter -from flask import url_for, g +from flask import url_for, g, request import app import app.scodoc.sco_utils as scu @@ -84,7 +84,7 @@ def scodoc_table_etuds_lycees(format="html", REQUEST=None): sco_preferences.SemPreferences(), no_links=True, ) - tab.base_url = REQUEST.URL0 + tab.base_url = request.base_url t = tab.make_page(format=format, with_html_headers=False) if format != "html": return t @@ -187,7 +187,7 @@ def formsemestre_etuds_lycees( tab, etuds_by_lycee = formsemestre_table_etuds_lycees( formsemestre_id, only_primo=only_primo, group_lycees=not no_grouping ) - tab.base_url = "%s?formsemestre_id=%s" % (REQUEST.URL0, formsemestre_id) + tab.base_url = "%s?formsemestre_id=%s" % (request.base_url, formsemestre_id) if only_primo: tab.base_url += "&only_primo=1" if no_grouping: diff --git a/app/scodoc/sco_moduleimpl_inscriptions.py b/app/scodoc/sco_moduleimpl_inscriptions.py index 91650d48..12e34f3c 100644 --- a/app/scodoc/sco_moduleimpl_inscriptions.py +++ b/app/scodoc/sco_moduleimpl_inscriptions.py @@ -30,7 +30,7 @@ from operator import itemgetter import flask -from flask import url_for, g +from flask import url_for, g, request import app.scodoc.notesdb as ndb import app.scodoc.sco_utils as scu @@ -137,7 +137,7 @@ def moduleimpl_inscriptions_edit( """ ) - H.append("""""" % REQUEST.URL0) + H.append("""""" % request.base_url) H.append( """ diff --git a/app/scodoc/sco_photos.py b/app/scodoc/sco_photos.py index b63b2afc..286314bf 100644 --- a/app/scodoc/sco_photos.py +++ b/app/scodoc/sco_photos.py @@ -341,7 +341,7 @@ def find_new_dir(): def copy_portal_photo_to_fs(etud): """Copy the photo from portal (distant website) to local fs. - Returns rel. path or None if copy failed, with a diagnotic message + Returns rel. path or None if copy failed, with a diagnostic message """ sco_etud.format_etud_ident(etud) url = photo_portal_url(etud) @@ -353,11 +353,12 @@ def copy_portal_photo_to_fs(etud): log("copy_portal_photo_to_fs: getting %s" % url) r = requests.get(url, timeout=portal_timeout) except: - log("download failed: exception:\n%s" % traceback.format_exc()) - log("called from:\n" + "".join(traceback.format_stack())) + # log("download failed: exception:\n%s" % traceback.format_exc()) + # log("called from:\n" + "".join(traceback.format_stack())) + log("copy_portal_photo_to_fs: error.") return None, "%s: erreur chargement de %s" % (etud["nomprenom"], url) if r.status_code != 200: - log("download failed") + log(f"copy_portal_photo_to_fs: download failed {r.status_code }") return None, "%s: erreur chargement de %s" % (etud["nomprenom"], url) data = r.content # image bytes try: diff --git a/app/scodoc/sco_placement.py b/app/scodoc/sco_placement.py index 20f9cdc7..d0e19c67 100644 --- a/app/scodoc/sco_placement.py +++ b/app/scodoc/sco_placement.py @@ -34,6 +34,10 @@ import random import time from copy import copy +import flask +from flask import request + +from app.scodoc.sco_exceptions import ScoValueError import wtforms.validators from flask import request, render_template from flask_login import current_user diff --git a/app/scodoc/sco_poursuite_dut.py b/app/scodoc/sco_poursuite_dut.py index b2fb7d11..a3bdf411 100644 --- a/app/scodoc/sco_poursuite_dut.py +++ b/app/scodoc/sco_poursuite_dut.py @@ -31,7 +31,7 @@ Recapitule tous les semestres validés dans une feuille excel. """ import collections -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_abs @@ -211,7 +211,7 @@ def formsemestre_poursuite_report(formsemestre_id, format="html", REQUEST=None): ) tab.caption = "Récapitulatif %s." % sem["titreannee"] tab.html_caption = "Récapitulatif %s." % sem["titreannee"] - tab.base_url = "%s?formsemestre_id=%s" % (REQUEST.URL0, formsemestre_id) + tab.base_url = "%s?formsemestre_id=%s" % (request.base_url, formsemestre_id) return tab.make_page( title="""

Poursuite d'études

""", init_qtip=True, diff --git a/app/scodoc/sco_preferences.py b/app/scodoc/sco_preferences.py index 779506f1..e2b56bed 100644 --- a/app/scodoc/sco_preferences.py +++ b/app/scodoc/sco_preferences.py @@ -111,7 +111,7 @@ get_base_preferences(formsemestre_id) """ import flask -from flask import g, url_for +from flask import g, url_for, request from flask_login import current_user from app.models import Departement @@ -2032,7 +2032,7 @@ class BasePreferences(object): ] form = self.build_tf_form() tf = TrivialFormulator( - REQUEST.URL0, + request.base_url, REQUEST.form, form, initvalues=self.prefs[None], @@ -2197,7 +2197,7 @@ function set_global_pref(el, pref_name) { form.append(("destination", {"input_type": "hidden"})) form.append(("formsemestre_id", {"input_type": "hidden"})) tf = TrivialFormulator( - REQUEST.URL0, + request.base_url, REQUEST.form, form, initvalues=self, @@ -2248,7 +2248,7 @@ function set_global_pref(el, pref_name) { return flask.redirect(dest_url + "&head_message=Préférences modifiées") elif destination == "again": return flask.redirect( - REQUEST.URL0 + "?formsemestre_id=" + str(self.formsemestre_id) + request.base_url + "?formsemestre_id=" + str(self.formsemestre_id) ) elif destination == "global": return flask.redirect(scu.ScoURL() + "/edit_preferences") diff --git a/app/scodoc/sco_prepajury.py b/app/scodoc/sco_prepajury.py index 3e4559a4..67e16073 100644 --- a/app/scodoc/sco_prepajury.py +++ b/app/scodoc/sco_prepajury.py @@ -31,6 +31,8 @@ import time from openpyxl.styles.numbers import FORMAT_NUMBER_00 +from flask import request + import app.scodoc.sco_utils as scu from app.scodoc import sco_abs from app.scodoc import sco_groups @@ -318,7 +320,7 @@ def feuille_preparation_jury(formsemestre_id, REQUEST): % ( sco_version.SCONAME, time.strftime("%d/%m/%Y"), - REQUEST.BASE0, + request.url_root, REQUEST.AUTHENTICATED_USER, ) ) diff --git a/app/scodoc/sco_pvjury.py b/app/scodoc/sco_pvjury.py index affe43f4..84e9a2db 100644 --- a/app/scodoc/sco_pvjury.py +++ b/app/scodoc/sco_pvjury.py @@ -52,7 +52,7 @@ from reportlab.platypus import Paragraph from reportlab.lib import styles import flask -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 @@ -537,7 +537,7 @@ def formsemestre_pvjury(formsemestre_id, format="html", publish=True, REQUEST=No with_html_headers=False, publish=publish, ) - tab.base_url = "%s?formsemestre_id=%s" % (REQUEST.URL0, formsemestre_id) + tab.base_url = "%s?formsemestre_id=%s" % (request.base_url, formsemestre_id) H = [ html_sco_header.html_sem_header( REQUEST, @@ -657,7 +657,7 @@ def formsemestre_pvjury_pdf(formsemestre_id, group_ids=[], etudid=None, REQUEST= else: menu_choix_groupe = "" # un seul etudiant à editer tf = TrivialFormulator( - REQUEST.URL0, + request.base_url, REQUEST.form, descr, cancelbutton="Annuler", @@ -806,7 +806,7 @@ def formsemestre_lettres_individuelles(formsemestre_id, group_ids=[], REQUEST=No H = [ html_sco_header.html_sem_header( REQUEST, - "Edition des lettres individuelles", + "Édition des lettres individuelles", sem=sem, javascripts=sco_groups_view.JAVASCRIPTS, cssstyles=sco_groups_view.CSSSTYLES, @@ -826,7 +826,7 @@ def formsemestre_lettres_individuelles(formsemestre_id, group_ids=[], REQUEST=No ) tf = TrivialFormulator( - REQUEST.URL0, + request.base_url, REQUEST.form, descr, cancelbutton="Annuler", diff --git a/app/scodoc/sco_recapcomplet.py b/app/scodoc/sco_recapcomplet.py index a01a6059..b03df0c5 100644 --- a/app/scodoc/sco_recapcomplet.py +++ b/app/scodoc/sco_recapcomplet.py @@ -32,6 +32,8 @@ import json import time from xml.etree import ElementTree +from flask import request + import app.scodoc.sco_utils as scu from app import log from app.scodoc import html_sco_header @@ -101,7 +103,7 @@ def formsemestre_recapcomplet( sco_formsemestre_status.formsemestre_status_head( formsemestre_id=formsemestre_id, REQUEST=REQUEST ), - '' % REQUEST.URL0, + '' % request.base_url, '' % formsemestre_id, '', diff --git a/app/scodoc/sco_report.py b/app/scodoc/sco_report.py index 193b0eb6..29f166b5 100644 --- a/app/scodoc/sco_report.py +++ b/app/scodoc/sco_report.py @@ -37,7 +37,7 @@ import time import datetime from operator import itemgetter -from flask import url_for, g +from flask import url_for, g, request import pydot import app.scodoc.sco_utils as scu @@ -247,7 +247,7 @@ def formsemestre_report( sem["titreannee"], ) tab.html_caption = "Répartition des résultats par %s." % category_name - tab.base_url = "%s?formsemestre_id=%s" % (REQUEST.URL0, formsemestre_id) + tab.base_url = "%s?formsemestre_id=%s" % (request.base_url, formsemestre_id) if only_primo: tab.base_url += "&only_primo=on" return tab @@ -322,7 +322,7 @@ def formsemestre_report_counts( F = [ """

Colonnes: """ - % (REQUEST.URL0, selected) + % (request.base_url, selected) ] for b in bacs: if bac == b: @@ -1166,7 +1166,7 @@ def table_suivi_parcours(formsemestre_id, only_primo=False, grouped_parcours=Tru def tsp_form_primo_group(REQUEST, only_primo, no_grouping, formsemestre_id, format): """Element de formulaire pour choisir si restriction aux primos entrants et groupement par lycees""" - F = ["""""" % REQUEST.URL0] + F = ["""""" % request.base_url] if only_primo: checked = 'checked="1"' else: @@ -1204,7 +1204,7 @@ def formsemestre_suivi_parcours( only_primo=only_primo, grouped_parcours=not no_grouping, ) - tab.base_url = "%s?formsemestre_id=%s" % (REQUEST.URL0, formsemestre_id) + tab.base_url = "%s?formsemestre_id=%s" % (request.base_url, formsemestre_id) if only_primo: tab.base_url += "&only_primo=1" if no_grouping: diff --git a/app/scodoc/sco_saisie_notes.py b/app/scodoc/sco_saisie_notes.py index dc50a1ae..66e9b81b 100644 --- a/app/scodoc/sco_saisie_notes.py +++ b/app/scodoc/sco_saisie_notes.py @@ -35,7 +35,7 @@ import datetime import psycopg2 import flask -from flask import g, url_for +from flask import g, url_for, request from flask_login import current_user import app.scodoc.sco_utils as scu @@ -657,7 +657,7 @@ def saisie_notes_tableur(evaluation_id, group_ids=[], REQUEST=None): ) nf = TrivialFormulator( - REQUEST.URL0, + request.base_url, REQUEST.form, ( ("evaluation_id", {"default": evaluation_id, "input_type": "hidden"}), diff --git a/app/scodoc/sco_trombino.py b/app/scodoc/sco_trombino.py index 89b3935e..bd3f19aa 100644 --- a/app/scodoc/sco_trombino.py +++ b/app/scodoc/sco_trombino.py @@ -44,7 +44,7 @@ from reportlab.lib import colors from PIL import Image as PILImage import flask -from flask import url_for, g, send_file +from flask import url_for, g, send_file, request from app import log import app.scodoc.sco_utils as scu @@ -519,7 +519,7 @@ def photos_import_files_form(group_ids=[], REQUEST=None): F = html_sco_header.sco_footer() REQUEST.form["group_ids"] = groups_infos.group_ids tf = TrivialFormulator( - REQUEST.URL0, + request.base_url, REQUEST.form, ( ("xlsfile", {"title": "Fichier Excel:", "input_type": "file", "size": 40}), diff --git a/app/scodoc/sco_ue_external.py b/app/scodoc/sco_ue_external.py index ff1d69d2..da90a2dd 100644 --- a/app/scodoc/sco_ue_external.py +++ b/app/scodoc/sco_ue_external.py @@ -54,6 +54,7 @@ Solution proposée (nov 2014): """ import flask +from flask import request from flask_login import current_user import app.scodoc.notesdb as ndb @@ -248,7 +249,7 @@ def external_ue_create_form(formsemestre_id, etudid, REQUEST=None): default_label = "Aucune UE externe existante" tf = TrivialFormulator( - REQUEST.URL0, + request.base_url, REQUEST.form, ( ("formsemestre_id", {"input_type": "hidden"}), diff --git a/app/scodoc/sco_undo_notes.py b/app/scodoc/sco_undo_notes.py index 79c16f7b..60c15d53 100644 --- a/app/scodoc/sco_undo_notes.py +++ b/app/scodoc/sco_undo_notes.py @@ -46,6 +46,8 @@ Opérations: """ import datetime +from flask import request + from app.scodoc.intervals import intervalmap import app.scodoc.sco_utils as scu @@ -217,7 +219,7 @@ def formsemestre_list_saisies_notes(formsemestre_id, format="html", REQUEST=None html_sortable=True, caption="Saisies de notes dans %s" % sem["titreannee"], preferences=sco_preferences.SemPreferences(formsemestre_id), - base_url="%s?formsemestre_id=%s" % (REQUEST.URL0, formsemestre_id), + base_url="%s?formsemestre_id=%s" % (request.base_url, formsemestre_id), origin="Généré par %s le " % sco_version.SCONAME + scu.timedate_human_repr() + "", diff --git a/app/scodoc/sco_users.py b/app/scodoc/sco_users.py index a45cce45..3475daf7 100644 --- a/app/scodoc/sco_users.py +++ b/app/scodoc/sco_users.py @@ -30,7 +30,7 @@ # Anciennement ZScoUsers.py, fonctions de gestion des données réécrite avec flask/SQLAlchemy -from flask import url_for, g +from flask import url_for, g, request from flask_login import current_user import cracklib # pylint: disable=import-error @@ -117,7 +117,7 @@ def index_html(REQUEST, all_depts=False, with_inactives=False, format="html"): Tous les départements Avec anciens utilisateurs

""" - % (REQUEST.URL0, checked, olds_checked) + % (request.base_url, checked, olds_checked) ) L = list_users( @@ -212,7 +212,7 @@ def list_users( html_class="table_leftalign list_users", html_with_td_classes=True, html_sortable=True, - base_url="%s?all=%s" % (REQUEST.URL0, all), + base_url="%s?all=%s" % (request.base_url, all), pdf_link=False, # table is too wide to fit in a paper page => disable pdf preferences=sco_preferences.SemPreferences(), ) diff --git a/app/views/absences.py b/app/views/absences.py index b6c46360..e5224cf5 100644 --- a/app/views/absences.py +++ b/app/views/absences.py @@ -56,7 +56,7 @@ import urllib from xml.etree import ElementTree import flask -from flask import g +from flask import g, request from flask import url_for from app.decorators import ( @@ -161,7 +161,7 @@ def index_html(REQUEST=None): Saisie par semaine - Choix du groupe: """ - % REQUEST.URL0, + % request.base_url, sco_abs_views.formChoixSemestreGroupe(), "

", cal_select_week(), @@ -961,7 +961,7 @@ ou entrez une date pour visualiser les absents un jour donné :
""" - % (REQUEST.URL0, formsemestre_id, groups_infos.get_form_elem()), + % (request.base_url, formsemestre_id, groups_infos.get_form_elem()), ) return tab.make_page(format=format) @@ -1119,7 +1119,7 @@ def AddBilletAbsenceForm(etudid, REQUEST=None): ) ] tf = TrivialFormulator( - REQUEST.URL0, + request.base_url, REQUEST.form, ( ("etudid", {"input_type": "hidden"}), @@ -1265,7 +1265,7 @@ def listeBillets(REQUEST=None): ] tf = TrivialFormulator( - REQUEST.URL0, + request.base_url, REQUEST.form, (("billet_id", {"input_type": "text", "title": "Numéro du billet"}),), submitbutton=False, @@ -1398,7 +1398,7 @@ def ProcessBilletAbsenceForm(billet_id, REQUEST=None): ] tf = TrivialFormulator( - REQUEST.URL0, + request.base_url, REQUEST.form, ( ("billet_id", {"input_type": "hidden"}), diff --git a/app/views/entreprises.py b/app/views/entreprises.py index e5bdf2d2..62532857 100644 --- a/app/views/entreprises.py +++ b/app/views/entreprises.py @@ -38,6 +38,8 @@ import re import time import calendar +from flask import request + # MIGRATION EN COURS => MODULE DESACTIVE ! # A REVOIR @@ -166,14 +168,14 @@ def index_html(REQUEST=None, etud_nom=None, limit=50, offset="", format="html"): if offset: webparams["offset"] = max((offset or 0) - limit, 0) prev_lnk = 'précédentes' % ( - REQUEST.URL0 + "?" + six.moves.urllib.parse.urlencode(webparams) + request.base_url + "?" + six.moves.urllib.parse.urlencode(webparams) ) else: prev_lnk = "" if len(entreprises) >= limit: webparams["offset"] = (offset or 0) + limit next_lnk = 'suivantes' % ( - REQUEST.URL0 + "?" + six.moves.urllib.parse.urlencode(webparams) + request.base_url + "?" + six.moves.urllib.parse.urlencode(webparams) ) else: next_lnk = "" @@ -220,7 +222,7 @@ def index_html(REQUEST=None, etud_nom=None, limit=50, offset="", format="html"): html_class="entreprise_list table_leftalign", html_with_td_classes=True, html_next_section=table_navigation, - base_url=REQUEST.URL0 + "?", + base_url=request.base_url + "?", preferences=context.get_preferences(), ) if format != "html": @@ -293,7 +295,7 @@ def entreprise_contact_list(entreprise_id=None, format="html", REQUEST=None): html_sortable=True, html_class="contact_list table_leftalign", html_with_td_classes=True, - base_url=REQUEST.URL0 + "?", + base_url=request.base_url + "?", preferences=context.get_preferences(), ) if format != "html": @@ -399,7 +401,7 @@ def entreprise_correspondant_list( html_sortable=True, html_class="contact_list table_leftalign", html_with_td_classes=True, - base_url=REQUEST.URL0 + "?", + base_url=request.base_url + "?", preferences=context.get_preferences(), ) if format != "html": @@ -444,7 +446,7 @@ def entreprise_contact_edit(entreprise_contact_id, REQUEST=None): % E, ] tf = TrivialFormulator( - REQUEST.URL0, + request.base_url, REQUEST.form, ( ( @@ -560,7 +562,7 @@ def entreprise_correspondant_edit(entreprise_corresp_id, REQUEST=None): """

Édition contact entreprise

""", ] tf = TrivialFormulator( - REQUEST.URL0, + request.base_url, REQUEST.form, ( ( @@ -684,7 +686,7 @@ def entreprise_contact_create(entreprise_id, REQUEST=None): % E, ] tf = TrivialFormulator( - REQUEST.URL0, + request.base_url, REQUEST.form, ( ("entreprise_id", {"input_type": "hidden", "default": entreprise_id}), @@ -783,7 +785,7 @@ def entreprise_contact_delete(entreprise_contact_id, REQUEST=None): """

Suppression du contact

""", ] tf = TrivialFormulator( - REQUEST.URL0, + request.base_url, REQUEST.form, (("entreprise_contact_id", {"input_type": "hidden"}),), initvalues=c, @@ -814,7 +816,7 @@ def entreprise_correspondant_create(entreprise_id, REQUEST=None): % E, ] tf = TrivialFormulator( - REQUEST.URL0, + request.base_url, REQUEST.form, ( ("entreprise_id", {"input_type": "hidden", "default": entreprise_id}), @@ -920,7 +922,7 @@ def entreprise_correspondant_delete(entreprise_corresp_id, REQUEST=None): """

Suppression du correspondant %(nom)s %(prenom)s

""" % c, ] tf = TrivialFormulator( - REQUEST.URL0, + request.base_url, REQUEST.form, (("entreprise_corresp_id", {"input_type": "hidden"}),), initvalues=c, @@ -976,7 +978,7 @@ def entreprise_delete(entreprise_id, REQUEST=None): H.append("""
  • %(date)s %(description)s
  • """ % c) H.append("""""") tf = TrivialFormulator( - REQUEST.URL0, + request.base_url, REQUEST.form, (("entreprise_id", {"input_type": "hidden"}),), initvalues=E, @@ -1008,7 +1010,7 @@ def entreprise_create(REQUEST=None): """

    Création d'une entreprise

    """, ] tf = TrivialFormulator( - REQUEST.URL0, + request.base_url, REQUEST.form, ( ("nom", {"size": 25, "title": "Nom de l'entreprise"}), @@ -1105,7 +1107,7 @@ def entreprise_edit(entreprise_id, REQUEST=None, start=1): """

    %(nom)s

    """ % F, ] tf = TrivialFormulator( - REQUEST.URL0, + request.base_url, REQUEST.form, ( ("entreprise_id", {"default": entreprise_id, "input_type": "hidden"}), diff --git a/app/views/notes.py b/app/views/notes.py index be4205c5..c4b052bf 100644 --- a/app/views/notes.py +++ b/app/views/notes.py @@ -38,8 +38,8 @@ from operator import itemgetter from xml.etree import ElementTree import flask -from flask import url_for, g -from flask import current_app +from flask import url_for +from flask import current_app, g, request from flask_login import current_user from config import Config @@ -501,7 +501,7 @@ def formation_import_xml_form(REQUEST): ] footer = html_sco_header.sco_footer() tf = TrivialFormulator( - REQUEST.URL0, + request.base_url, REQUEST.form, (("xmlfile", {"input_type": "file", "title": "Fichier XML", "size": 30}),), submitlabel="Importer", @@ -637,7 +637,7 @@ def XMLgetFormsemestres(etape_apo=None, formsemestre_id=None, REQUEST=None): """List all formsemestres matching etape, XML format DEPRECATED: use formsemestre_list() """ - log("Warning: calling deprecated XMLgetFormsemestres") + current_app.logger.debug("Warning: calling deprecated XMLgetFormsemestres") args = {} if etape_apo: args["etape_apo"] = etape_apo @@ -778,7 +778,7 @@ def edit_enseignants_form(REQUEST, moduleimpl_id): ), ] tf = TrivialFormulator( - REQUEST.URL0, + request.base_url, REQUEST.form, modform, submitlabel="Ajouter enseignant", @@ -875,7 +875,7 @@ def edit_moduleimpl_resp(REQUEST, moduleimpl_id): ), ] tf = TrivialFormulator( - REQUEST.URL0, + request.base_url, REQUEST.form, form, submitlabel="Changer responsable", @@ -979,7 +979,7 @@ def edit_moduleimpl_expr(REQUEST, moduleimpl_id): ), ] tf = TrivialFormulator( - REQUEST.URL0, + request.base_url, REQUEST.form, form, submitlabel="Modifier formule de calcul", @@ -1083,7 +1083,7 @@ def view_module_abs(REQUEST, moduleimpl_id, format="html"): columns_ids=("nomprenom", "just", "nojust", "total"), rows=T, html_class="table_leftalign", - base_url="%s?moduleimpl_id=%s" % (REQUEST.URL0, moduleimpl_id), + base_url="%s?moduleimpl_id=%s" % (request.base_url, moduleimpl_id), filename="absmodule_" + scu.make_filename(M["module"]["titre"]), caption="Absences dans le module %s" % M["module"]["titre"], preferences=sco_preferences.SemPreferences(), @@ -1139,7 +1139,7 @@ def edit_ue_expr(REQUEST, formsemestre_id, ue_id): ), ] tf = TrivialFormulator( - REQUEST.URL0, + request.base_url, REQUEST.form, form, submitlabel="Modifier formule de calcul", @@ -1253,7 +1253,7 @@ def formsemestre_enseignants_list(REQUEST, formsemestre_id, format="html"): html_title=html_sco_header.html_sem_header( REQUEST, "Enseignants du semestre", sem, with_page_header=False ), - base_url="%s?formsemestre_id=%s" % (REQUEST.URL0, formsemestre_id), + base_url="%s?formsemestre_id=%s" % (request.base_url, formsemestre_id), caption="Tous les enseignants (responsables ou associés aux modules de ce semestre) apparaissent. Le nombre de saisies d'absences est le nombre d'opérations d'ajout effectuées sur ce semestre, sans tenir compte des annulations ou double saisies.", preferences=sco_preferences.SemPreferences(formsemestre_id), ) @@ -1538,7 +1538,7 @@ def evaluation_delete(REQUEST, evaluation_id): H.append("""""") tf = TrivialFormulator( - REQUEST.URL0, + request.base_url, REQUEST.form, (("evaluation_id", {"input_type": "hidden"}),), initvalues=E, @@ -1776,7 +1776,7 @@ def formsemestre_bulletins_choice(
    """ - % (REQUEST.URL0, formsemestre_id), + % (request.base_url, formsemestre_id), ] H.append("""