From 7f92a21b53c4daf17e4a19570714a3504feae0a4 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Wed, 8 Sep 2021 00:34:45 +0200 Subject: [PATCH] =?UTF-8?q?Fixes:=20trombino=5Fcopy=5Fphotos,=20import=20f?= =?UTF-8?q?ichiers=20associ=C3=A9s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/scodoc/sco_archives.py | 4 ++-- app/scodoc/sco_groups_view.py | 10 ++++------ app/scodoc/sco_import_etuds.py | 3 +-- app/scodoc/sco_pvjury.py | 4 ++-- app/scodoc/sco_saisie_notes.py | 3 --- app/scodoc/sco_trombino.py | 9 ++++----- app/scodoc/sco_trombino_tours.py | 4 ++-- app/views/absences.py | 12 +++++------- app/views/scolar.py | 5 ++++- 9 files changed, 24 insertions(+), 30 deletions(-) diff --git a/app/scodoc/sco_archives.py b/app/scodoc/sco_archives.py index 108bb055e..9266724f9 100644 --- a/app/scodoc/sco_archives.py +++ b/app/scodoc/sco_archives.py @@ -313,7 +313,7 @@ def do_formsemestre_archive( # tous les inscrits du semestre group_ids = [sco_groups.get_default_group(formsemestre_id)] groups_infos = sco_groups_view.DisplayedGroupsInfos( - group_ids, formsemestre_id=formsemestre_id, REQUEST=REQUEST + group_ids, formsemestre_id=formsemestre_id ) groups_filename = "-" + groups_infos.groups_filename etudids = [m["etudid"] for m in groups_infos.members] @@ -403,7 +403,7 @@ def formsemestre_archive(REQUEST, formsemestre_id, group_ids=[]): # tous les inscrits du semestre group_ids = [sco_groups.get_default_group(formsemestre_id)] groups_infos = sco_groups_view.DisplayedGroupsInfos( - group_ids, formsemestre_id=formsemestre_id, REQUEST=REQUEST + group_ids, formsemestre_id=formsemestre_id ) H = [ diff --git a/app/scodoc/sco_groups_view.py b/app/scodoc/sco_groups_view.py index 9852899c3..7ca1788f1 100644 --- a/app/scodoc/sco_groups_view.py +++ b/app/scodoc/sco_groups_view.py @@ -34,12 +34,12 @@ import collections import datetime import operator -import six.moves.urllib.request, six.moves.urllib.parse, six.moves.urllib.error +import urllib from urllib.parse import parse_qs import time -from flask import url_for, g +from flask import url_for, g, request import app.scodoc.sco_utils as scu from app.scodoc import html_sco_header @@ -86,7 +86,6 @@ def groups_view( group_ids, formsemestre_id=formsemestre_id, etat=etat, - REQUEST=REQUEST, select_all_when_unspecified=True, ) # Formats spéciaux: download direct @@ -301,7 +300,6 @@ class DisplayedGroupsInfos(object): etat=None, select_all_when_unspecified=False, moduleimpl_id=None, # used to find formsemestre when unspecified - REQUEST=None, ): if isinstance(group_ids, int): if group_ids: @@ -334,7 +332,7 @@ class DisplayedGroupsInfos(object): for group_id in group_ids: gq.append("group_ids=" + str(group_id)) self.groups_query_args = "&".join(gq) - self.base_url = REQUEST.URL0 + "?" + self.groups_query_args + self.base_url = request.base_url + "?" + self.groups_query_args self.group_ids = group_ids self.groups = [] groups_titles = [] @@ -918,7 +916,7 @@ def form_choix_saisie_semaine(groups_infos, REQUEST=None): del query_args["head_message"] destination = "%s?%s" % ( REQUEST.URL, - six.moves.urllib.parse.urlencode(query_args, True), + urllib.parse.urlencode(query_args, True), ) destination = destination.replace( "%", "%%" diff --git a/app/scodoc/sco_import_etuds.py b/app/scodoc/sco_import_etuds.py index b9b8b5de5..5b4d0cad1 100644 --- a/app/scodoc/sco_import_etuds.py +++ b/app/scodoc/sco_import_etuds.py @@ -157,7 +157,6 @@ def sco_import_generate_excel_sample( exclude_cols=[], extra_cols=[], group_ids=[], - REQUEST=None, ): """Generates an excel document based on format fmt (format is the result of sco_import_format()) @@ -188,7 +187,7 @@ def sco_import_generate_excel_sample( titles += extra_cols titlesStyles += [style] * len(extra_cols) if group_ids: - groups_infos = sco_groups_view.DisplayedGroupsInfos(group_ids, REQUEST=REQUEST) + groups_infos = sco_groups_view.DisplayedGroupsInfos(group_ids) members = groups_infos.members log( "sco_import_generate_excel_sample: group_ids=%s %d members" diff --git a/app/scodoc/sco_pvjury.py b/app/scodoc/sco_pvjury.py index 3fa5196ae..f06180f4e 100644 --- a/app/scodoc/sco_pvjury.py +++ b/app/scodoc/sco_pvjury.py @@ -622,7 +622,7 @@ def formsemestre_pvjury_pdf(formsemestre_id, group_ids=[], etudid=None, REQUEST= group_ids = [sco_groups.get_default_group(formsemestre_id)] groups_infos = sco_groups_view.DisplayedGroupsInfos( - group_ids, formsemestre_id=formsemestre_id, REQUEST=REQUEST + group_ids, formsemestre_id=formsemestre_id ) etudids = [m["etudid"] for m in groups_infos.members] @@ -800,7 +800,7 @@ def formsemestre_lettres_individuelles(formsemestre_id, group_ids=[], REQUEST=No # tous les inscrits du semestre group_ids = [sco_groups.get_default_group(formsemestre_id)] groups_infos = sco_groups_view.DisplayedGroupsInfos( - group_ids, formsemestre_id=formsemestre_id, REQUEST=REQUEST + group_ids, formsemestre_id=formsemestre_id ) etudids = [m["etudid"] for m in groups_infos.members] diff --git a/app/scodoc/sco_saisie_notes.py b/app/scodoc/sco_saisie_notes.py index da452b3a3..faba5e2c6 100644 --- a/app/scodoc/sco_saisie_notes.py +++ b/app/scodoc/sco_saisie_notes.py @@ -620,7 +620,6 @@ def saisie_notes_tableur(evaluation_id, group_ids=[], REQUEST=None): formsemestre_id=formsemestre_id, select_all_when_unspecified=True, etat=None, - REQUEST=REQUEST, ) H = [ @@ -793,7 +792,6 @@ def feuille_saisie_notes(evaluation_id, group_ids=[], REQUEST=None): formsemestre_id=formsemestre_id, select_all_when_unspecified=True, etat=None, - REQUEST=REQUEST, ) groups = sco_groups.listgroups(groups_infos.group_ids) gr_title_filename = sco_groups.listgroups_filename(groups) @@ -891,7 +889,6 @@ def saisie_notes(evaluation_id, group_ids=[], REQUEST=None): formsemestre_id=formsemestre_id, select_all_when_unspecified=True, etat=None, - REQUEST=REQUEST, ) if E["description"]: diff --git a/app/scodoc/sco_trombino.py b/app/scodoc/sco_trombino.py index 47769baf0..a0f858b0f 100644 --- a/app/scodoc/sco_trombino.py +++ b/app/scodoc/sco_trombino.py @@ -78,7 +78,7 @@ def trombino( etat = None # may be passed as '' # Informations sur les groupes à afficher: groups_infos = sco_groups_view.DisplayedGroupsInfos( - group_ids, formsemestre_id=formsemestre_id, etat=etat, REQUEST=REQUEST + group_ids, formsemestre_id=formsemestre_id, etat=etat ) # @@ -247,7 +247,7 @@ def _trombino_zip(groups_infos): # Copy photos from portal to ScoDoc def trombino_copy_photos(group_ids=[], REQUEST=None, dialog_confirmed=False): "Copy photos from portal to ScoDoc (overwriting local copy)" - groups_infos = sco_groups_view.DisplayedGroupsInfos(group_ids, REQUEST=REQUEST) + groups_infos = sco_groups_view.DisplayedGroupsInfos(group_ids) back_url = "groups_view?%s&curtab=tab-photos" % groups_infos.groups_query_args portal_url = sco_portal_apogee.get_portal_url() @@ -485,14 +485,13 @@ def photos_generate_excel_sample(group_ids=[], REQUEST=None): "photo_filename", ], extra_cols=["fichier_photo"], - REQUEST=REQUEST, ) return sco_excel.send_excel_file(REQUEST, data, "ImportPhotos" + scu.XLSX_SUFFIX) def photos_import_files_form(group_ids=[], REQUEST=None): """Formulaire pour importation photos""" - groups_infos = sco_groups_view.DisplayedGroupsInfos(group_ids, REQUEST=REQUEST) + groups_infos = sco_groups_view.DisplayedGroupsInfos(group_ids) back_url = "groups_view?%s&curtab=tab-photos" % groups_infos.groups_query_args H = [ @@ -541,7 +540,7 @@ def photos_import_files_form(group_ids=[], REQUEST=None): def photos_import_files(group_ids=[], xlsfile=None, zipfile=None, REQUEST=None): """Importation des photos""" - groups_infos = sco_groups_view.DisplayedGroupsInfos(group_ids, REQUEST=REQUEST) + groups_infos = sco_groups_view.DisplayedGroupsInfos(group_ids) back_url = "groups_view?%s&curtab=tab-photos" % groups_infos.groups_query_args filename_title = "fichier_photo" page_title = "Téléchargement des photos des étudiants" diff --git a/app/scodoc/sco_trombino_tours.py b/app/scodoc/sco_trombino_tours.py index b77bf61d0..7a2ec1f03 100644 --- a/app/scodoc/sco_trombino_tours.py +++ b/app/scodoc/sco_trombino_tours.py @@ -61,7 +61,7 @@ def pdf_trombino_tours( """Generation du trombinoscope en fichier PDF""" # Informations sur les groupes à afficher: groups_infos = sco_groups_view.DisplayedGroupsInfos( - group_ids, formsemestre_id=formsemestre_id, REQUEST=REQUEST + group_ids, formsemestre_id=formsemestre_id ) DeptName = sco_preferences.get_preference("DeptName") @@ -296,7 +296,7 @@ def pdf_feuille_releve_absences( # Informations sur les groupes à afficher: groups_infos = sco_groups_view.DisplayedGroupsInfos( - group_ids, formsemestre_id=formsemestre_id, REQUEST=REQUEST + group_ids, formsemestre_id=formsemestre_id ) DeptName = sco_preferences.get_preference("DeptName") diff --git a/app/views/absences.py b/app/views/absences.py index f0dee786a..6216dc7ef 100644 --- a/app/views/absences.py +++ b/app/views/absences.py @@ -312,7 +312,7 @@ def SignaleAbsenceGrHebdo( moduleimpl_id = None groups_infos = sco_groups_view.DisplayedGroupsInfos( - group_ids, moduleimpl_id=moduleimpl_id, REQUEST=REQUEST + group_ids, moduleimpl_id=moduleimpl_id ) if not groups_infos.members: return ( @@ -474,7 +474,7 @@ def SignaleAbsenceGrSemestre( REQUEST=None, ): """Saisie des absences sur une journée sur un semestre (ou intervalle de dates) entier""" - groups_infos = sco_groups_view.DisplayedGroupsInfos(group_ids, REQUEST=REQUEST) + groups_infos = sco_groups_view.DisplayedGroupsInfos(group_ids) if not groups_infos.members: return ( html_sco_header.sco_header(page_title="Saisie des absences") @@ -847,7 +847,7 @@ def EtatAbsencesGr( datedebut = ndb.DateDMYtoISO(debut) datefin = ndb.DateDMYtoISO(fin) # Informations sur les groupes à afficher: - groups_infos = sco_groups_view.DisplayedGroupsInfos(group_ids, REQUEST=REQUEST) + groups_infos = sco_groups_view.DisplayedGroupsInfos(group_ids) formsemestre_id = groups_infos.formsemestre_id sem = groups_infos.formsemestre @@ -971,13 +971,11 @@ ou entrez une date pour visualiser les absents un jour donné : @scodoc @permission_required(Permission.ScoView) @scodoc7func -def EtatAbsencesDate( - group_ids=[], date=None, REQUEST=None # list of groups to display -): +def EtatAbsencesDate(group_ids=[], date=None): # list of groups to display # ported from dtml """Etat des absences pour un groupe à une date donnée""" # Informations sur les groupes à afficher: - groups_infos = sco_groups_view.DisplayedGroupsInfos(group_ids, REQUEST=REQUEST) + groups_infos = sco_groups_view.DisplayedGroupsInfos(group_ids) H = [html_sco_header.sco_header(page_title="Etat des absences")] if date: dateiso = ndb.DateDMYtoISO(date) diff --git a/app/views/scolar.py b/app/views/scolar.py index 54640bea2..41632ff7e 100644 --- a/app/views/scolar.py +++ b/app/views/scolar.py @@ -283,7 +283,10 @@ sco_publish( ) sco_publish( - "/trombino_copy_photos", sco_trombino.trombino_copy_photos, Permission.ScoView + "/trombino_copy_photos", + sco_trombino.trombino_copy_photos, + Permission.ScoView, + methods=["GET", "POST"], ) sco_publish("/groups_view", sco_groups_view.groups_view, Permission.ScoView)