Merge remote-tracking branch 'origin/master' into scodoc9_placement_PR

# Conflicts:
#	app/scodoc/sco_groups_view.py
#	app/scodoc/sco_placement.py
This commit is contained in:
Jean-Marie Place 2021-09-18 10:39:53 +02:00
commit 80f5536de5
54 changed files with 288 additions and 194 deletions

View File

@ -46,15 +46,15 @@ class ZRequest(object):
# if current_app.config["DEBUG"]: # if current_app.config["DEBUG"]:
# le ReverseProxied se charge maintenant de mettre le bon protocole http ou https # le ReverseProxied se charge maintenant de mettre le bon protocole http ou https
self.URL = request.base_url # self.URL = request.base_url
self.BASE0 = request.url_root # self.BASE0 = request.url_root
# else: # else:
# self.URL = request.base_url.replace("http://", "https://") # self.URL = request.base_url.replace("http://", "https://")
# self.BASE0 = request.url_root.replace("http://", "https://") # self.BASE0 = request.url_root.replace("http://", "https://")
self.URL0 = self.URL # self.URL0 = self.URL
# query_string is bytes: # query_string is bytes:
self.QUERY_STRING = request.query_string.decode("utf-8") # self.QUERY_STRING = request.query_string.decode("utf-8")
self.REQUEST_METHOD = request.method # self.REQUEST_METHOD = request.method
self.AUTHENTICATED_USER = current_user self.AUTHENTICATED_USER = current_user
self.REMOTE_ADDR = request.remote_addr self.REMOTE_ADDR = request.remote_addr
if request.method == "POST": if request.method == "POST":
@ -79,11 +79,7 @@ class ZRequest(object):
self.RESPONSE = ZResponse() self.RESPONSE = ZResponse()
def __str__(self): def __str__(self):
return """REQUEST return """ZREQUEST
URL={r.URL}
QUERY_STRING={r.QUERY_STRING}
REQUEST_METHOD={r.REQUEST_METHOD}
AUTHENTICATED_USER={r.AUTHENTICATED_USER}
form={r.form} form={r.form}
""".format( """.format(
r=self r=self

View File

@ -30,7 +30,7 @@
""" """
import datetime import datetime
from flask import url_for, g from flask import url_for, g, request
import app.scodoc.sco_utils as scu import app.scodoc.sco_utils as scu
from app.scodoc import notesdb as ndb from app.scodoc import notesdb as ndb
@ -814,8 +814,8 @@ def ListeAbsEtud(
etudid, datedebut, with_evals=with_evals, format=format etudid, datedebut, with_evals=with_evals, format=format
) )
if REQUEST: if REQUEST:
base_url_nj = "%s?etudid=%s&absjust_only=0" % (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.URL0, etudid) base_url_j = "%s?etudid=%s&absjust_only=1" % (request.base_url, etudid)
else: else:
base_url_nj = base_url_j = "" base_url_nj = base_url_j = ""
tab_absnonjust = GenTable( tab_absnonjust = GenTable(

View File

@ -29,19 +29,19 @@
Archives are plain files, stored in Archives are plain files, stored in
<SCODOC_VAR_DIR>/archives/<deptid> <SCODOC_VAR_DIR>/archives/<dept_id>
(where <SCODOC_VAR_DIR> is usually /opt/scodoc-data, and <deptid> a departement id) (where <SCODOC_VAR_DIR> is usually /opt/scodoc-data, and <dept_id> a departement id (int))
Les PV de jurys et documents associés sont stockées dans un sous-repertoire de la forme Les PV de jurys et documents associés sont stockées dans un sous-repertoire de la forme
<archivedir>/<dept>/<formsemestre_id>/<YYYY-MM-DD-HH-MM-SS> <archivedir>/<dept>/<formsemestre_id>/<YYYY-MM-DD-HH-MM-SS>
(formsemestre_id est ici FormSemestre.id) (formsemestre_id est ici FormSemestre.id)
Les documents liés à l'étudiant sont dans Les documents liés à l'étudiant sont dans
<archivedir>/docetuds/<dept>/<etudid>/<YYYY-MM-DD-HH-MM-SS> <archivedir>/docetuds/<dept_id>/<etudid>/<YYYY-MM-DD-HH-MM-SS>
(etudid est ici Identite.id) (etudid est ici Identite.id)
Les maquettes Apogée pour l'export des notes sont dans Les maquettes Apogée pour l'export des notes sont dans
<archivedir>/apo_csv/<dept>/<annee_scolaire>-<sem_id>/<YYYY-MM-DD-HH-MM-SS>/<code_etape>.csv <archivedir>/apo_csv/<dept_id>/<annee_scolaire>-<sem_id>/<YYYY-MM-DD-HH-MM-SS>/<code_etape>.csv
Un répertoire d'archive contient des fichiers quelconques, et un fichier texte nommé _description.txt 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. qui est une description (humaine, format libre) de l'archive.
@ -56,11 +56,12 @@ import shutil
import time import time
import flask import flask
from flask import g from flask import g, request
import app.scodoc.sco_utils as scu import app.scodoc.sco_utils as scu
from config import Config from config import Config
from app import log from app import log
from app.models import Departement
from app.scodoc.TrivialFormulator import TrivialFormulator from app.scodoc.TrivialFormulator import TrivialFormulator
from app.scodoc.sco_exceptions import ( from app.scodoc.sco_exceptions import (
AccessDenied, AccessDenied,
@ -109,7 +110,8 @@ class BaseArchiver(object):
If directory does not yet exist, create it. If directory does not yet exist, create it.
""" """
self.initialize() 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: try:
scu.GSL.acquire() scu.GSL.acquire()
if not os.path.isdir(dept_dir): if not os.path.isdir(dept_dir):
@ -128,7 +130,8 @@ class BaseArchiver(object):
:return: list of archive oids :return: list of archive oids
""" """
self.initialize() 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 + "*") dirs = glob.glob(base + "*")
return [os.path.split(x)[1] for x in dirs] 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( tf = TrivialFormulator(
REQUEST.URL0, request.base_url,
REQUEST.form, REQUEST.form,
descr, descr,
cancelbutton="Annuler", cancelbutton="Annuler",

View File

@ -30,7 +30,7 @@
les dossiers d'admission et autres pièces utiles. les dossiers d'admission et autres pièces utiles.
""" """
import flask 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.sco_utils as scu
from app.scodoc import sco_import_etuds 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)), % (scu.CONFIG.ETUD_MAX_FILE_SIZE // (1024 * 1024)),
] ]
tf = TrivialFormulator( tf = TrivialFormulator(
REQUEST.URL0, request.base_url,
REQUEST.form, REQUEST.form,
( (
("etudid", {"default": etudid, "input_type": "hidden"}), ("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() F = html_sco_header.sco_footer()
tf = TrivialFormulator( tf = TrivialFormulator(
REQUEST.URL0, request.base_url,
REQUEST.form, REQUEST.form,
( (
("xlsfile", {"title": "Fichier Excel:", "input_type": "file", "size": 40}), ("xlsfile", {"title": "Fichier Excel:", "input_type": "file", "size": 40}),

View File

@ -28,6 +28,7 @@
"""Génération des bulletins de notes """Génération des bulletins de notes
""" """
from app.models import formsemestre
import time import time
import pprint import pprint
import email import email
@ -38,7 +39,7 @@ from email.header import Header
from reportlab.lib.colors import Color from reportlab.lib.colors import Color
import urllib import urllib
from flask import g from flask import g, request
from flask import url_for from flask import url_for
from flask_login import current_user from flask_login import current_user
from flask_mail import Message from flask_mail import Message
@ -143,7 +144,7 @@ def formsemestre_bulletinetud_dict(
I["formsemestre_id"] = formsemestre_id I["formsemestre_id"] = formsemestre_id
I["sem"] = nt.sem I["sem"] = nt.sem
if REQUEST: if REQUEST:
I["server_name"] = REQUEST.BASE0 I["server_name"] = request.url_root
else: else:
I["server_name"] = "" I["server_name"] = ""
@ -1032,7 +1033,7 @@ def _formsemestre_bulletinetud_header_html(
), ),
""" """
<form name="f" method="GET" action="%s">""" <form name="f" method="GET" action="%s">"""
% REQUEST.URL0, % request.base_url,
f"""Bulletin <span class="bull_liensemestre"><a href="{ f"""Bulletin <span class="bull_liensemestre"><a href="{
url_for("notes.formsemestre_status", url_for("notes.formsemestre_status",
scodoc_dept=g.scodoc_dept, scodoc_dept=g.scodoc_dept,
@ -1062,14 +1063,20 @@ def _formsemestre_bulletinetud_header_html(
H.append("""</select></td>""") H.append("""</select></td>""")
# Menu # Menu
endpoint = "notes.formsemestre_bulletinetud" endpoint = "notes.formsemestre_bulletinetud"
url = REQUEST.URL0
qurl = urllib.parse.quote_plus(url + "?" + REQUEST.QUERY_STRING)
menuBul = [ menuBul = [
{ {
"title": "Réglages bulletins", "title": "Réglages bulletins",
"endpoint": "notes.formsemestre_edit_options", "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"]) "enabled": (current_user.id in sem["responsables"])
or current_user.has_permission(Permission.ScoImplement), or current_user.has_permission(Permission.ScoImplement),
}, },
@ -1187,9 +1194,14 @@ def _formsemestre_bulletinetud_header_html(
H.append( H.append(
'<td> <a href="%s">%s</a></td>' '<td> <a href="%s">%s</a></td>'
% ( % (
url url_for(
+ "?formsemestre_id=%s&etudid=%s&format=pdf&version=%s" "notes.formsemestre_bulletinetud",
% (formsemestre_id, etudid, version), scodoc_dept=g.scodoc_dept,
formsemestre_id=formsemestre_id,
etudid=etudid,
format="pdf",
version=version,
),
scu.ICON_PDF, scu.ICON_PDF,
) )
) )

View File

@ -52,6 +52,8 @@ import reportlab
from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Frame, PageBreak from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Frame, PageBreak
from reportlab.platypus import Table, TableStyle, Image, KeepInFrame from reportlab.platypus import Table, TableStyle, Image, KeepInFrame
from flask import request
from app.scodoc import sco_utils as scu from app.scodoc import sco_utils as scu
from app.scodoc.sco_exceptions import NoteProcessError from app.scodoc.sco_exceptions import NoteProcessError
from app import log from app import log
@ -289,7 +291,7 @@ def make_formsemestre_bulletinetud(
authuser=REQUEST.AUTHENTICATED_USER, authuser=REQUEST.AUTHENTICATED_USER,
version=version, version=version,
filigranne=infos["filigranne"], filigranne=infos["filigranne"],
server_name=REQUEST.BASE0, server_name=request.url_root,
) )
if format not in bul_generator.supported_formats: if format not in bul_generator.supported_formats:
# use standard generator # use standard generator
@ -304,7 +306,7 @@ def make_formsemestre_bulletinetud(
authuser=REQUEST.AUTHENTICATED_USER, authuser=REQUEST.AUTHENTICATED_USER,
version=version, version=version,
filigranne=infos["filigranne"], filigranne=infos["filigranne"],
server_name=REQUEST.BASE0, server_name=request.url_root,
) )
data = bul_generator.generate(format=format, stand_alone=stand_alone) data = bul_generator.generate(format=format, stand_alone=stand_alone)

View File

@ -58,7 +58,7 @@ import traceback
from reportlab.platypus.doctemplate import PageTemplate, BaseDocTemplate 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 import app.scodoc.sco_utils as scu
from app import log 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)} infos = {"DeptName": sco_preferences.get_preference("DeptName", formsemestre_id)}
if REQUEST: if REQUEST:
server_name = REQUEST.BASE0 server_name = request.url_root
else: else:
server_name = "" server_name = ""
try: try:
@ -243,7 +243,7 @@ def get_etud_bulletins_pdf(etudid, REQUEST, version="selectedevals"):
i = i + 1 i = i + 1
infos = {"DeptName": sco_preferences.get_preference("DeptName")} infos = {"DeptName": sco_preferences.get_preference("DeptName")}
if REQUEST: if REQUEST:
server_name = REQUEST.BASE0 server_name = request.url_root
else: else:
server_name = "" server_name = ""
try: try:

View File

@ -30,6 +30,8 @@
(coût théorique en heures équivalent TD) (coût théorique en heures équivalent TD)
""" """
from flask import request
import app.scodoc.sco_utils as scu import app.scodoc.sco_utils as scu
from app.scodoc.gen_tables import GenTable from app.scodoc.gen_tables import GenTable
from app.scodoc import sco_formsemestre from app.scodoc import sco_formsemestre
@ -182,7 +184,7 @@ def formsemestre_estim_cost(
<br/> <br/>
</form> </form>
""" % ( """ % (
REQUEST.URL0, request.base_url,
formsemestre_id, formsemestre_id,
n_group_td, n_group_td,
n_group_tp, n_group_tp,
@ -190,7 +192,7 @@ def formsemestre_estim_cost(
) )
tab.html_before_table = h tab.html_before_table = h
tab.base_url = "%s?formsemestre_id=%s&n_group_td=%s&n_group_tp=%s&coef_tp=%s" % ( 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, formsemestre_id,
n_group_td, n_group_td,
n_group_tp, n_group_tp,

View File

@ -29,7 +29,7 @@
Rapport (table) avec dernier semestre fréquenté et débouché de chaque étudiant Rapport (table) avec dernier semestre fréquenté et débouché de chaque étudiant
""" """
import http 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.sco_utils as scu
import app.scodoc.notesdb as ndb 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() + "" "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.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( return tab.make_page(
title="""<h2 class="formsemestre">Débouchés étudiants </h2>""", title="""<h2 class="formsemestre">Débouchés étudiants </h2>""",
init_qtip=True, init_qtip=True,

View File

@ -28,7 +28,7 @@
"""Page accueil département (liste des semestres, etc) """Page accueil département (liste des semestres, etc)
""" """
from flask import g from flask import g, request
from flask_login import current_user from flask_login import current_user
import app import app
@ -131,7 +131,7 @@ def index_html(REQUEST=None, showcodes=0, showsemtable=0):
if not showsemtable: if not showsemtable:
H.append( H.append(
'<hr/><p><a href="%s?showsemtable=1">Voir tous les semestres</a></p>' '<hr/><p><a href="%s?showsemtable=1">Voir tous les semestres</a></p>'
% REQUEST.URL0 % request.base_url
) )
H.append( H.append(
@ -242,7 +242,7 @@ def _sem_table_gt(sems, showcodes=False):
rows=sems, rows=sems,
html_class="table_leftalign semlist", html_class="table_leftalign semlist",
html_sortable=True, 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', # caption='Maquettes enregistrées',
preferences=sco_preferences.SemPreferences(), preferences=sco_preferences.SemPreferences(),
) )

View File

@ -29,7 +29,7 @@
(portage from DTML) (portage from DTML)
""" """
import flask import flask
from flask import g, url_for from flask import g, url_for, request
import app.scodoc.notesdb as ndb import app.scodoc.notesdb as ndb
import app.scodoc.sco_utils as scu import app.scodoc.sco_utils as scu
@ -159,7 +159,7 @@ def formation_edit(formation_id=None, create=False, REQUEST=None):
) )
tf = TrivialFormulator( tf = TrivialFormulator(
REQUEST.URL0, request.base_url,
REQUEST.form, REQUEST.form,
( (
("formation_id", {"default": formation_id, "input_type": "hidden"}), ("formation_id", {"default": formation_id, "input_type": "hidden"}),

View File

@ -29,7 +29,7 @@
(portage from DTML) (portage from DTML)
""" """
import flask import flask
from flask import g, url_for from flask import g, url_for, request
import app.scodoc.notesdb as ndb import app.scodoc.notesdb as ndb
import app.scodoc.sco_utils as scu import app.scodoc.sco_utils as scu
@ -116,7 +116,7 @@ associé.
</p>""", </p>""",
] ]
tf = TrivialFormulator( tf = TrivialFormulator(
REQUEST.URL0, request.base_url,
REQUEST.form, REQUEST.form,
( (
("ue_id", {"input_type": "hidden", "default": ue_id}), ("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"]) dest_url = scu.NotesURL() + "/ue_list?formation_id=" + str(UE["formation_id"])
tf = TrivialFormulator( tf = TrivialFormulator(
REQUEST.URL0, request.base_url,
REQUEST.form, REQUEST.form,
(("matiere_id", {"input_type": "hidden"}),), (("matiere_id", {"input_type": "hidden"}),),
initvalues=M, initvalues=M,
@ -256,7 +256,7 @@ des notes.</em>
associé. associé.
</p>""" </p>"""
tf = TrivialFormulator( tf = TrivialFormulator(
REQUEST.URL0, request.base_url,
REQUEST.form, REQUEST.form,
( (
("matiere_id", {"input_type": "hidden"}), ("matiere_id", {"input_type": "hidden"}),
@ -323,4 +323,4 @@ def matiere_is_locked(matiere_id):
""", """,
{"matiere_id": matiere_id}, {"matiere_id": matiere_id},
) )
return len(r) > 0 return len(r) > 0

View File

@ -29,7 +29,7 @@
(portage from DTML) (portage from DTML)
""" """
import flask import flask
from flask import url_for, g from flask import url_for, g, request
import app.scodoc.notesdb as ndb import app.scodoc.notesdb as ndb
import app.scodoc.sco_utils as scu import app.scodoc.sco_utils as scu
@ -143,7 +143,7 @@ def module_create(matiere_id=None, REQUEST=None):
else: else:
default_num = 10 default_num = 10
tf = TrivialFormulator( tf = TrivialFormulator(
REQUEST.URL0, request.base_url,
REQUEST.form, 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"]) dest_url = scu.NotesURL() + "/ue_list?formation_id=" + str(Mod["formation_id"])
tf = TrivialFormulator( tf = TrivialFormulator(
REQUEST.URL0, request.base_url,
REQUEST.form, REQUEST.form,
(("module_id", {"input_type": "hidden"}),), (("module_id", {"input_type": "hidden"}),),
initvalues=Mod, initvalues=Mod,
@ -388,7 +388,7 @@ def module_edit(module_id=None, REQUEST=None):
) )
tf = TrivialFormulator( tf = TrivialFormulator(
REQUEST.URL0, request.base_url,
REQUEST.form, REQUEST.form,
( (
( (

View File

@ -29,7 +29,7 @@
""" """
import flask import flask
from flask import g, url_for from flask import g, url_for, request
from flask_login import current_user from flask_login import current_user
import app.scodoc.notesdb as ndb 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( 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: if tf[0] == 0:
X = """<div id="ue_list_code"></div> X = """<div id="ue_list_code"></div>
@ -1033,7 +1037,7 @@ def formation_table_recap(formation_id, format="html", REQUEST=None):
caption=title, caption=title,
html_caption=title, html_caption=title,
html_class="table_leftalign", 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, page_title=title,
html_title="<h2>" + title + "</h2>", html_title="<h2>" + title + "</h2>",
pdf_title=title, pdf_title=title,

View File

@ -32,11 +32,11 @@
Voir sco_apogee_csv.py pour la structure du fichier Apogée. Voir sco_apogee_csv.py pour la structure du fichier Apogée.
Stockage: utilise sco_archive.py 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/<dept_id>/2016-1/2016-07-03-16-12-19/V3ASR.csv
pour une maquette de l'année scolaire 2016, semestre 1, etape V3ASR pour une maquette de l'année scolaire 2016, semestre 1, etape V3ASR
ou bien (à partir de ScoDoc 1678) : 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/<dept_id>/2016-1/2016-07-03-16-12-19/V3ASR!111.csv
pour une maquette de l'étape V3ASR version VDI 111. 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. La version VDI sera ignorée sauf si elle est indiquée dans l'étape du semestre.

View File

@ -32,7 +32,7 @@ import io
from zipfile import ZipFile from zipfile import ZipFile
import flask 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 # from werkzeug.utils import send_file
@ -250,7 +250,7 @@ def apo_semset_maq_status(
"""<form name="f" method="get" action="%s"> """<form name="f" method="get" action="%s">
<input type="hidden" name="semset_id" value="%s"></input> <input type="hidden" name="semset_id" value="%s"></input>
<div><input type="checkbox" name="allow_missing_apo" value="1" onchange="document.f.submit()" """ <div><input type="checkbox" name="allow_missing_apo" value="1" onchange="document.f.submit()" """
% (REQUEST.URL0, semset_id) % (request.base_url, semset_id)
) )
if allow_missing_apo: if allow_missing_apo:
H.append("checked") H.append("checked")
@ -476,7 +476,7 @@ def table_apo_csv_list(semset, REQUEST=None):
rows=T, rows=T,
html_class="table_leftalign apo_maq_list", html_class="table_leftalign apo_maq_list",
html_sortable=True, 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', # caption='Maquettes enregistrées',
preferences=sco_preferences.SemPreferences(), preferences=sco_preferences.SemPreferences(),
) )
@ -747,7 +747,8 @@ def view_apo_csv(etape_apo="", semset_id="", format="html", REQUEST=None):
rows=etuds, rows=etuds,
html_sortable=True, html_sortable=True,
html_class="table_leftalign apo_maq_table", html_class="table_leftalign apo_maq_table",
base_url="%s?etape_apo=%s&semset_id=%s" % (REQUEST.URL0, etape_apo, semset_id), base_url="%s?etape_apo=%s&semset_id=%s"
% (request.base_url, etape_apo, semset_id),
filename="students_" + etape_apo, filename="students_" + etape_apo,
caption="Etudiants Apogée en " + etape_apo, caption="Etudiants Apogée en " + etape_apo,
preferences=sco_preferences.SemPreferences(), preferences=sco_preferences.SemPreferences(),

View File

@ -915,7 +915,7 @@ def formsemestre_evaluations_delai_correction(
html_title="<h2>Correction des évaluations du semestre</h2>", html_title="<h2>Correction des évaluations du semestre</h2>",
caption="Correction des évaluations du semestre", caption="Correction des évaluations du semestre",
preferences=sco_preferences.SemPreferences(formsemestre_id), 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 origin="Généré par %s le " % sco_version.SCONAME
+ scu.timedate_human_repr() + scu.timedate_human_repr()
+ "", + "",
@ -1346,7 +1346,7 @@ def evaluation_create_form(
), ),
] ]
tf = TrivialFormulator( tf = TrivialFormulator(
REQUEST.URL0, request.base_url,
REQUEST.form, REQUEST.form,
form, form,
cancelbutton="Annuler", cancelbutton="Annuler",

View File

@ -27,7 +27,7 @@
"""Export d'une table avec les résultats de tous les étudiants """Export d'une table avec les résultats de tous les étudiants
""" """
from flask import url_for, g from flask import url_for, g, request
import app.scodoc.notesdb as ndb import app.scodoc.notesdb as ndb
import app.scodoc.sco_utils as scu import app.scodoc.sco_utils as scu
@ -240,7 +240,7 @@ def scodoc_table_results(
start_date_iso, end_date_iso, types_parcours start_date_iso, end_date_iso, types_parcours
) )
tab.base_url = "%s?start_date=%s&end_date=%s&types_parcours=%s" % ( tab.base_url = "%s?start_date=%s&end_date=%s&types_parcours=%s" % (
REQUEST.URL0, request.base_url,
start_date, start_date,
end_date, end_date,
"&types_parcours=".join([str(x) for x in types_parcours]), "&types_parcours=".join([str(x) for x in types_parcours]),

View File

@ -31,7 +31,7 @@ from operator import itemgetter
import xml.dom.minidom import xml.dom.minidom
import flask 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.sco_utils as scu
@ -347,7 +347,7 @@ def formation_list_table(formation_id=None, args={}, REQUEST=None):
html_class="formation_list_table table_leftalign", html_class="formation_list_table table_leftalign",
html_with_td_classes=True, html_with_td_classes=True,
html_sortable=True, html_sortable=True,
base_url="%s?formation_id=%s" % (REQUEST.URL0, formation_id), base_url="%s?formation_id=%s" % (request.base_url, formation_id),
page_title=title, page_title=title,
pdf_title=title, pdf_title=title,
preferences=sco_preferences.SemPreferences(), preferences=sco_preferences.SemPreferences(),

View File

@ -31,7 +31,7 @@ from app.scodoc.sco_exceptions import ScoValueError
import time import time
from operator import itemgetter from operator import itemgetter
from flask import g from flask import g, request
import app import app
from app.models import Departement from app.models import Departement
@ -583,7 +583,7 @@ def view_formsemestre_by_etape(etape_apo=None, format="html", REQUEST=None):
Etape: <input name="etape_apo" type="text" size="8"></input> Etape: <input name="etape_apo" type="text" size="8"></input>
</form>""", </form>""",
) )
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) return tab.make_page(format=format)

View File

@ -28,7 +28,7 @@
"""Menu "custom" (défini par l'utilisateur) dans les semestres """Menu "custom" (défini par l'utilisateur) dans les semestres
""" """
import flask 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.sco_utils as scu
import app.scodoc.notesdb as ndb 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["title_" + str(item["custommenu_id"])] = item["title"]
initvalues["url_" + str(item["custommenu_id"])] = item["url"] initvalues["url_" + str(item["custommenu_id"])] = item["url"]
tf = TrivialFormulator( tf = TrivialFormulator(
REQUEST.URL0, request.base_url,
REQUEST.form, REQUEST.form,
descr, descr,
initvalues=initvalues, initvalues=initvalues,

View File

@ -28,7 +28,7 @@
"""Form choix modules / responsables et creation formsemestre """Form choix modules / responsables et creation formsemestre
""" """
import flask import flask
from flask import url_for, g from flask import url_for, g, request
from flask_login import current_user from flask_login import current_user
from app.auth.models import User from app.auth.models import User
@ -661,7 +661,7 @@ def do_formsemestre_createwithmodules(REQUEST=None, edit=False):
# #
tf = TrivialFormulator( tf = TrivialFormulator(
REQUEST.URL0, request.base_url,
REQUEST.form, REQUEST.form,
modform, modform,
submitlabel=submitlabel, submitlabel=submitlabel,
@ -966,7 +966,7 @@ def formsemestre_clone(formsemestre_id, REQUEST=None):
), ),
] ]
tf = TrivialFormulator( tf = TrivialFormulator(
REQUEST.URL0, request.base_url,
REQUEST.form, REQUEST.form,
descr, descr,
submitlabel="Dupliquer ce semestre", submitlabel="Dupliquer ce semestre",
@ -1268,7 +1268,7 @@ def formsemestre_delete(formsemestre_id, REQUEST=None):
else: else:
submit_label = "Confirmer la suppression du semestre" submit_label = "Confirmer la suppression du semestre"
tf = TrivialFormulator( tf = TrivialFormulator(
REQUEST.URL0, request.base_url,
REQUEST.form, REQUEST.form,
(("formsemestre_id", {"input_type": "hidden"}),), (("formsemestre_id", {"input_type": "hidden"}),),
initvalues=F, 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 """dialog to change formsemestre options
(accessible par ScoImplement ou dir. etudes) (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)) form.append(("ue_" + str(ue["ue_id"]), descr))
tf = TrivialFormulator( tf = TrivialFormulator(
REQUEST.URL0, request.base_url,
REQUEST.form, REQUEST.form,
form, form,
submitlabel="Changer les coefficients", submitlabel="Changer les coefficients",

View File

@ -34,7 +34,7 @@ Ces semestres n'auront qu'un seul inscrit !
import time import time
import flask import flask
from flask import url_for, g from flask import url_for, g, request
from flask_login import current_user from flask_login import current_user
import app.scodoc.sco_utils as scu import app.scodoc.sco_utils as scu
@ -181,7 +181,7 @@ def formsemestre_ext_create_form(etudid, formsemestre_id, REQUEST=None):
] ]
tf = TrivialFormulator( tf = TrivialFormulator(
REQUEST.URL0, request.base_url,
REQUEST.form, REQUEST.form,
descr, descr,
cancelbutton="Annuler", cancelbutton="Annuler",
@ -231,7 +231,7 @@ def formsemestre_ext_edit_ue_validations(formsemestre_id, etudid, REQUEST=None):
else: else:
initvalues = {} initvalues = {}
tf = TrivialFormulator( tf = TrivialFormulator(
REQUEST.URL0, request.base_url,
REQUEST.form, REQUEST.form,
descr, descr,
cssclass="tf_ext_edit_ue_validations", cssclass="tf_ext_edit_ue_validations",

View File

@ -30,7 +30,7 @@
import time import time
import flask 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.sco_utils as scu
from app import log from app import log
@ -415,7 +415,7 @@ def formsemestre_inscription_with_modules(
<input type="hidden" name="etudid" value="%s"> <input type="hidden" name="etudid" value="%s">
<input type="hidden" name="formsemestre_id" value="%s"> <input type="hidden" name="formsemestre_id" value="%s">
""" """
% (REQUEST.URL0, etudid, formsemestre_id) % (request.base_url, etudid, formsemestre_id)
) )
H.append(sco_groups.form_group_choice(formsemestre_id, allow_none=True)) H.append(sco_groups.form_group_choice(formsemestre_id, allow_none=True))
@ -533,7 +533,7 @@ function chkbx_select(field_id, state) {
""" """
) )
tf = TrivialFormulator( tf = TrivialFormulator(
REQUEST.URL0, request.base_url,
REQUEST.form, REQUEST.form,
descr, descr,
initvalues, initvalues,

View File

@ -698,7 +698,7 @@ def formsemestre_description_table(formsemestre_id, REQUEST=None, with_evals=Fal
html_caption=title, html_caption=title,
html_class="table_leftalign formsemestre_description", html_class="table_leftalign formsemestre_description",
base_url="%s?formsemestre_id=%s&with_evals=%s" 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, page_title=title,
html_title=html_sco_header.html_sem_header( html_title=html_sco_header.html_sem_header(
REQUEST, "Description du semestre", sem, with_page_header=False REQUEST, "Description du semestre", sem, with_page_header=False
@ -721,7 +721,7 @@ def formsemestre_description(
tab.html_before_table = """<form name="f" method="get" action="%s"> tab.html_before_table = """<form name="f" method="get" action="%s">
<input type="hidden" name="formsemestre_id" value="%s"></input> <input type="hidden" name="formsemestre_id" value="%s"></input>
<input type="checkbox" name="with_evals" value="1" onchange="document.f.submit()" """ % ( <input type="checkbox" name="with_evals" value="1" onchange="document.f.submit()" """ % (
REQUEST.URL0, request.base_url,
formsemestre_id, formsemestre_id,
) )
if with_evals: if with_evals:

View File

@ -30,7 +30,7 @@
import six.moves.urllib.request, six.moves.urllib.parse, six.moves.urllib.error, time, datetime import six.moves.urllib.request, six.moves.urllib.parse, six.moves.urllib.error, time, datetime
import flask import flask
from flask import url_for, g from flask import url_for, g, request
import app.scodoc.notesdb as ndb import app.scodoc.notesdb as ndb
import app.scodoc.sco_utils as scu import app.scodoc.sco_utils as scu
@ -1017,7 +1017,7 @@ def formsemestre_validate_previous_ue(formsemestre_id, etudid, REQUEST=None):
ue_names = ["Choisir..."] + ["%(acronyme)s %(titre)s" % ue for ue in ues] ue_names = ["Choisir..."] + ["%(acronyme)s %(titre)s" % ue for ue in ues]
ue_ids = [""] + [ue["ue_id"] for ue in ues] ue_ids = [""] + [ue["ue_id"] for ue in ues]
tf = TrivialFormulator( tf = TrivialFormulator(
REQUEST.URL0, request.base_url,
REQUEST.form, REQUEST.form,
( (
("etudid", {"input_type": "hidden"}), ("etudid", {"input_type": "hidden"}),

View File

@ -42,7 +42,7 @@ from xml.etree import ElementTree
from xml.etree.ElementTree import Element from xml.etree.ElementTree import Element
import flask import flask
from flask import g from flask import g, request
from flask import url_for from flask import url_for
import app.scodoc.sco_utils as scu import app.scodoc.sco_utils as scu
@ -1079,7 +1079,7 @@ def partition_rename(partition_id, REQUEST=None):
raise AccessDenied("Vous n'avez pas le droit d'effectuer cette opération !") raise AccessDenied("Vous n'avez pas le droit d'effectuer cette opération !")
H = ["<h2>Renommer une partition</h2>"] H = ["<h2>Renommer une partition</h2>"]
tf = TrivialFormulator( tf = TrivialFormulator(
REQUEST.URL0, request.base_url,
REQUEST.form, REQUEST.form,
( (
("partition_id", {"default": partition_id, "input_type": "hidden"}), ("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 !") raise AccessDenied("Vous n'avez pas le droit d'effectuer cette opération !")
H = ["<h2>Renommer un groupe de %s</h2>" % group["partition_name"]] H = ["<h2>Renommer un groupe de %s</h2>" % group["partition_name"]]
tf = TrivialFormulator( tf = TrivialFormulator(
REQUEST.URL0, request.base_url,
REQUEST.form, REQUEST.form,
( (
("group_id", {"default": group_id, "input_type": "hidden"}), ("group_id", {"default": group_id, "input_type": "hidden"}),
@ -1268,7 +1268,7 @@ def groups_auto_repartition(partition_id=None, REQUEST=None):
] ]
tf = TrivialFormulator( tf = TrivialFormulator(
REQUEST.URL0, request.base_url,
REQUEST.form, REQUEST.form,
descr, descr,
{}, {},

View File

@ -719,7 +719,7 @@ def groups_table(
partitions=groups_infos.partitions, partitions=groups_infos.partitions,
with_codes=with_codes, with_codes=with_codes,
with_paiement=with_paiement, with_paiement=with_paiement,
server_name=REQUEST.BASE0, server_name=request.url_root,
) )
filename = "liste_%s" % groups_infos.groups_filename + ".xlsx" filename = "liste_%s" % groups_infos.groups_filename + ".xlsx"
return scu.send_file( return scu.send_file(
@ -794,10 +794,7 @@ def groups_table(
title = "etudiants_%s" % groups_infos.groups_filename title = "etudiants_%s" % groups_infos.groups_filename
xls = sco_excel.excel_simple_table(titles=titles, lines=L, sheet_name=title) xls = sco_excel.excel_simple_table(titles=titles, lines=L, sheet_name=title)
filename = title + scu.XLSX_SUFFIX filename = title + scu.XLSX_SUFFIX
return scu.send_file( return sco_excel.send_excel_file(REQUEST, xls, filename)
xls, filename, scu.XLSX_SUFFIX, scu.XLSX_MIMETYPE, attached=True
)
# return sco_excel.send_excel_file(REQUEST, xls, filename)
else: else:
raise ValueError("unsupported format") raise ValueError("unsupported format")
@ -919,12 +916,12 @@ def form_choix_saisie_semaine(groups_infos, REQUEST=None):
return "" return ""
# construit l'URL "destination" # construit l'URL "destination"
# (a laquelle on revient apres saisie absences) # (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] moduleimpl_id = query_args.get("moduleimpl_id", [""])[0]
if "head_message" in query_args: if "head_message" in query_args:
del query_args["head_message"] del query_args["head_message"]
destination = "%s?%s" % ( destination = "%s?%s" % (
REQUEST.URL, request.base_url,
urllib.parse.urlencode(query_args, True), urllib.parse.urlencode(query_args, True),
) )
destination = destination.replace( destination = destination.replace(

View File

@ -31,7 +31,7 @@
import datetime import datetime
from operator import itemgetter 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.notesdb as ndb
import app.scodoc.sco_utils as scu import app.scodoc.sco_utils as scu
@ -414,7 +414,7 @@ def build_page(
html_sco_header.html_sem_header( html_sco_header.html_sem_header(
REQUEST, "Passages dans le semestre", sem, with_page_header=False REQUEST, "Passages dans le semestre", sem, with_page_header=False
), ),
"""<form method="post" action="%s">""" % REQUEST.URL0, """<form method="post" action="%s">""" % request.base_url,
"""<input type="hidden" name="formsemestre_id" value="%(formsemestre_id)s"/> """<input type="hidden" name="formsemestre_id" value="%(formsemestre_id)s"/>
<input type="submit" name="submitted" value="Appliquer les modifications"/> <input type="submit" name="submitted" value="Appliquer les modifications"/>
&nbsp;<a href="#help">aide</a> &nbsp;<a href="#help">aide</a>

View File

@ -31,7 +31,7 @@ from operator import itemgetter
import urllib import urllib
import flask 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.sco_utils as scu
import app.scodoc.notesdb as ndb import app.scodoc.notesdb as ndb
@ -177,7 +177,7 @@ def do_evaluation_listenotes(REQUEST):
), ),
] ]
tf = TrivialFormulator( tf = TrivialFormulator(
REQUEST.URL0, request.base_url,
REQUEST.form, REQUEST.form,
descr, descr,
cancelbutton=None, cancelbutton=None,

View File

@ -31,7 +31,7 @@
""" """
from operator import itemgetter from operator import itemgetter
from flask import url_for, g from flask import url_for, g, request
import app import app
import app.scodoc.sco_utils as scu import app.scodoc.sco_utils as scu
@ -84,7 +84,7 @@ def scodoc_table_etuds_lycees(format="html", REQUEST=None):
sco_preferences.SemPreferences(), sco_preferences.SemPreferences(),
no_links=True, no_links=True,
) )
tab.base_url = REQUEST.URL0 tab.base_url = request.base_url
t = tab.make_page(format=format, with_html_headers=False) t = tab.make_page(format=format, with_html_headers=False)
if format != "html": if format != "html":
return t return t
@ -187,7 +187,7 @@ def formsemestre_etuds_lycees(
tab, etuds_by_lycee = formsemestre_table_etuds_lycees( tab, etuds_by_lycee = formsemestre_table_etuds_lycees(
formsemestre_id, only_primo=only_primo, group_lycees=not no_grouping 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: if only_primo:
tab.base_url += "&only_primo=1" tab.base_url += "&only_primo=1"
if no_grouping: if no_grouping:

View File

@ -30,7 +30,7 @@
from operator import itemgetter from operator import itemgetter
import flask import flask
from flask import url_for, g from flask import url_for, g, request
import app.scodoc.notesdb as ndb import app.scodoc.notesdb as ndb
import app.scodoc.sco_utils as scu import app.scodoc.sco_utils as scu
@ -137,7 +137,7 @@ def moduleimpl_inscriptions_edit(
</script>""" </script>"""
) )
H.append("""<form method="post" id="mi_form" action="%s">""" % REQUEST.URL0) H.append("""<form method="post" id="mi_form" action="%s">""" % request.base_url)
H.append( H.append(
""" """
<input type="hidden" name="moduleimpl_id" value="%(moduleimpl_id)s"/> <input type="hidden" name="moduleimpl_id" value="%(moduleimpl_id)s"/>

View File

@ -341,7 +341,7 @@ def find_new_dir():
def copy_portal_photo_to_fs(etud): def copy_portal_photo_to_fs(etud):
"""Copy the photo from portal (distant website) to local fs. """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) sco_etud.format_etud_ident(etud)
url = photo_portal_url(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) log("copy_portal_photo_to_fs: getting %s" % url)
r = requests.get(url, timeout=portal_timeout) r = requests.get(url, timeout=portal_timeout)
except: except:
log("download failed: exception:\n%s" % traceback.format_exc()) # log("download failed: exception:\n%s" % traceback.format_exc())
log("called from:\n" + "".join(traceback.format_stack())) # 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) return None, "%s: erreur chargement de %s" % (etud["nomprenom"], url)
if r.status_code != 200: 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) return None, "%s: erreur chargement de %s" % (etud["nomprenom"], url)
data = r.content # image bytes data = r.content # image bytes
try: try:

View File

@ -34,6 +34,10 @@ import random
import time import time
from copy import copy from copy import copy
import flask
from flask import request
from app.scodoc.sco_exceptions import ScoValueError
import wtforms.validators import wtforms.validators
from flask import request, render_template from flask import request, render_template
from flask_login import current_user from flask_login import current_user

View File

@ -31,7 +31,7 @@ Recapitule tous les semestres validés dans une feuille excel.
""" """
import collections import collections
from flask import url_for, g from flask import url_for, g, request
import app.scodoc.sco_utils as scu import app.scodoc.sco_utils as scu
from app.scodoc import sco_abs 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.caption = "Récapitulatif %s." % sem["titreannee"]
tab.html_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( return tab.make_page(
title="""<h2 class="formsemestre">Poursuite d'études</h2>""", title="""<h2 class="formsemestre">Poursuite d'études</h2>""",
init_qtip=True, init_qtip=True,

View File

@ -111,7 +111,7 @@ get_base_preferences(formsemestre_id)
""" """
import flask import flask
from flask import g, url_for from flask import g, url_for, request
from flask_login import current_user from flask_login import current_user
from app.models import Departement from app.models import Departement
@ -2032,7 +2032,7 @@ class BasePreferences(object):
] ]
form = self.build_tf_form() form = self.build_tf_form()
tf = TrivialFormulator( tf = TrivialFormulator(
REQUEST.URL0, request.base_url,
REQUEST.form, REQUEST.form,
form, form,
initvalues=self.prefs[None], initvalues=self.prefs[None],
@ -2197,7 +2197,7 @@ function set_global_pref(el, pref_name) {
form.append(("destination", {"input_type": "hidden"})) form.append(("destination", {"input_type": "hidden"}))
form.append(("formsemestre_id", {"input_type": "hidden"})) form.append(("formsemestre_id", {"input_type": "hidden"}))
tf = TrivialFormulator( tf = TrivialFormulator(
REQUEST.URL0, request.base_url,
REQUEST.form, REQUEST.form,
form, form,
initvalues=self, 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") return flask.redirect(dest_url + "&head_message=Préférences modifiées")
elif destination == "again": elif destination == "again":
return flask.redirect( return flask.redirect(
REQUEST.URL0 + "?formsemestre_id=" + str(self.formsemestre_id) request.base_url + "?formsemestre_id=" + str(self.formsemestre_id)
) )
elif destination == "global": elif destination == "global":
return flask.redirect(scu.ScoURL() + "/edit_preferences") return flask.redirect(scu.ScoURL() + "/edit_preferences")

View File

@ -31,6 +31,8 @@ import time
from openpyxl.styles.numbers import FORMAT_NUMBER_00 from openpyxl.styles.numbers import FORMAT_NUMBER_00
from flask import request
import app.scodoc.sco_utils as scu import app.scodoc.sco_utils as scu
from app.scodoc import sco_abs from app.scodoc import sco_abs
from app.scodoc import sco_groups from app.scodoc import sco_groups
@ -318,7 +320,7 @@ def feuille_preparation_jury(formsemestre_id, REQUEST):
% ( % (
sco_version.SCONAME, sco_version.SCONAME,
time.strftime("%d/%m/%Y"), time.strftime("%d/%m/%Y"),
REQUEST.BASE0, request.url_root,
REQUEST.AUTHENTICATED_USER, REQUEST.AUTHENTICATED_USER,
) )
) )

View File

@ -52,7 +52,7 @@ from reportlab.platypus import Paragraph
from reportlab.lib import styles from reportlab.lib import styles
import flask 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.sco_utils as scu
import app.scodoc.notesdb as ndb 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, with_html_headers=False,
publish=publish, 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 = [ H = [
html_sco_header.html_sem_header( html_sco_header.html_sem_header(
REQUEST, REQUEST,
@ -657,7 +657,7 @@ def formsemestre_pvjury_pdf(formsemestre_id, group_ids=[], etudid=None, REQUEST=
else: else:
menu_choix_groupe = "" # un seul etudiant à editer menu_choix_groupe = "" # un seul etudiant à editer
tf = TrivialFormulator( tf = TrivialFormulator(
REQUEST.URL0, request.base_url,
REQUEST.form, REQUEST.form,
descr, descr,
cancelbutton="Annuler", cancelbutton="Annuler",
@ -806,7 +806,7 @@ def formsemestre_lettres_individuelles(formsemestre_id, group_ids=[], REQUEST=No
H = [ H = [
html_sco_header.html_sem_header( html_sco_header.html_sem_header(
REQUEST, REQUEST,
"Edition des lettres individuelles", "Édition des lettres individuelles",
sem=sem, sem=sem,
javascripts=sco_groups_view.JAVASCRIPTS, javascripts=sco_groups_view.JAVASCRIPTS,
cssstyles=sco_groups_view.CSSSTYLES, cssstyles=sco_groups_view.CSSSTYLES,
@ -826,7 +826,7 @@ def formsemestre_lettres_individuelles(formsemestre_id, group_ids=[], REQUEST=No
) )
tf = TrivialFormulator( tf = TrivialFormulator(
REQUEST.URL0, request.base_url,
REQUEST.form, REQUEST.form,
descr, descr,
cancelbutton="Annuler", cancelbutton="Annuler",

View File

@ -32,6 +32,8 @@ import json
import time import time
from xml.etree import ElementTree from xml.etree import ElementTree
from flask import request
import app.scodoc.sco_utils as scu import app.scodoc.sco_utils as scu
from app import log from app import log
from app.scodoc import html_sco_header from app.scodoc import html_sco_header
@ -101,7 +103,7 @@ def formsemestre_recapcomplet(
sco_formsemestre_status.formsemestre_status_head( sco_formsemestre_status.formsemestre_status_head(
formsemestre_id=formsemestre_id, REQUEST=REQUEST formsemestre_id=formsemestre_id, REQUEST=REQUEST
), ),
'<form name="f" method="get" action="%s">' % REQUEST.URL0, '<form name="f" method="get" action="%s">' % request.base_url,
'<input type="hidden" name="formsemestre_id" value="%s"></input>' '<input type="hidden" name="formsemestre_id" value="%s"></input>'
% formsemestre_id, % formsemestre_id,
'<input type="hidden" name="pref_override" value="0"></input>', '<input type="hidden" name="pref_override" value="0"></input>',

View File

@ -37,7 +37,7 @@ import time
import datetime import datetime
from operator import itemgetter from operator import itemgetter
from flask import url_for, g from flask import url_for, g, request
import pydot import pydot
import app.scodoc.sco_utils as scu import app.scodoc.sco_utils as scu
@ -247,7 +247,7 @@ def formsemestre_report(
sem["titreannee"], sem["titreannee"],
) )
tab.html_caption = "Répartition des résultats par %s." % category_name 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: if only_primo:
tab.base_url += "&only_primo=on" tab.base_url += "&only_primo=on"
return tab return tab
@ -322,7 +322,7 @@ def formsemestre_report_counts(
F = [ F = [
"""<form name="f" method="get" action="%s"><p> """<form name="f" method="get" action="%s"><p>
Colonnes: <select name="result" onchange="document.f.submit()">""" Colonnes: <select name="result" onchange="document.f.submit()">"""
% REQUEST.URL0 % request.base_url
] ]
for k in keys: for k in keys:
if k == result: if k == result:
@ -717,7 +717,7 @@ def formsemestre_suivi_cohorte(
) )
tab.base_url = ( tab.base_url = (
"%s?formsemestre_id=%s&percent=%s&bac=%s&bacspecialite=%s&civilite=%s" "%s?formsemestre_id=%s&percent=%s&bac=%s&bacspecialite=%s&civilite=%s"
% (REQUEST.URL0, formsemestre_id, percent, bac, bacspecialite, civilite) % (request.base_url, formsemestre_id, percent, bac, bacspecialite, civilite)
) )
if only_primo: if only_primo:
tab.base_url += "&only_primo=on" tab.base_url += "&only_primo=on"
@ -725,7 +725,7 @@ def formsemestre_suivi_cohorte(
if format != "html": if format != "html":
return t return t
base_url = REQUEST.URL0 base_url = request.base_url
burl = "%s?formsemestre_id=%s&bac=%s&bacspecialite=%s&civilite=%s&statut=%s" % ( burl = "%s?formsemestre_id=%s&bac=%s&bacspecialite=%s&civilite=%s&statut=%s" % (
base_url, base_url,
formsemestre_id, formsemestre_id,
@ -815,7 +815,7 @@ def _gen_form_selectetuds(
<p>Bac: <select name="bac" onchange="javascript: submit(this);"> <p>Bac: <select name="bac" onchange="javascript: submit(this);">
<option value="" %s>tous</option> <option value="" %s>tous</option>
""" """
% (REQUEST.URL0, selected) % (request.base_url, selected)
] ]
for b in bacs: for b in bacs:
if bac == b: 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): 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""" """Element de formulaire pour choisir si restriction aux primos entrants et groupement par lycees"""
F = ["""<form name="f" method="get" action="%s">""" % REQUEST.URL0] F = ["""<form name="f" method="get" action="%s">""" % request.base_url]
if only_primo: if only_primo:
checked = 'checked="1"' checked = 'checked="1"'
else: else:
@ -1204,7 +1204,7 @@ def formsemestre_suivi_parcours(
only_primo=only_primo, only_primo=only_primo,
grouped_parcours=not no_grouping, 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: if only_primo:
tab.base_url += "&only_primo=1" tab.base_url += "&only_primo=1"
if no_grouping: if no_grouping:

View File

@ -35,7 +35,7 @@ import datetime
import psycopg2 import psycopg2
import flask import flask
from flask import g, url_for from flask import g, url_for, request
from flask_login import current_user from flask_login import current_user
import app.scodoc.sco_utils as scu import app.scodoc.sco_utils as scu
@ -657,7 +657,7 @@ def saisie_notes_tableur(evaluation_id, group_ids=[], REQUEST=None):
) )
nf = TrivialFormulator( nf = TrivialFormulator(
REQUEST.URL0, request.base_url,
REQUEST.form, REQUEST.form,
( (
("evaluation_id", {"default": evaluation_id, "input_type": "hidden"}), ("evaluation_id", {"default": evaluation_id, "input_type": "hidden"}),

View File

@ -44,7 +44,7 @@ from reportlab.lib import colors
from PIL import Image as PILImage from PIL import Image as PILImage
import flask import flask
from flask import url_for, g, send_file from flask import url_for, g, send_file, request
from app import log from app import log
import app.scodoc.sco_utils as scu 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() F = html_sco_header.sco_footer()
REQUEST.form["group_ids"] = groups_infos.group_ids REQUEST.form["group_ids"] = groups_infos.group_ids
tf = TrivialFormulator( tf = TrivialFormulator(
REQUEST.URL0, request.base_url,
REQUEST.form, REQUEST.form,
( (
("xlsfile", {"title": "Fichier Excel:", "input_type": "file", "size": 40}), ("xlsfile", {"title": "Fichier Excel:", "input_type": "file", "size": 40}),

View File

@ -54,6 +54,7 @@ Solution proposée (nov 2014):
""" """
import flask import flask
from flask import request
from flask_login import current_user from flask_login import current_user
import app.scodoc.notesdb as ndb 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" default_label = "Aucune UE externe existante"
tf = TrivialFormulator( tf = TrivialFormulator(
REQUEST.URL0, request.base_url,
REQUEST.form, REQUEST.form,
( (
("formsemestre_id", {"input_type": "hidden"}), ("formsemestre_id", {"input_type": "hidden"}),

View File

@ -46,6 +46,8 @@ Opérations:
""" """
import datetime import datetime
from flask import request
from app.scodoc.intervals import intervalmap from app.scodoc.intervals import intervalmap
import app.scodoc.sco_utils as scu 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, html_sortable=True,
caption="Saisies de notes dans %s" % sem["titreannee"], caption="Saisies de notes dans %s" % sem["titreannee"],
preferences=sco_preferences.SemPreferences(formsemestre_id), 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 origin="Généré par %s le " % sco_version.SCONAME
+ scu.timedate_human_repr() + scu.timedate_human_repr()
+ "", + "",

View File

@ -30,7 +30,7 @@
# Anciennement ZScoUsers.py, fonctions de gestion des données réécrite avec flask/SQLAlchemy # 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 from flask_login import current_user
import cracklib # pylint: disable=import-error import cracklib # pylint: disable=import-error
@ -117,7 +117,7 @@ def index_html(REQUEST, all_depts=False, with_inactives=False, format="html"):
<input type="checkbox" name="all_depts" value="1" onchange="document.f.submit();" %s>Tous les départements</input> <input type="checkbox" name="all_depts" value="1" onchange="document.f.submit();" %s>Tous les départements</input>
<input type="checkbox" name="with_inactives" value="1" onchange="document.f.submit();" %s>Avec anciens utilisateurs</input> <input type="checkbox" name="with_inactives" value="1" onchange="document.f.submit();" %s>Avec anciens utilisateurs</input>
</form></p>""" </form></p>"""
% (REQUEST.URL0, checked, olds_checked) % (request.base_url, checked, olds_checked)
) )
L = list_users( L = list_users(
@ -212,7 +212,7 @@ def list_users(
html_class="table_leftalign list_users", html_class="table_leftalign list_users",
html_with_td_classes=True, html_with_td_classes=True,
html_sortable=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 pdf_link=False, # table is too wide to fit in a paper page => disable pdf
preferences=sco_preferences.SemPreferences(), preferences=sco_preferences.SemPreferences(),
) )

View File

@ -56,7 +56,7 @@ import urllib
from xml.etree import ElementTree from xml.etree import ElementTree
import flask import flask
from flask import g from flask import g, request
from flask import url_for from flask import url_for
from app.decorators import ( from app.decorators import (
@ -161,7 +161,7 @@ def index_html(REQUEST=None):
Saisie par semaine </span> - Choix du groupe: Saisie par semaine </span> - Choix du groupe:
<input name="datelundi" type="hidden" value="x"/> <input name="datelundi" type="hidden" value="x"/>
""" """
% REQUEST.URL0, % request.base_url,
sco_abs_views.formChoixSemestreGroupe(), sco_abs_views.formChoixSemestreGroupe(),
"</p>", "</p>",
cal_select_week(), cal_select_week(),
@ -961,7 +961,7 @@ ou entrez une date pour visualiser les absents un jour donné&nbsp;:
<input type="submit" name="" value="visualiser les absences"> <input type="submit" name="" value="visualiser les absences">
</form></div> </form></div>
""" """
% (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) return tab.make_page(format=format)
@ -1119,7 +1119,7 @@ def AddBilletAbsenceForm(etudid, REQUEST=None):
) )
] ]
tf = TrivialFormulator( tf = TrivialFormulator(
REQUEST.URL0, request.base_url,
REQUEST.form, REQUEST.form,
( (
("etudid", {"input_type": "hidden"}), ("etudid", {"input_type": "hidden"}),
@ -1265,7 +1265,7 @@ def listeBillets(REQUEST=None):
] ]
tf = TrivialFormulator( tf = TrivialFormulator(
REQUEST.URL0, request.base_url,
REQUEST.form, REQUEST.form,
(("billet_id", {"input_type": "text", "title": "Numéro du billet"}),), (("billet_id", {"input_type": "text", "title": "Numéro du billet"}),),
submitbutton=False, submitbutton=False,
@ -1398,7 +1398,7 @@ def ProcessBilletAbsenceForm(billet_id, REQUEST=None):
] ]
tf = TrivialFormulator( tf = TrivialFormulator(
REQUEST.URL0, request.base_url,
REQUEST.form, REQUEST.form,
( (
("billet_id", {"input_type": "hidden"}), ("billet_id", {"input_type": "hidden"}),

View File

@ -38,6 +38,8 @@ import re
import time import time
import calendar import calendar
from flask import request
# MIGRATION EN COURS => MODULE DESACTIVE ! # MIGRATION EN COURS => MODULE DESACTIVE !
# A REVOIR # A REVOIR
@ -166,14 +168,14 @@ def index_html(REQUEST=None, etud_nom=None, limit=50, offset="", format="html"):
if offset: if offset:
webparams["offset"] = max((offset or 0) - limit, 0) webparams["offset"] = max((offset or 0) - limit, 0)
prev_lnk = '<a class="stdlink" href="%s">précédentes</a>' % ( prev_lnk = '<a class="stdlink" href="%s">précédentes</a>' % (
REQUEST.URL0 + "?" + six.moves.urllib.parse.urlencode(webparams) request.base_url + "?" + six.moves.urllib.parse.urlencode(webparams)
) )
else: else:
prev_lnk = "" prev_lnk = ""
if len(entreprises) >= limit: if len(entreprises) >= limit:
webparams["offset"] = (offset or 0) + limit webparams["offset"] = (offset or 0) + limit
next_lnk = '<a class="stdlink" href="%s">suivantes</a>' % ( next_lnk = '<a class="stdlink" href="%s">suivantes</a>' % (
REQUEST.URL0 + "?" + six.moves.urllib.parse.urlencode(webparams) request.base_url + "?" + six.moves.urllib.parse.urlencode(webparams)
) )
else: else:
next_lnk = "" 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_class="entreprise_list table_leftalign",
html_with_td_classes=True, html_with_td_classes=True,
html_next_section=table_navigation, html_next_section=table_navigation,
base_url=REQUEST.URL0 + "?", base_url=request.base_url + "?",
preferences=context.get_preferences(), preferences=context.get_preferences(),
) )
if format != "html": if format != "html":
@ -293,7 +295,7 @@ def entreprise_contact_list(entreprise_id=None, format="html", REQUEST=None):
html_sortable=True, html_sortable=True,
html_class="contact_list table_leftalign", html_class="contact_list table_leftalign",
html_with_td_classes=True, html_with_td_classes=True,
base_url=REQUEST.URL0 + "?", base_url=request.base_url + "?",
preferences=context.get_preferences(), preferences=context.get_preferences(),
) )
if format != "html": if format != "html":
@ -399,7 +401,7 @@ def entreprise_correspondant_list(
html_sortable=True, html_sortable=True,
html_class="contact_list table_leftalign", html_class="contact_list table_leftalign",
html_with_td_classes=True, html_with_td_classes=True,
base_url=REQUEST.URL0 + "?", base_url=request.base_url + "?",
preferences=context.get_preferences(), preferences=context.get_preferences(),
) )
if format != "html": if format != "html":
@ -444,7 +446,7 @@ def entreprise_contact_edit(entreprise_contact_id, REQUEST=None):
% E, % E,
] ]
tf = TrivialFormulator( tf = TrivialFormulator(
REQUEST.URL0, request.base_url,
REQUEST.form, REQUEST.form,
( (
( (
@ -560,7 +562,7 @@ def entreprise_correspondant_edit(entreprise_corresp_id, REQUEST=None):
"""<h2 class="entreprise_correspondant">Édition contact entreprise</h2>""", """<h2 class="entreprise_correspondant">Édition contact entreprise</h2>""",
] ]
tf = TrivialFormulator( tf = TrivialFormulator(
REQUEST.URL0, request.base_url,
REQUEST.form, REQUEST.form,
( (
( (
@ -684,7 +686,7 @@ def entreprise_contact_create(entreprise_id, REQUEST=None):
% E, % E,
] ]
tf = TrivialFormulator( tf = TrivialFormulator(
REQUEST.URL0, request.base_url,
REQUEST.form, REQUEST.form,
( (
("entreprise_id", {"input_type": "hidden", "default": entreprise_id}), ("entreprise_id", {"input_type": "hidden", "default": entreprise_id}),
@ -783,7 +785,7 @@ def entreprise_contact_delete(entreprise_contact_id, REQUEST=None):
"""<h2>Suppression du contact</h2>""", """<h2>Suppression du contact</h2>""",
] ]
tf = TrivialFormulator( tf = TrivialFormulator(
REQUEST.URL0, request.base_url,
REQUEST.form, REQUEST.form,
(("entreprise_contact_id", {"input_type": "hidden"}),), (("entreprise_contact_id", {"input_type": "hidden"}),),
initvalues=c, initvalues=c,
@ -814,7 +816,7 @@ def entreprise_correspondant_create(entreprise_id, REQUEST=None):
% E, % E,
] ]
tf = TrivialFormulator( tf = TrivialFormulator(
REQUEST.URL0, request.base_url,
REQUEST.form, REQUEST.form,
( (
("entreprise_id", {"input_type": "hidden", "default": entreprise_id}), ("entreprise_id", {"input_type": "hidden", "default": entreprise_id}),
@ -920,7 +922,7 @@ def entreprise_correspondant_delete(entreprise_corresp_id, REQUEST=None):
"""<h2>Suppression du correspondant %(nom)s %(prenom)s</h2>""" % c, """<h2>Suppression du correspondant %(nom)s %(prenom)s</h2>""" % c,
] ]
tf = TrivialFormulator( tf = TrivialFormulator(
REQUEST.URL0, request.base_url,
REQUEST.form, REQUEST.form,
(("entreprise_corresp_id", {"input_type": "hidden"}),), (("entreprise_corresp_id", {"input_type": "hidden"}),),
initvalues=c, initvalues=c,
@ -976,7 +978,7 @@ def entreprise_delete(entreprise_id, REQUEST=None):
H.append("""<li>%(date)s %(description)s</li>""" % c) H.append("""<li>%(date)s %(description)s</li>""" % c)
H.append("""</ul>""") H.append("""</ul>""")
tf = TrivialFormulator( tf = TrivialFormulator(
REQUEST.URL0, request.base_url,
REQUEST.form, REQUEST.form,
(("entreprise_id", {"input_type": "hidden"}),), (("entreprise_id", {"input_type": "hidden"}),),
initvalues=E, initvalues=E,
@ -1008,7 +1010,7 @@ def entreprise_create(REQUEST=None):
"""<h2 class="entreprise_new">Création d'une entreprise</h2>""", """<h2 class="entreprise_new">Création d'une entreprise</h2>""",
] ]
tf = TrivialFormulator( tf = TrivialFormulator(
REQUEST.URL0, request.base_url,
REQUEST.form, REQUEST.form,
( (
("nom", {"size": 25, "title": "Nom de l'entreprise"}), ("nom", {"size": 25, "title": "Nom de l'entreprise"}),
@ -1105,7 +1107,7 @@ def entreprise_edit(entreprise_id, REQUEST=None, start=1):
"""<h2 class="entreprise">%(nom)s</h2>""" % F, """<h2 class="entreprise">%(nom)s</h2>""" % F,
] ]
tf = TrivialFormulator( tf = TrivialFormulator(
REQUEST.URL0, request.base_url,
REQUEST.form, REQUEST.form,
( (
("entreprise_id", {"default": entreprise_id, "input_type": "hidden"}), ("entreprise_id", {"default": entreprise_id, "input_type": "hidden"}),

View File

@ -38,8 +38,8 @@ from operator import itemgetter
from xml.etree import ElementTree from xml.etree import ElementTree
import flask import flask
from flask import url_for, g from flask import url_for
from flask import current_app from flask import current_app, g, request
from flask_login import current_user from flask_login import current_user
from config import Config from config import Config
@ -501,7 +501,7 @@ def formation_import_xml_form(REQUEST):
] ]
footer = html_sco_header.sco_footer() footer = html_sco_header.sco_footer()
tf = TrivialFormulator( tf = TrivialFormulator(
REQUEST.URL0, request.base_url,
REQUEST.form, REQUEST.form,
(("xmlfile", {"input_type": "file", "title": "Fichier XML", "size": 30}),), (("xmlfile", {"input_type": "file", "title": "Fichier XML", "size": 30}),),
submitlabel="Importer", submitlabel="Importer",
@ -637,7 +637,7 @@ def XMLgetFormsemestres(etape_apo=None, formsemestre_id=None, REQUEST=None):
"""List all formsemestres matching etape, XML format """List all formsemestres matching etape, XML format
DEPRECATED: use formsemestre_list() DEPRECATED: use formsemestre_list()
""" """
log("Warning: calling deprecated XMLgetFormsemestres") current_app.logger.debug("Warning: calling deprecated XMLgetFormsemestres")
args = {} args = {}
if etape_apo: if etape_apo:
args["etape_apo"] = etape_apo args["etape_apo"] = etape_apo
@ -778,7 +778,7 @@ def edit_enseignants_form(REQUEST, moduleimpl_id):
), ),
] ]
tf = TrivialFormulator( tf = TrivialFormulator(
REQUEST.URL0, request.base_url,
REQUEST.form, REQUEST.form,
modform, modform,
submitlabel="Ajouter enseignant", submitlabel="Ajouter enseignant",
@ -875,7 +875,7 @@ def edit_moduleimpl_resp(REQUEST, moduleimpl_id):
), ),
] ]
tf = TrivialFormulator( tf = TrivialFormulator(
REQUEST.URL0, request.base_url,
REQUEST.form, REQUEST.form,
form, form,
submitlabel="Changer responsable", submitlabel="Changer responsable",
@ -979,7 +979,7 @@ def edit_moduleimpl_expr(REQUEST, moduleimpl_id):
), ),
] ]
tf = TrivialFormulator( tf = TrivialFormulator(
REQUEST.URL0, request.base_url,
REQUEST.form, REQUEST.form,
form, form,
submitlabel="Modifier formule de calcul", submitlabel="Modifier formule de calcul",
@ -1083,7 +1083,7 @@ def view_module_abs(REQUEST, moduleimpl_id, format="html"):
columns_ids=("nomprenom", "just", "nojust", "total"), columns_ids=("nomprenom", "just", "nojust", "total"),
rows=T, rows=T,
html_class="table_leftalign", 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"]), filename="absmodule_" + scu.make_filename(M["module"]["titre"]),
caption="Absences dans le module %s" % M["module"]["titre"], caption="Absences dans le module %s" % M["module"]["titre"],
preferences=sco_preferences.SemPreferences(), preferences=sco_preferences.SemPreferences(),
@ -1139,7 +1139,7 @@ def edit_ue_expr(REQUEST, formsemestre_id, ue_id):
), ),
] ]
tf = TrivialFormulator( tf = TrivialFormulator(
REQUEST.URL0, request.base_url,
REQUEST.form, REQUEST.form,
form, form,
submitlabel="Modifier formule de calcul", 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( html_title=html_sco_header.html_sem_header(
REQUEST, "Enseignants du semestre", sem, with_page_header=False 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.", 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), preferences=sco_preferences.SemPreferences(formsemestre_id),
) )
@ -1538,7 +1538,7 @@ def evaluation_delete(REQUEST, evaluation_id):
H.append("""</div>""") H.append("""</div>""")
tf = TrivialFormulator( tf = TrivialFormulator(
REQUEST.URL0, request.base_url,
REQUEST.form, REQUEST.form,
(("evaluation_id", {"input_type": "hidden"}),), (("evaluation_id", {"input_type": "hidden"}),),
initvalues=E, initvalues=E,
@ -1776,7 +1776,7 @@ def formsemestre_bulletins_choice(
<form name="f" method="GET" action="%s"> <form name="f" method="GET" action="%s">
<input type="hidden" name="formsemestre_id" value="%s"></input> <input type="hidden" name="formsemestre_id" value="%s"></input>
""" """
% (REQUEST.URL0, formsemestre_id), % (request.base_url, formsemestre_id),
] ]
H.append("""<select name="version" class="noprint">""") H.append("""<select name="version" class="noprint">""")
for (v, e) in ( for (v, e) in (
@ -1928,7 +1928,7 @@ def appreciation_add_form(
else: else:
initvalues = {} initvalues = {}
tf = TrivialFormulator( tf = TrivialFormulator(
REQUEST.URL0, request.base_url,
REQUEST.form, REQUEST.form,
descr, descr,
initvalues=initvalues, initvalues=initvalues,

View File

@ -267,7 +267,7 @@ def showEtudLog(etudid, format="html", REQUEST=None):
rows=ops, rows=ops,
html_sortable=True, html_sortable=True,
html_class="table_leftalign", html_class="table_leftalign",
base_url="%s?etudid=%s" % (REQUEST.URL0, etudid), base_url="%s?etudid=%s" % (request.base_url, etudid),
page_title="Opérations sur %(nomprenom)s" % etud, page_title="Opérations sur %(nomprenom)s" % etud,
html_title="<h2>Opérations effectuées sur l'étudiant %(nomprenom)s</h2>" % etud, html_title="<h2>Opérations effectuées sur l'étudiant %(nomprenom)s</h2>" % etud,
filename="log_" + scu.make_filename(etud["nomprenom"]), filename="log_" + scu.make_filename(etud["nomprenom"]),
@ -617,7 +617,7 @@ def formChangeCoordonnees(etudid, REQUEST):
) )
tf = TrivialFormulator( tf = TrivialFormulator(
REQUEST.URL0, request.base_url,
REQUEST.form, REQUEST.form,
( (
("adresse_id", {"input_type": "hidden"}), ("adresse_id", {"input_type": "hidden"}),
@ -823,7 +823,7 @@ def formChangePhoto(etudid=None, REQUEST=None):
""", """,
] ]
tf = TrivialFormulator( tf = TrivialFormulator(
REQUEST.URL0, request.base_url,
REQUEST.form, REQUEST.form,
( (
("etudid", {"default": etudid, "input_type": "hidden"}), ("etudid", {"default": etudid, "input_type": "hidden"}),
@ -1496,7 +1496,7 @@ def _etudident_create_or_edit_form(REQUEST, edit):
] ]
initvalues["dont_check_homonyms"] = False initvalues["dont_check_homonyms"] = False
tf = TrivialFormulator( tf = TrivialFormulator(
REQUEST.URL0, request.base_url,
REQUEST.form, REQUEST.form,
descr, descr,
submitlabel=submitlabel, submitlabel=submitlabel,
@ -1748,7 +1748,7 @@ def check_group_apogee(group_id, REQUEST=None, etat=None, fix=False, fixmail=Fal
<p><a href="Notes/formsemestre_status?formsemestre_id=%s"> Retour au semestre</a> <p><a href="Notes/formsemestre_status?formsemestre_id=%s"> Retour au semestre</a>
""" """
% ( % (
REQUEST.URL0, request.base_url,
formsemestre_id, formsemestre_id,
scu.strnone(group_id), scu.strnone(group_id),
scu.strnone(etat), scu.strnone(etat),
@ -1767,7 +1767,7 @@ def check_group_apogee(group_id, REQUEST=None, etat=None, fix=False, fixmail=Fal
<p><a href="Notes/formsemestre_status?formsemestre_id=%s"> Retour au semestre</a> <p><a href="Notes/formsemestre_status?formsemestre_id=%s"> Retour au semestre</a>
""" """
% ( % (
REQUEST.URL0, request.base_url,
formsemestre_id, formsemestre_id,
scu.strnone(group_id), scu.strnone(group_id),
scu.strnone(etat), scu.strnone(etat),
@ -1856,7 +1856,7 @@ def form_students_import_excel(REQUEST, formsemestre_id=None):
F = html_sco_header.sco_footer() F = html_sco_header.sco_footer()
tf = TrivialFormulator( tf = TrivialFormulator(
REQUEST.URL0, request.base_url,
REQUEST.form, REQUEST.form,
( (
( (
@ -2021,7 +2021,7 @@ def form_students_import_infos_admissions(REQUEST, formsemestre_id=None):
) )
tf = TrivialFormulator( tf = TrivialFormulator(
REQUEST.URL0, request.base_url,
REQUEST.form, REQUEST.form,
( (
( (

View File

@ -342,7 +342,7 @@ def create_user_form(REQUEST, user_name=None, edit=0, all_roles=1):
) )
tf = TrivialFormulator( tf = TrivialFormulator(
REQUEST.URL0, request.base_url,
REQUEST.form, REQUEST.form,
descr, descr,
initvalues=initvalues, initvalues=initvalues,
@ -529,7 +529,7 @@ def import_users_form(REQUEST=None):
) )
F = html_sco_header.sco_footer() F = html_sco_header.sco_footer()
tf = TrivialFormulator( tf = TrivialFormulator(
REQUEST.URL0, request.base_url,
REQUEST.form, REQUEST.form,
( (
( (

View File

@ -1,7 +1,7 @@
# -*- mode: python -*- # -*- mode: python -*-
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
SCOVERSION = "9.0.28" SCOVERSION = "9.0.29"
SCONAME = "ScoDoc" SCONAME = "ScoDoc"

View File

@ -264,6 +264,17 @@ def create_dept(dept): # create-dept
return 0 return 0
@app.cli.command()
@click.argument("depts", nargs=-1)
def list_depts(depts=""): # list-dept
"""If dept exists, print it, else nothing.
Called without arguments, list all depts along with their ids.
"""
for dept in models.Departement.query.order_by(models.Departement.id):
if not depts or dept.acronym in depts:
print(f"{dept.id}\t{dept.acronym}")
@app.cli.command() @app.cli.command()
@with_appcontext @with_appcontext
def import_scodoc7_users(): # import-scodoc7-users def import_scodoc7_users(): # import-scodoc7-users

View File

@ -65,6 +65,27 @@ else
SCODOC7_HOME="$1" # racine de l'archive importée SCODOC7_HOME="$1" # racine de l'archive importée
fi fi
# --- 1. Vérifie qu'aucun des départements à importer n'existe déjà
check_existing_depts() {
sco7_depts=""
for f in "${SCODOC7_HOME}/var/scodoc/"/config/depts/*.cfg
do
dept=$(basename "${f%.*}") # le nom du dept peut-être en minuscules
sco9_name=$(echo "$dept" | tr "[:lower:]" "[:upper:]") # acronym ScoDoc 9 toujours en majuscule
sco7_depts="$sco7_depts $sco9_name"
done
nb_existing=$(echo "$sco7_depts" | su -c "cd $SCODOC_DIR && source venv/bin/activate && xargs flask list-depts" "$SCODOC_USER" | wc -l)
if [ "$nb_existing" -gt 0 ]
then
echo "Attention: il existe déjà $nb_existing départements de même nom que celles"
echo "que vous souhaitez importer !"
echo "Département qui allaient être importées: $sco7_depts"
echo "=> arrêt."
exit 2
fi
}
# --- 2. Propriétaire des bases de données pour import "en place" # --- 2. Propriétaire des bases de données pour import "en place"
# Bases appartenant à www-data: les attribue à "scodoc" pour le script de migration SQL # Bases appartenant à www-data: les attribue à "scodoc" pour le script de migration SQL
# qui tourne en tant que "scodoc" # qui tourne en tant que "scodoc"
@ -160,6 +181,8 @@ migrate_local_files() {
# ------ MAIN # ------ MAIN
check_existing_depts
change_scodoc_file_ownership change_scodoc_file_ownership
if [ "$INPLACE" == 1 ] if [ "$INPLACE" == 1 ]
@ -190,10 +213,15 @@ su -c "(cd $SCODOC_DIR && source venv/bin/activate && flask import-scodoc7-users
# ----- Migration bases départements # ----- Migration bases départements
# les départements ScoDoc7 ont été déplacés dans /opt/scodoc-data/config/dept # les départements ScoDoc7 ont été déplacés dans /opt/scodoc-data/config/dept
# (ils ne sont d'ailleurs plus utilisés par ScoDoc 9) # (ils ne sont plus utilisés par ScoDoc 9)
# Le nom du dept peut-être en minuscules et/ou majuscules (Geii, GEII...)
# Le nom de BD ScoDoc7 est toujours en majuscules (SCOGEII)
# Rappel: les archives ScoDoc7 étaient .../archives/<dept_name>/... donc minuscules/majuscules
# alors qu'en ScoDoc9 elles seront .../archives/<dept_id>/ : le numéro interne du département,
# puisque l'acronyme peut changer.
for f in "$SCODOC_VAR_DIR"/config/depts/*.cfg for f in "$SCODOC_VAR_DIR"/config/depts/*.cfg
do do
dept=$(basename "${f%.*}") # le nom du dept peut-être en minuscules et/ou majuscules (geii, GEII...) dept=$(basename "${f%.*}") # le nom du dept peut-être en minuscules
db_name=$(echo "SCO$dept" | tr "[:lower:]" "[:upper:]") # nom de BD toujours en majuscule db_name=$(echo "SCO$dept" | tr "[:lower:]" "[:upper:]") # nom de BD toujours en majuscule
echo echo
echo "----------------------------------------------" echo "----------------------------------------------"

View File

@ -4,6 +4,7 @@
import glob import glob
import os import os
import shutil import shutil
import sys
from app.models import Departement from app.models import Departement
from app.models.formsemestre import FormSemestre from app.models.formsemestre import FormSemestre
@ -25,7 +26,8 @@ def migrate_scodoc7_dept_archive(dept_name=""):
migrate_docetuds(dept) migrate_docetuds(dept)
# ApoCSVArchiver: # ApoCSVArchiver:
# /opt/scodoc-data/archives/apo_csv/<dept>/ ne bouge pas # /opt/scodoc-data/archives/apo_csv/<dept>/ -> apo_csv/<dept_id>/
migrate_apo_csv(dept)
def migrate_sem_archives(dept): def migrate_sem_archives(dept):
@ -35,7 +37,7 @@ def migrate_sem_archives(dept):
for sem in FormSemestre.query.filter_by(dept_id=dept.id): for sem in FormSemestre.query.filter_by(dept_id=dept.id):
n += 1 n += 1
arch_dir7 = f"/opt/scodoc-data/archives/{dept.acronym}/{sem.scodoc7_id}" arch_dir7 = f"/opt/scodoc-data/archives/{dept.acronym}/{sem.scodoc7_id}"
arch_dir9 = f"/opt/scodoc-data/archives/{dept.acronym}/{sem.id}" arch_dir9 = f"/opt/scodoc-data/archives/{dept.id}/{sem.id}"
if os.path.exists(arch_dir7): if os.path.exists(arch_dir7):
n_moves += 1 n_moves += 1
if not os.path.exists(arch_dir9): if not os.path.exists(arch_dir9):
@ -58,7 +60,7 @@ def migrate_docetuds(dept):
arch_dir7 = ( arch_dir7 = (
f"/opt/scodoc-data/archives/docetuds/{dept.acronym}/{etud.scodoc7_id}" f"/opt/scodoc-data/archives/docetuds/{dept.acronym}/{etud.scodoc7_id}"
) )
arch_dir9 = f"/opt/scodoc-data/archives/docetuds/{dept.acronym}/{etud.id}" arch_dir9 = f"/opt/scodoc-data/archives/docetuds/{dept.id}/{etud.id}"
if os.path.exists(arch_dir7): if os.path.exists(arch_dir7):
n_moves += 1 n_moves += 1
if not os.path.exists(arch_dir9): if not os.path.exists(arch_dir9):
@ -70,3 +72,25 @@ def migrate_docetuds(dept):
# print(f"\tmoving {arch}") # print(f"\tmoving {arch}")
shutil.move(arch, arch_dir9) shutil.move(arch, arch_dir9)
# print(f"moved {n_moves}/{n} etuds") # print(f"moved {n_moves}/{n} etuds")
def migrate_apo_csv(dept):
"/opt/scodoc-data/archives/apo_csv/<dept>/ -> .../apo_csv/<dept_id>/"
arch_dir7 = f"/opt/scodoc-data/archives/apo_csv/{dept.acronym}"
arch_dir7_upper = f"/opt/scodoc-data/archives/apo_csv/{dept.acronym.upper()}"
arch_dir9 = f"/opt/scodoc-data/archives/apo_csv/{dept.id}"
if os.path.exists(arch_dir7):
if os.path.exists(arch_dir9):
print(
f"Warning: {arch_dir9} exist ! not moving {arch_dir7}", file=sys.stderr
)
else:
shutil.move(arch_dir7, arch_dir9)
elif os.path.exists(arch_dir7_upper):
if os.path.exists(arch_dir9):
print(
f"Warning: {arch_dir9} exist ! not moving {arch_dir7_upper}",
file=sys.stderr,
)
else:
shutil.move(arch_dir7_upper, arch_dir9)