diff --git a/app/api/errors.py b/app/api/errors.py index ed8d0f3f66..b86d2b2369 100644 --- a/app/api/errors.py +++ b/app/api/errors.py @@ -20,7 +20,9 @@ # FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.from flask import jsonify +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +from flask import jsonify from werkzeug.http import HTTP_STATUS_CODES diff --git a/app/scodoc/html_sco_header.py b/app/scodoc/html_sco_header.py index c204e7403d..7e35c3b33e 100644 --- a/app/scodoc/html_sco_header.py +++ b/app/scodoc/html_sco_header.py @@ -318,13 +318,7 @@ def sco_footer(): def html_sem_header( - REQUEST, - title, - sem=None, - with_page_header=True, - with_h2=True, - page_title=None, - **args + title, sem=None, with_page_header=True, with_h2=True, page_title=None, **args ): "Titre d'une page semestre avec lien vers tableau de bord" # sem now unused and thus optional... diff --git a/app/scodoc/sco_abs.py b/app/scodoc/sco_abs.py index be823d336e..5eb7f7f4de 100644 --- a/app/scodoc/sco_abs.py +++ b/app/scodoc/sco_abs.py @@ -655,7 +655,7 @@ def add_absence( sco_abs_notification.abs_notify(etudid, jour) -def add_justif(etudid, jour, matin, REQUEST, description=None): +def add_justif(etudid, jour, matin, description=None): "Ajoute un justificatif dans la base" # unpublished if _isFarFutur(jour): @@ -664,7 +664,9 @@ def add_justif(etudid, jour, matin, REQUEST, description=None): cnx = ndb.GetDBConnexion() cursor = cnx.cursor(cursor_factory=ndb.ScoDocCursor) cursor.execute( - "insert into absences (etudid,jour,estabs,estjust,matin, description) values (%(etudid)s,%(jour)s, FALSE, TRUE, %(matin)s, %(description)s )", + """INSERT INTO absences (etudid, jour, estabs, estjust, matin, description) + VALUES (%(etudid)s, %(jour)s, FALSE, TRUE, %(matin)s, %(description)s) + """, vars(), ) logdb( @@ -677,7 +679,7 @@ def add_justif(etudid, jour, matin, REQUEST, description=None): invalidate_abs_etud_date(etudid, jour) -def _add_abslist(abslist, REQUEST, moduleimpl_id=None): +def add_abslist(abslist, moduleimpl_id=None): for a in abslist: etudid, jour, ampm = a.split(":") if ampm == "am": @@ -688,7 +690,7 @@ def _add_abslist(abslist, REQUEST, moduleimpl_id=None): raise ValueError("invalid ampm !") # ajoute abs si pas deja absent if count_abs(etudid, jour, jour, matin, moduleimpl_id) == 0: - add_absence(etudid, jour, matin, 0, REQUEST, "", moduleimpl_id) + add_absence(etudid, jour, matin, 0, "", moduleimpl_id) def annule_absence(etudid, jour, matin, moduleimpl_id=None): @@ -720,7 +722,7 @@ def annule_absence(etudid, jour, matin, moduleimpl_id=None): invalidate_abs_etud_date(etudid, jour) -def annule_justif(etudid, jour, matin, REQUEST=None): +def annule_justif(etudid, jour, matin): "Annule un justificatif" # unpublished matin = _toboolean(matin) diff --git a/app/scodoc/sco_abs_views.py b/app/scodoc/sco_abs_views.py index a14827ad09..d4632bbc18 100644 --- a/app/scodoc/sco_abs_views.py +++ b/app/scodoc/sco_abs_views.py @@ -58,7 +58,6 @@ def doSignaleAbsence( estjust=False, description=None, etudid=False, - REQUEST=None, ): # etudid implied """Signalement d'une absence. @@ -69,7 +68,8 @@ def doSignaleAbsence( demijournee: 2 si journée complète, 1 matin, 0 après-midi estjust: absence justifiée description: str - etudid: etudiant concerné. Si non spécifié, cherche dans REQUEST.form + etudid: etudiant concerné. Si non spécifié, cherche dans + les paramètres de la requête courante. """ etud = sco_etud.get_etud_info(filled=True, etudid=etudid)[0] etudid = etud["etudid"] @@ -153,7 +153,7 @@ def doSignaleAbsence( return "\n".join(H) -def SignaleAbsenceEtud(REQUEST=None): # etudid implied +def SignaleAbsenceEtud(): # etudid implied """Formulaire individuel simple de signalement d'une absence""" # brute-force portage from very old dtml code ... etud = sco_etud.get_etud_info(filled=True)[0] @@ -225,7 +225,6 @@ def SignaleAbsenceEtud(REQUEST=None): # etudid implied sco_photos.etud_photo_html( etudid=etudid, title="fiche de " + etud["nomprenom"], - REQUEST=REQUEST, ), """""", """ @@ -278,7 +277,6 @@ def doJustifAbsence( demijournee, description=None, etudid=False, - REQUEST=None, ): # etudid implied """Justification d'une absence @@ -288,7 +286,8 @@ def doJustifAbsence( demijournee: 2 si journée complète, 1 matin, 0 après-midi estjust: absence justifiée description: str - etudid: etudiant concerné. Si non spécifié, cherche dans REQUEST.form + etudid: etudiant concerné. Si non spécifié, cherche dans les + paramètres de la requête. """ etud = sco_etud.get_etud_info(filled=True, etudid=etudid)[0] etudid = etud["etudid"] @@ -302,14 +301,12 @@ def doJustifAbsence( etudid=etudid, jour=jour, matin=False, - REQUEST=REQUEST, description=description_abs, ) sco_abs.add_justif( etudid=etudid, jour=jour, matin=True, - REQUEST=REQUEST, description=description_abs, ) nbadded += 2 @@ -318,7 +315,6 @@ def doJustifAbsence( etudid=etudid, jour=jour, matin=demijournee, - REQUEST=REQUEST, description=description_abs, ) nbadded += 1 @@ -354,7 +350,7 @@ def doJustifAbsence( return "\n".join(H) -def JustifAbsenceEtud(REQUEST=None): # etudid implied +def JustifAbsenceEtud(): # etudid implied """Formulaire individuel simple de justification d'une absence""" # brute-force portage from very old dtml code ... etud = sco_etud.get_etud_info(filled=True)[0] @@ -373,7 +369,6 @@ def JustifAbsenceEtud(REQUEST=None): # etudid implied sco_photos.etud_photo_html( etudid=etudid, title="fiche de " + etud["nomprenom"], - REQUEST=REQUEST, ), """""", """ @@ -409,9 +404,7 @@ Raison: (optionnel) return "\n".join(H) -def doAnnuleAbsence( - datedebut, datefin, demijournee, etudid=False, REQUEST=None -): # etudid implied +def doAnnuleAbsence(datedebut, datefin, demijournee, etudid=False): # etudid implied """Annulation des absences pour une demi journée""" etud = sco_etud.get_etud_info(filled=True, etudid=etudid)[0] etudid = etud["etudid"] @@ -459,7 +452,7 @@ autre absence pour %(nomprenom)s return "\n".join(H) -def AnnuleAbsenceEtud(REQUEST=None): # etudid implied +def AnnuleAbsenceEtud(): # etudid implied """Formulaire individuel simple d'annulation d'une absence""" # brute-force portage from very old dtml code ... etud = sco_etud.get_etud_info(filled=True)[0] @@ -479,7 +472,6 @@ def AnnuleAbsenceEtud(REQUEST=None): # etudid implied sco_photos.etud_photo_html( etudid=etudid, title="fiche de " + etud["nomprenom"], - REQUEST=REQUEST, ), """""", """
A n'utiliser que suite à une erreur de saisie ou lorsqu'il s'avère que l'étudiant était en fait présent.
@@ -545,7 +537,7 @@ def AnnuleAbsenceEtud(REQUEST=None): # etudid implied return "\n".join(H) -def doAnnuleJustif(datedebut0, datefin0, demijournee, REQUEST=None): # etudid implied +def doAnnuleJustif(datedebut0, datefin0, demijournee): # etudid implied """Annulation d'une justification""" etud = sco_etud.get_etud_info(filled=True)[0] etudid = etud["etudid"] @@ -555,11 +547,11 @@ def doAnnuleJustif(datedebut0, datefin0, demijournee, REQUEST=None): # etudid i for jour in dates: # Attention: supprime matin et après-midi if demijournee == 2: - sco_abs.annule_justif(etudid, jour, False, REQUEST=REQUEST) - sco_abs.annule_justif(etudid, jour, True, REQUEST=REQUEST) + sco_abs.annule_justif(etudid, jour, False) + sco_abs.annule_justif(etudid, jour, True) nbadded += 2 else: - sco_abs.annule_justif(etudid, jour, demijournee, REQUEST=REQUEST) + sco_abs.annule_justif(etudid, jour, demijournee) nbadded += 1 # H = [ @@ -713,7 +705,6 @@ def formChoixSemestreGroupe(all=False): def CalAbs(etudid, sco_year=None): """Calendrier des absences d'un etudiant""" # crude portage from 1999 DTML - REQUEST = None # XXX etud = sco_etud.get_etud_info(filled=True, etudid=etudid)[0] etudid = etud["etudid"] anneescolaire = int(scu.AnneeScolaire(sco_year)) @@ -763,7 +754,6 @@ def CalAbs(etudid, sco_year=None): sco_photos.etud_photo_html( etudid=etudid, title="fiche de " + etud["nomprenom"], - REQUEST=REQUEST, ), ), CalHTML, @@ -788,7 +778,6 @@ def ListeAbsEtud( format="html", absjust_only=0, sco_year=None, - REQUEST=None, ): """Liste des absences d'un étudiant sur l'année en cours En format 'html': page avec deux tableaux (non justifiées et justifiées). @@ -807,10 +796,10 @@ def ListeAbsEtud( etud = sco_etud.get_etud_info(etudid=etudid, filled=True)[0] # Liste des absences et titres colonnes tables: - titles, columns_ids, absnonjust, absjust = _TablesAbsEtud( + titles, columns_ids, absnonjust, absjust = _tables_abs_etud( etudid, datedebut, with_evals=with_evals, format=format ) - if REQUEST: + if request.base_url: 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: @@ -893,13 +882,12 @@ def ListeAbsEtud( raise ValueError("Invalid format !") -def _TablesAbsEtud( +def _tables_abs_etud( etudid, datedebut, with_evals=True, format="html", absjust_only=0, - REQUEST=None, ): """Tables des absences justifiees et non justifiees d'un étudiant sur l'année en cours diff --git a/app/scodoc/sco_archives.py b/app/scodoc/sco_archives.py index 99ff48269f..9cdb7b4e9b 100644 --- a/app/scodoc/sco_archives.py +++ b/app/scodoc/sco_archives.py @@ -395,7 +395,6 @@ def formsemestre_archive(REQUEST, formsemestre_id, group_ids=[]): H = [ html_sco_header.html_sem_header( - REQUEST, "Archiver les PV et résultats du semestre", sem=sem, javascripts=sco_groups_view.JAVASCRIPTS, @@ -517,7 +516,7 @@ def formsemestre_list_archives(REQUEST, formsemestre_id): } L.append(a) - H = [html_sco_header.html_sem_header(REQUEST, "Archive des PV et résultats ", sem)] + H = [html_sco_header.html_sem_header("Archive des PV et résultats ", sem)] if not L: H.append("aucune archive enregistrée
") else: diff --git a/app/scodoc/sco_bulletins.py b/app/scodoc/sco_bulletins.py index cb2225e862..91b9a2efcd 100644 --- a/app/scodoc/sco_bulletins.py +++ b/app/scodoc/sco_bulletins.py @@ -1217,9 +1217,7 @@ def _formsemestre_bulletinetud_header_html( """ % ( url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid), - sco_photos.etud_photo_html( - etud, title="fiche de " + etud["nom"], REQUEST=REQUEST - ), + sco_photos.etud_photo_html(etud, title="fiche de " + etud["nom"]), ) ) H.append( diff --git a/app/scodoc/sco_evaluations.py b/app/scodoc/sco_evaluations.py index 5501948096..1cf1fd804a 100644 --- a/app/scodoc/sco_evaluations.py +++ b/app/scodoc/sco_evaluations.py @@ -780,7 +780,6 @@ def formsemestre_evaluations_cal(formsemestre_id, REQUEST=None): H = [ html_sco_header.html_sem_header( - REQUEST, "Evaluations du semestre", sem, cssstyles=["css/calabs.css"], diff --git a/app/scodoc/sco_formsemestre_custommenu.py b/app/scodoc/sco_formsemestre_custommenu.py index fea675e0e5..e7cce9e1ac 100644 --- a/app/scodoc/sco_formsemestre_custommenu.py +++ b/app/scodoc/sco_formsemestre_custommenu.py @@ -84,9 +84,7 @@ def formsemestre_custommenu_edit(formsemestre_id, REQUEST=None): scu.NotesURL() + "/formsemestre_status?formsemestre_id=%s" % formsemestre_id ) H = [ - html_sco_header.html_sem_header( - REQUEST, "Modification du menu du semestre ", sem - ), + html_sco_header.html_sem_header("Modification du menu du semestre ", sem), """Ce menu, spécifique à chaque semestre, peut être utilisé pour placer des liens vers vos applications préférées.
Procédez en plusieurs fois si vous voulez ajouter plusieurs items.
""", ] diff --git a/app/scodoc/sco_formsemestre_edit.py b/app/scodoc/sco_formsemestre_edit.py index c0a01fc743..49f94ee23d 100644 --- a/app/scodoc/sco_formsemestre_edit.py +++ b/app/scodoc/sco_formsemestre_edit.py @@ -91,7 +91,6 @@ def formsemestre_editwithmodules(REQUEST, formsemestre_id): sem = sco_formsemestre.get_formsemestre(formsemestre_id) H = [ html_sco_header.html_sem_header( - REQUEST, "Modification du semestre", sem, javascripts=["libjs/AutoSuggest.js"], @@ -895,7 +894,6 @@ def formsemestre_clone(formsemestre_id, REQUEST=None): H = [ html_sco_header.html_sem_header( - REQUEST, "Copie du semestre", sem, javascripts=["libjs/AutoSuggest.js"], @@ -1242,7 +1240,7 @@ def formsemestre_delete(formsemestre_id, REQUEST=None): sem = sco_formsemestre.get_formsemestre(formsemestre_id) F = sco_formations.formation_list(args={"formation_id": sem["formation_id"]})[0] H = [ - html_sco_header.html_sem_header(REQUEST, "Suppression du semestre", sem), + html_sco_header.html_sem_header("Suppression du semestre", sem), """A n'utiliser qu'en cas d'erreur lors de la saisie d'une formation. Normalement, un semestre ne doit jamais être supprimé (on perd la mémoire des notes et de tous les événements liés à ce semestre !).
@@ -1545,9 +1543,7 @@ def formsemestre_edit_uecoefs(formsemestre_id, err_ue_id=None, REQUEST=None): """ H = [ - html_sco_header.html_sem_header( - REQUEST, "Coefficients des UE du semestre", sem - ), + html_sco_header.html_sem_header("Coefficients des UE du semestre", sem), help, ] # @@ -1659,9 +1655,7 @@ def formsemestre_edit_uecoefs(formsemestre_id, err_ue_id=None, REQUEST=None): formsemestre_id=formsemestre_id ) # > modif coef UE cap (modifs notes de _certains_ etudiants) - header = html_sco_header.html_sem_header( - REQUEST, "Coefficients des UE du semestre", sem - ) + header = html_sco_header.html_sem_header("Coefficients des UE du semestre", sem) return ( header + "\n".join(z) diff --git a/app/scodoc/sco_formsemestre_inscriptions.py b/app/scodoc/sco_formsemestre_inscriptions.py index 536e4743d1..569a5f0e58 100644 --- a/app/scodoc/sco_formsemestre_inscriptions.py +++ b/app/scodoc/sco_formsemestre_inscriptions.py @@ -334,7 +334,6 @@ def formsemestre_inscription_with_modules( etud = sco_etud.get_etud_info(etudid=etudid, filled=True)[0] H = [ html_sco_header.html_sem_header( - REQUEST, "Inscription de %s dans ce semestre" % etud["nomprenom"], sem, ) @@ -763,7 +762,6 @@ def formsemestre_inscrits_ailleurs(formsemestre_id, REQUEST=None): sem = sco_formsemestre.get_formsemestre(formsemestre_id) H = [ html_sco_header.html_sem_header( - REQUEST, "Inscriptions multiples parmi les étudiants du semestre ", sem, ) diff --git a/app/scodoc/sco_formsemestre_status.py b/app/scodoc/sco_formsemestre_status.py index 16635a664b..0599ef5149 100644 --- a/app/scodoc/sco_formsemestre_status.py +++ b/app/scodoc/sco_formsemestre_status.py @@ -701,7 +701,7 @@ def formsemestre_description_table(formsemestre_id, REQUEST=None, with_evals=Fal % (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 + "Description du semestre", sem, with_page_header=False ), pdf_title=title, preferences=sco_preferences.SemPreferences(formsemestre_id), @@ -912,7 +912,7 @@ def formsemestre_status_head(formsemestre_id=None, REQUEST=None, page_title=None H = [ html_sco_header.html_sem_header( - REQUEST, page_title, sem, with_page_header=False, with_h2=False + page_title, sem, with_page_header=False, with_h2=False ), f"""Formation: | diff --git a/app/scodoc/sco_formsemestre_validation.py b/app/scodoc/sco_formsemestre_validation.py index b7b59ba3e3..a77c10cb92 100644 --- a/app/scodoc/sco_formsemestre_validation.py +++ b/app/scodoc/sco_formsemestre_validation.py @@ -149,9 +149,7 @@ def formsemestre_validation_etud_form( ' | %s |
Utiliser cette page pour enregistrer une UE validée antérieurement, diff --git a/app/scodoc/sco_inscr_passage.py b/app/scodoc/sco_inscr_passage.py index a6c9cdc80e..364ecce628 100644 --- a/app/scodoc/sco_inscr_passage.py +++ b/app/scodoc/sco_inscr_passage.py @@ -412,7 +412,7 @@ def build_page( H = [ html_sco_header.html_sem_header( - REQUEST, "Passages dans le semestre", sem, with_page_header=False + "Passages dans le semestre", sem, with_page_header=False ), """