refactoring

This commit is contained in:
Emmanuel Viennet 2021-08-20 10:51:42 +02:00
parent bfad156ac2
commit e61af69f6d
34 changed files with 167 additions and 237 deletions

View File

@ -192,9 +192,13 @@ Charger les données ScoDoc 7: en tant qu'utilisateur "`scodoc`"
(adaptez l'argument si les données ont été copiées ailleurs)
Note: le message
`pg_restore: warning: restoring tables WITH OIDS is not supported anymore`
est normal et anodin.
Note: les messages d'erreur comme
pg_restore: warning: restoring tables WITH OIDS is not supported anymore
pg_restore: error: could not execute query: ERROR: schema "public" already exists
pg_restore: error: could not execute query: ERROR: must be owner of extension plpgsql
sont normaux et a priori anodins.
A ce stade, vous avez rechargé les bases ScoDoc 7 mais il faut encore
les convertir vers la nouvelle structure ScoDoc 9.

View File

@ -339,7 +339,6 @@ def sco_footer():
def html_sem_header(
context,
REQUEST,
title,
sem=None,

View File

@ -90,7 +90,7 @@ class BaseArchiver(object):
finally:
scu.GSL.release()
def get_obj_dir(self, context, oid):
def get_obj_dir(self, oid):
"""
:return: path to directory of archives for this object (eg formsemestre_id or etudid).
If directory does not yet exist, create it.
@ -117,11 +117,11 @@ class BaseArchiver(object):
dirs = glob.glob(base + "*")
return [os.path.split(x)[1] for x in dirs]
def list_obj_archives(self, context, oid):
def list_obj_archives(self, oid):
"""Returns
:return: list of archive identifiers for this object (paths to non empty dirs)
"""
base = self.get_obj_dir(context, oid) + os.path.sep
base = self.get_obj_dir(oid) + os.path.sep
dirs = glob.glob(
base
+ "[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]-[0-9][0-9]-[0-9][0-9]-[0-9][0-9]"
@ -164,11 +164,11 @@ class BaseArchiver(object):
"^[0-9]{4}-[0-9]{2}-[0-9]{2}-[0-9]{2}-[0-9]{2}-[0-9]{2}$", archive_name
)
def get_id_from_name(self, context, oid, archive_name):
def get_id_from_name(self, oid, archive_name):
"""returns archive id (check that name is valid)"""
if not self.is_valid_archive_name(archive_name):
raise ValueError("invalid archive name")
archive_id = os.path.join(self.get_obj_dir(context, oid), archive_name)
archive_id = os.path.join(self.get_obj_dir(oid), archive_name)
if not os.path.isdir(archive_id):
log(
"invalid archive name: %s, oid=%s, archive_id=%s"
@ -181,10 +181,10 @@ class BaseArchiver(object):
"""Return description of archive"""
return open(os.path.join(archive_id, "_description.txt")).read()
def create_obj_archive(self, context, oid: int, description: str):
def create_obj_archive(self, oid: int, description: str):
"""Creates a new archive for this object and returns its id."""
archive_id = (
self.get_obj_dir(context, oid)
self.get_obj_dir(oid)
+ os.path.sep
+ "-".join(["%02d" % x for x in time.localtime()[:6]])
)
@ -223,10 +223,10 @@ class BaseArchiver(object):
log("reading archive file %s" % fname)
return open(fname, "rb").read()
def get_archived_file(self, context, REQUEST, oid, archive_name, filename):
def get_archived_file(self, REQUEST, oid, archive_name, filename):
"""Recupere donnees du fichier indiqué et envoie au client"""
# XXX très incomplet: devrait inférer et assigner un type MIME
archive_id = self.get_id_from_name(context, oid, archive_name)
archive_id = self.get_id_from_name(oid, archive_name)
data = self.get(archive_id, filename)
ext = os.path.splitext(scu.strlower(filename))[1]
if ext == ".html" or ext == ".htm":
@ -284,14 +284,14 @@ def do_formsemestre_archive(
"""
from app.scodoc.sco_recapcomplet import make_formsemestre_recapcomplet
archive_id = PVArchive.create_obj_archive(context, formsemestre_id, description)
archive_id = PVArchive.create_obj_archive(formsemestre_id, description)
date = PVArchive.get_archive_date(archive_id).strftime("%d/%m/%Y à %H:%M")
if not group_ids:
# tous les inscrits du semestre
group_ids = [sco_groups.get_default_group(formsemestre_id)]
groups_infos = sco_groups_view.DisplayedGroupsInfos(
context, group_ids, formsemestre_id=formsemestre_id, REQUEST=REQUEST
group_ids, formsemestre_id=formsemestre_id, REQUEST=REQUEST
)
groups_filename = "-" + groups_infos.groups_filename
etudids = [m["etudid"] for m in groups_infos.members]
@ -386,12 +386,11 @@ def formsemestre_archive(context, 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(
context, group_ids, formsemestre_id=formsemestre_id, REQUEST=REQUEST
group_ids, formsemestre_id=formsemestre_id, REQUEST=REQUEST
)
H = [
html_sco_header.html_sem_header(
context,
REQUEST,
"Archiver les PV et résultats du semestre",
sem=sem,
@ -420,7 +419,7 @@ enregistrés et non modifiables, on peut les retrouver ultérieurement.
),
("sep", {"input_type": "separator", "title": "Informations sur PV de jury"}),
]
descr += sco_pvjury.descrform_pvjury(context, sem)
descr += sco_pvjury.descrform_pvjury(sem)
descr += [
(
"signature",
@ -447,7 +446,7 @@ enregistrés et non modifiables, on peut les retrouver ultérieurement.
]
menu_choix_groupe = (
"""<div class="group_ids_sel_menu">Groupes d'étudiants à lister: """
+ sco_groups_view.menu_groups_choice(context, groups_infos)
+ sco_groups_view.menu_groups_choice(groups_infos)
+ """(pour les PV et lettres)</div>"""
)
@ -500,10 +499,10 @@ enregistrés et non modifiables, on peut les retrouver ultérieurement.
)
def formsemestre_list_archives(context, REQUEST, formsemestre_id):
def formsemestre_list_archives(REQUEST, formsemestre_id):
"""Page listing archives"""
L = []
for archive_id in PVArchive.list_obj_archives(context, formsemestre_id):
for archive_id in PVArchive.list_obj_archives(formsemestre_id):
a = {
"archive_id": archive_id,
"description": PVArchive.get_archive_description(archive_id),
@ -513,11 +512,7 @@ def formsemestre_list_archives(context, REQUEST, formsemestre_id):
L.append(a)
sem = sco_formsemestre.get_formsemestre(formsemestre_id)
H = [
html_sco_header.html_sem_header(
context, REQUEST, "Archive des PV et résultats ", sem
)
]
H = [html_sco_header.html_sem_header(REQUEST, "Archive des PV et résultats ", sem)]
if not L:
H.append("<p>aucune archive enregistrée</p>")
else:
@ -546,17 +541,13 @@ def formsemestre_list_archives(context, REQUEST, formsemestre_id):
return "\n".join(H) + html_sco_header.sco_footer()
def formsemestre_get_archived_file(
context, REQUEST, formsemestre_id, archive_name, filename
):
def formsemestre_get_archived_file(REQUEST, formsemestre_id, archive_name, filename):
"""Send file to client."""
return PVArchive.get_archived_file(
context, REQUEST, formsemestre_id, archive_name, filename
)
return PVArchive.get_archived_file(REQUEST, formsemestre_id, archive_name, filename)
def formsemestre_delete_archive(
context, REQUEST, formsemestre_id, archive_name, dialog_confirmed=False
REQUEST, formsemestre_id, archive_name, dialog_confirmed=False
):
"""Delete an archive"""
if not sco_permissions_check.can_edit_pv(formsemestre_id):
@ -564,7 +555,7 @@ def formsemestre_delete_archive(
"opération non autorisée pour %s" % str(REQUEST.AUTHENTICATED_USER)
)
_ = sco_formsemestre.get_formsemestre(formsemestre_id) # check formsemestre_id
archive_id = PVArchive.get_id_from_name(context, formsemestre_id, archive_name)
archive_id = PVArchive.get_id_from_name(formsemestre_id, archive_name)
dest_url = "formsemestre_list_archives?formsemestre_id=%s" % (formsemestre_id)

View File

@ -53,16 +53,16 @@ class EtudsArchiver(sco_archives.BaseArchiver):
EtudsArchive = EtudsArchiver()
def can_edit_etud_archive(context, authuser):
def can_edit_etud_archive(authuser):
"""True si l'utilisateur peut modifier les archives etudiantes"""
return authuser.has_permission(Permission.ScoEtudAddAnnotations)
def etud_list_archives_html(context, REQUEST, etudid):
def etud_list_archives_html(REQUEST, etudid):
"""HTML snippet listing archives"""
can_edit = can_edit_etud_archive(context, REQUEST.AUTHENTICATED_USER)
can_edit = can_edit_etud_archive(REQUEST.AUTHENTICATED_USER)
L = []
for archive_id in EtudsArchive.list_obj_archives(context, etudid):
for archive_id in EtudsArchive.list_obj_archives(etudid):
a = {
"archive_id": archive_id,
"description": EtudsArchive.get_archive_description(archive_id),
@ -107,13 +107,13 @@ def etud_list_archives_html(context, REQUEST, etudid):
return "".join(H)
def add_archives_info_to_etud_list(context, etuds):
def add_archives_info_to_etud_list(etuds):
"""Add key 'etudarchive' describing archive of etuds
(used to list all archives of a group)
"""
for etud in etuds:
l = []
for archive_id in EtudsArchive.list_obj_archives(context, etud["etudid"]):
for archive_id in EtudsArchive.list_obj_archives(etud["etudid"]):
l.append(
"%s (%s)"
% (
@ -124,10 +124,10 @@ def add_archives_info_to_etud_list(context, etuds):
etud["etudarchive"] = ", ".join(l)
def etud_upload_file_form(context, REQUEST, etudid):
def etud_upload_file_form(REQUEST, etudid):
"""Page with a form to choose and upload a file, with a description."""
# check permission
if not can_edit_etud_archive(context, REQUEST.AUTHENTICATED_USER):
if not can_edit_etud_archive(REQUEST.AUTHENTICATED_USER):
raise AccessDenied(
"opération non autorisée pour %s" % str(REQUEST.AUTHENTICATED_USER)
)
@ -172,34 +172,30 @@ def etud_upload_file_form(context, REQUEST, etudid):
data = tf[2]["datafile"].read()
descr = tf[2]["description"]
filename = tf[2]["datafile"].filename
_store_etud_file_to_new_archive(
context, REQUEST, etudid, data, filename, description=descr
)
_store_etud_file_to_new_archive(etudid, data, filename, description=descr)
return flask.redirect(
url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid)
)
def _store_etud_file_to_new_archive(
context, REQUEST, etudid, data, filename, description=""
):
def _store_etud_file_to_new_archive(etudid, data, filename, description=""):
"""Store data to new archive."""
filesize = len(data)
if filesize < 10 or filesize > scu.CONFIG.ETUD_MAX_FILE_SIZE:
return 0, "Fichier image de taille invalide ! (%d)" % filesize
archive_id = EtudsArchive.create_obj_archive(context, etudid, description)
archive_id = EtudsArchive.create_obj_archive(etudid, description)
EtudsArchive.store(archive_id, filename, data)
def etud_delete_archive(context, REQUEST, etudid, archive_name, dialog_confirmed=False):
def etud_delete_archive(REQUEST, etudid, archive_name, dialog_confirmed=False):
"""Delete an archive"""
# check permission
if not can_edit_etud_archive(context, REQUEST.AUTHENTICATED_USER):
if not can_edit_etud_archive(REQUEST.AUTHENTICATED_USER):
raise AccessDenied(
"opération non autorisée pour %s" % str(REQUEST.AUTHENTICATED_USER)
)
etud = sco_etud.get_etud_info(filled=1, REQUEST=REQUEST)[0]
archive_id = EtudsArchive.get_id_from_name(context, etudid, archive_name)
archive_id = EtudsArchive.get_id_from_name(etudid, archive_name)
if not dialog_confirmed:
return scu.confirm_dialog(
"""<h2>Confirmer la suppression des fichiers ?</h2>
@ -230,11 +226,9 @@ def etud_delete_archive(context, REQUEST, etudid, archive_name, dialog_confirmed
)
def etud_get_archived_file(context, REQUEST, etudid, archive_name, filename):
def etud_get_archived_file(REQUEST, etudid, archive_name, filename):
"""Send file to client."""
return EtudsArchive.get_archived_file(
context, REQUEST, etudid, archive_name, filename
)
return EtudsArchive.get_archived_file(REQUEST, etudid, archive_name, filename)
# --- Upload d'un ensemble de fichiers (pour un groupe d'étudiants)
@ -335,9 +329,7 @@ def etudarchive_import_files(
context, group_id=None, xlsfile=None, zipfile=None, REQUEST=None, description=""
):
def callback(context, etud, data, filename, REQUEST):
_store_etud_file_to_new_archive(
context, REQUEST, etud["etudid"], data, filename, description
)
_store_etud_file_to_new_archive(etud["etudid"], data, filename, description)
filename_title = "fichier_a_charger"
page_title = "Téléchargement de fichiers associés aux étudiants"

View File

@ -841,7 +841,7 @@ def formsemestre_bulletinetud(
return "".join(H)
def can_send_bulletin_by_mail(context, formsemestre_id):
def can_send_bulletin_by_mail(formsemestre_id):
"""True if current user is allowed to send a bulletin by mail"""
sem = sco_formsemestre.get_formsemestre(formsemestre_id)
return (
@ -924,7 +924,7 @@ def do_formsemestre_bulletinetud(
elif format == "pdfmail":
# format pdfmail: envoie le pdf par mail a l'etud, et affiche le html
# check permission
if not can_send_bulletin_by_mail(context, formsemestre_id):
if not can_send_bulletin_by_mail(formsemestre_id):
raise AccessDenied("Vous n'avez pas le droit d'effectuer cette opération !")
if nohtml:
@ -1114,10 +1114,8 @@ def _formsemestre_bulletinetud_header_html(
"version": version,
"format": "pdfmail",
},
"enabled": etud["email"]
and can_send_bulletin_by_mail(
context, formsemestre_id
), # possible slt si on a un mail...
# possible slt si on a un mail...
"enabled": etud["email"] and can_send_bulletin_by_mail(formsemestre_id),
},
{
"title": "Envoi par mail à %s (adr. personnelle)" % etud["emailperso"],
@ -1129,10 +1127,9 @@ def _formsemestre_bulletinetud_header_html(
"format": "pdfmail",
"prefer_mail_perso": 1,
},
# possible slt si on a un mail...
"enabled": etud["emailperso"]
and can_send_bulletin_by_mail(
context, formsemestre_id
), # possible slt si on a un mail...
and can_send_bulletin_by_mail(formsemestre_id),
},
{
"title": "Version XML",

View File

@ -129,7 +129,7 @@ def apo_csv_store(context, csv_data, annee_scolaire, sem_id):
oid = "%d-%d" % (annee_scolaire, sem_id)
description = "%s;%s;%s" % (str(apo_data.etape), annee_scolaire, sem_id)
archive_id = ApoCSVArchive.create_obj_archive(context, oid, description)
archive_id = ApoCSVArchive.create_obj_archive(oid, description)
ApoCSVArchive.store(archive_id, filename, csv_data)
return apo_data.etape
@ -153,7 +153,7 @@ def apo_csv_list_stored_archives(
infos = [] # liste d'infos
for oid in oids:
archive_ids = ApoCSVArchive.list_obj_archives(context, oid)
archive_ids = ApoCSVArchive.list_obj_archives(oid)
for archive_id in archive_ids:
description = ApoCSVArchive.get_archive_description(archive_id)
fs = tuple(description.split(";"))
@ -387,7 +387,7 @@ apo_csv_store(context, csv_data, annee_scolaire, sem_id)
groups_infos = sco_groups_view.DisplayedGroupsInfos(context, [sco_groups.get_default_group(formsemestre_id)], formsemestre_id=formsemestre_id)
groups_infos = sco_groups_view.DisplayedGroupsInfos( [sco_groups.get_default_group(formsemestre_id)], formsemestre_id=formsemestre_id)
nt = sco_cache.NotesTableCache.get( formsemestre_id)
@ -410,7 +410,7 @@ col_id='apoL_c0129'
# --
from app.scodoc import sco_portal_apogee
context = go_dept(app, 'GEA').Notes
#csv_data = sco_portal_apogee.get_maquette_apogee(context, etape='V1GE', annee_scolaire=2015)
#csv_data = sco_portal_apogee.get_maquette_apogee(etape='V1GE', annee_scolaire=2015)
csv_data = open('/tmp/V1GE.txt').read()
apo_data = sco_apogee_csv.ApoData(csv_data, periode=1)

View File

@ -140,7 +140,7 @@ def apo_semset_maq_status(
% (semset_id,)
)
# Récupération sur portail:
maquette_url = sco_portal_apogee.get_maquette_url(context)
maquette_url = sco_portal_apogee.get_maquette_url()
if maquette_url: # portail configuré
menu_etapes = """<option value=""></option>"""
menu_etapes += "".join(
@ -650,7 +650,7 @@ def view_apo_csv_download_and_store(context, etape_apo="", semset_id="", REQUEST
semset = sco_semset.SemSet(context, semset_id=semset_id)
data = sco_portal_apogee.get_maquette_apogee(
context, etape=etape_apo, annee_scolaire=semset["annee_scolaire"]
etape=etape_apo, annee_scolaire=semset["annee_scolaire"]
)
# here, data is utf8
# but we store and generate latin1 files, to ease further import in Apogée

View File

@ -786,7 +786,6 @@ def formsemestre_evaluations_cal(formsemestre_id, REQUEST=None):
H = [
html_sco_header.html_sem_header(
context,
REQUEST,
"Evaluations du semestre",
sem,

View File

@ -85,7 +85,7 @@ def formsemestre_custommenu_edit(context, formsemestre_id, REQUEST=None):
)
H = [
html_sco_header.html_sem_header(
context, REQUEST, "Modification du menu du semestre ", sem
REQUEST, "Modification du menu du semestre ", sem
),
"""<p class="help">Ce menu, spécifique à chaque semestre, peut être utilisé pour placer des liens vers vos applications préférées.</p>
<p class="help">Procédez en plusieurs fois si vous voulez ajouter plusieurs items.</p>""",

View File

@ -91,7 +91,6 @@ def formsemestre_editwithmodules(context, REQUEST, formsemestre_id):
sem = sco_formsemestre.get_formsemestre(formsemestre_id)
H = [
html_sco_header.html_sem_header(
context,
REQUEST,
"Modification du semestre",
sem,
@ -329,7 +328,7 @@ def do_formsemestre_createwithmodules(context, REQUEST=None, edit=False):
},
),
]
etapes = sco_portal_apogee.get_etapes_apogee_dept(context)
etapes = sco_portal_apogee.get_etapes_apogee_dept()
# Propose les etapes renvoyées par le portail
# et ajoute les étapes du semestre qui ne sont pas dans la liste (soit la liste a changé, soit l'étape a été ajoutée manuellement)
etapes_set = {et[0] for et in etapes}
@ -885,7 +884,6 @@ def formsemestre_clone(context, formsemestre_id, REQUEST=None):
H = [
html_sco_header.html_sem_header(
context,
REQUEST,
"Copie du semestre",
sem,
@ -1238,9 +1236,7 @@ def formsemestre_delete(context, 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(
context, REQUEST, "Suppression du semestre", sem
),
html_sco_header.html_sem_header(REQUEST, "Suppression du semestre", sem),
"""<div class="ue_warning"><span>Attention !</span>
<p class="help">A n'utiliser qu'en cas d'erreur lors de la saisie d'une formation. Normalement,
<b>un semestre ne doit jamais être supprimé</b> (on perd la mémoire des notes et de tous les événements liés à ce semestre !).</p>
@ -1548,7 +1544,7 @@ def formsemestre_edit_uecoefs(context, formsemestre_id, err_ue_id=None, REQUEST=
"""
H = [
html_sco_header.html_sem_header(
context, REQUEST, "Coefficients des UE du semestre", sem
REQUEST, "Coefficients des UE du semestre", sem
),
help,
]
@ -1662,7 +1658,7 @@ def formsemestre_edit_uecoefs(context, formsemestre_id, err_ue_id=None, REQUEST=
) # > modif coef UE cap (modifs notes de _certains_ etudiants)
header = html_sco_header.html_sem_header(
context, REQUEST, "Coefficients des UE du semestre", sem
REQUEST, "Coefficients des UE du semestre", sem
)
return (
header

View File

@ -336,7 +336,6 @@ def formsemestre_inscription_with_modules(
etud = sco_etud.get_etud_info(etudid=etudid, filled=1)[0]
H = [
html_sco_header.html_sem_header(
context,
REQUEST,
"Inscription de %s dans ce semestre" % etud["nomprenom"],
sem,
@ -762,7 +761,6 @@ def formsemestre_inscrits_ailleurs(context, formsemestre_id, REQUEST=None):
sem = sco_formsemestre.get_formsemestre(formsemestre_id)
H = [
html_sco_header.html_sem_header(
context,
REQUEST,
"Inscriptions multiples parmi les étudiants du semestre ",
sem,

View File

@ -376,9 +376,7 @@ def formsemestre_status_menubar(context, sem):
"title": "Envoyer à chaque étudiant son bulletin par e-mail",
"endpoint": "notes.formsemestre_bulletins_mailetuds_choice",
"args": {"formsemestre_id": formsemestre_id},
"enabled": sco_bulletins.can_send_bulletin_by_mail(
context, formsemestre_id
),
"enabled": sco_bulletins.can_send_bulletin_by_mail(formsemestre_id),
},
{
"title": "Calendrier des évaluations",
@ -424,9 +422,7 @@ def formsemestre_status_menubar(context, sem):
"title": "Documents archivés",
"endpoint": "notes.formsemestre_list_archives",
"args": {"formsemestre_id": formsemestre_id},
"enabled": sco_archives.PVArchive.list_obj_archives(
context, formsemestre_id
),
"enabled": sco_archives.PVArchive.list_obj_archives(formsemestre_id),
},
]
@ -713,7 +709,7 @@ def formsemestre_description_table(
% (REQUEST.URL0, formsemestre_id, with_evals),
page_title=title,
html_title=html_sco_header.html_sem_header(
context, REQUEST, "Description du semestre", sem, with_page_header=False
REQUEST, "Description du semestre", sem, with_page_header=False
),
pdf_title=title,
preferences=sco_preferences.SemPreferences(formsemestre_id),
@ -927,7 +923,7 @@ def formsemestre_status_head(
H = [
html_sco_header.html_sem_header(
context, REQUEST, page_title, sem, with_page_header=False, with_h2=False
REQUEST, page_title, sem, with_page_header=False, with_h2=False
),
"""<table>
<tr><td class="fichetitre2">Formation: </td><td>

View File

@ -830,7 +830,7 @@ def formsemestre_validation_auto(context, formsemestre_id, REQUEST):
sem = sco_formsemestre.get_formsemestre(formsemestre_id)
H = [
html_sco_header.html_sem_header(
context, REQUEST, "Saisie automatique des décisions du semestre", sem
REQUEST, "Saisie automatique des décisions du semestre", sem
),
"""
<ul>

View File

@ -84,7 +84,6 @@ def groups_view(
"""
# Informations sur les groupes à afficher:
groups_infos = DisplayedGroupsInfos(
context,
group_ids,
formsemestre_id=formsemestre_id,
etat=etat,
@ -181,9 +180,7 @@ def form_groups_choice(
% (groups_infos.formsemestre_id, default_group_id)
]
H.append(
menu_groups_choice(context, groups_infos, submit_on_change=submit_on_change)
)
H.append(menu_groups_choice(groups_infos, submit_on_change=submit_on_change))
if with_selectall_butt:
H.append(
@ -194,7 +191,7 @@ def form_groups_choice(
return "\n".join(H)
def menu_groups_choice(context, groups_infos, submit_on_change=False):
def menu_groups_choice(groups_infos, submit_on_change=False):
"""menu pour selection groupes
group_ids est la liste des groupes actuellement sélectionnés
et doit comporter au moins un élément, sauf si formsemestre_id est spécifié.
@ -304,7 +301,6 @@ class DisplayedGroupsInfos(object):
def __init__(
self,
context,
group_ids=[], # groupes specifies dans l'URL, ou un seul int
formsemestre_id=None,
etat=None,
@ -312,7 +308,6 @@ class DisplayedGroupsInfos(object):
moduleimpl_id=None, # used to find formsemestre when unspecified
REQUEST=None,
):
# log('DisplayedGroupsInfos %s' % group_ids)
if isinstance(group_ids, int):
if group_ids:
group_ids = [group_ids] # cas ou un seul parametre, pas de liste
@ -504,11 +499,11 @@ def groups_table(
if with_paiement:
columns_ids += ["datefinalisationinscription_str", "paiementinscription_str"]
if with_paiement or with_codes:
sco_portal_apogee.check_paiement_etuds(context, groups_infos.members)
sco_portal_apogee.check_paiement_etuds(groups_infos.members)
if with_archives:
from app.scodoc import sco_archives_etud
sco_archives_etud.add_archives_info_to_etud_list(context, groups_infos.members)
sco_archives_etud.add_archives_info_to_etud_list(groups_infos.members)
columns_ids += ["etudarchive"]
if with_annotations:
sco_etud.add_annotations_to_etud_list(context, groups_infos.members)

View File

@ -189,9 +189,7 @@ def sco_import_generate_excel_sample(
titles += extra_cols
titlesStyles += [style] * len(extra_cols)
if group_ids and context:
groups_infos = sco_groups_view.DisplayedGroupsInfos(
context, group_ids, REQUEST=REQUEST
)
groups_infos = sco_groups_view.DisplayedGroupsInfos(group_ids, REQUEST=REQUEST)
members = groups_infos.members
log(
"sco_import_generate_excel_sample: group_ids=%s %d members"

View File

@ -415,7 +415,7 @@ def build_page(
H = [
html_sco_header.html_sem_header(
context, 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,
"""<input type="hidden" name="formsemestre_id" value="%(formsemestre_id)s"/>

View File

@ -787,7 +787,7 @@ def evaluation_check_absences_html(
if with_header:
H = [
html_sco_header.html_sem_header(
context, REQUEST, "Vérification absences à l'évaluation"
REQUEST, "Vérification absences à l'évaluation"
),
sco_evaluations.evaluation_describe(
evaluation_id=evaluation_id, REQUEST=REQUEST
@ -876,7 +876,6 @@ def formsemestre_check_absences_html(context, formsemestre_id, REQUEST=None):
sem = sco_formsemestre.get_formsemestre(formsemestre_id)
H = [
html_sco_header.html_sem_header(
context,
REQUEST,
"Vérification absences aux évaluations de ce semestre",
sem,

View File

@ -287,9 +287,7 @@ def moduleimpl_inscriptions_stats(context, formsemestre_id, REQUEST=None):
options.append(mod)
# Page HTML:
H = [
html_sco_header.html_sem_header(
context, REQUEST, "Inscriptions aux modules du semestre"
)
html_sco_header.html_sem_header(REQUEST, "Inscriptions aux modules du semestre")
]
H.append("<h3>Inscrits au semestre: %d étudiants</h3>" % len(inscrits))

View File

@ -348,7 +348,7 @@ def ficheEtud(context, etudid=None, REQUEST=None):
# Fichiers archivés:
info["fichiers_archive_htm"] = (
'<div class="fichetitre">Fichiers associés</div>'
+ sco_archives_etud.etud_list_archives_html(context, REQUEST, etudid)
+ sco_archives_etud.etud_list_archives_html(REQUEST, etudid)
)
# Devenir de l'étudiant:

View File

@ -81,7 +81,7 @@ H90 = ".h90" # suffix for reduced size images
def photo_portal_url(context, etud):
"""Returns external URL to retreive photo on portal,
or None if no portal configured"""
photo_url = sco_portal_apogee.get_photo_url(context)
photo_url = sco_portal_apogee.get_photo_url()
if photo_url and etud["code_nip"]:
return photo_url + "?nip=" + etud["code_nip"]
else:
@ -98,7 +98,7 @@ def etud_photo_url(context, etud, size="small", fast=False, REQUEST=None):
)
if fast:
return photo_url
path = photo_pathname(context, etud, size=size)
path = photo_pathname(etud, size=size)
if not path:
# Portail ?
ext_url = photo_portal_url(context, etud)
@ -126,7 +126,7 @@ def get_photo_image(context, etudid=None, size="small", REQUEST=None):
filename = UNKNOWN_IMAGE_PATH
else:
etud = sco_etud.get_etud_info(etudid=etudid, filled=1, REQUEST=REQUEST)[0]
filename = photo_pathname(context, etud, size=size)
filename = photo_pathname(etud, size=size)
if not filename:
filename = UNKNOWN_IMAGE_PATH
return _http_jpeg_file(context, filename, REQUEST=REQUEST)
@ -169,7 +169,7 @@ def _http_jpeg_file(context, filename, REQUEST=None):
def etud_photo_is_local(context, etud, size="small"):
return photo_pathname(context, etud, size=size)
return photo_pathname(etud, size=size)
def etud_photo_html(
@ -216,7 +216,7 @@ def etud_photo_orig_html(context, etud=None, etudid=None, title=None, REQUEST=No
)
def photo_pathname(context, etud, size="orig"):
def photo_pathname(etud, size="orig"):
"""Returns full path of image file if etud has a photo (in the filesystem), or False.
Do not distinguish the cases: no photo, or file missing.
"""
@ -265,7 +265,7 @@ def store_photo(context, etud, data, REQUEST=None):
def suppress_photo(context, etud, REQUEST=None):
"""Suppress a photo"""
log("suppress_photo etudid=%s" % etud["etudid"])
rel_path = photo_pathname(context, etud)
rel_path = photo_pathname(etud)
# 1- remove ref. from database
etud["photo_filename"] = None
cnx = ndb.GetDBConnexion()
@ -297,7 +297,7 @@ def save_image(context, etudid, data):
data_file.write(data)
data_file.seek(0)
img = PILImage.open(data_file)
filename = get_new_filename(context, etudid)
filename = get_new_filename(etudid)
path = os.path.join(PHOTO_DIR, filename)
log("saving %dx%d jpeg to %s" % (img.size[0], img.size[1], path))
img.save(path + IMAGE_EXT, format="JPEG", quality=92)
@ -316,7 +316,7 @@ def scale_height(img, W=None, H=REDUCED_HEIGHT):
return img
def get_new_filename(context, etudid):
def get_new_filename(etudid):
"""Constructs a random filename to store a new image.
The path is constructed as: Fxx/etudid
"""
@ -372,6 +372,6 @@ def copy_portal_photo_to_fs(context, etud, REQUEST=None):
log("copy_portal_photo_to_fs: failure (exception in store_photo)!")
if status == 1:
log("copy_portal_photo_to_fs: copied %s" % url)
return photo_pathname(context, etud), "%s: photo chargée" % etud["nomprenom"]
return photo_pathname(etud), "%s: photo chargée" % etud["nomprenom"]
else:
return None, "%s: <b>%s</b>" % (etud["nomprenom"], diag)

View File

@ -45,16 +45,16 @@ from six.moves import range
SCO_CACHE_ETAPE_FILENAME = os.path.join(scu.SCO_TMP_DIR, "last_etapes.xml")
def has_portal(context):
def has_portal():
"True if we are connected to a portal"
return get_portal_url(context)
return get_portal_url()
class PortalInterface(object):
def __init__(self):
self.warning = False
def get_portal_url(self, context):
def get_portal_url(self):
"URL of portal"
portal_url = sco_preferences.get_preference("portal_url")
if not self.warning:
@ -65,63 +65,63 @@ class PortalInterface(object):
self.warning = True
return portal_url
def get_etapes_url(self, context):
def get_etapes_url(self):
"Full URL of service giving list of etapes (in XML)"
etapes_url = sco_preferences.get_preference("etapes_url")
if not etapes_url:
# Default:
portal_url = self.get_portal_url(context)
portal_url = self.get_portal_url()
if not portal_url:
return None
api_ver = self.get_portal_api_version(context)
api_ver = self.get_portal_api_version()
if api_ver > 1:
etapes_url = portal_url + "scodocEtapes.php"
else:
etapes_url = portal_url + "getEtapes.php"
return etapes_url
def get_etud_url(self, context):
def get_etud_url(self):
"Full URL of service giving list of students (in XML)"
etud_url = sco_preferences.get_preference("etud_url")
if not etud_url:
# Default:
portal_url = self.get_portal_url(context)
portal_url = self.get_portal_url()
if not portal_url:
return None
api_ver = self.get_portal_api_version(context)
api_ver = self.get_portal_api_version()
if api_ver > 1:
etud_url = portal_url + "scodocEtudiant.php"
else:
etud_url = portal_url + "getEtud.php"
return etud_url
def get_photo_url(self, context):
def get_photo_url(self):
"Full URL of service giving photo of student"
photo_url = sco_preferences.get_preference("photo_url")
if not photo_url:
# Default:
portal_url = self.get_portal_url(context)
portal_url = self.get_portal_url()
if not portal_url:
return None
api_ver = self.get_portal_api_version(context)
api_ver = self.get_portal_api_version()
if api_ver > 1:
photo_url = portal_url + "scodocPhoto.php"
else:
photo_url = portal_url + "getPhoto.php"
return photo_url
def get_maquette_url(self, context):
def get_maquette_url(self):
"""Full URL of service giving Apogee maquette pour une étape (fichier "CSV")"""
maquette_url = sco_preferences.get_preference("maquette_url")
if not maquette_url:
# Default:
portal_url = self.get_portal_url(context)
portal_url = self.get_portal_url()
if not portal_url:
return None
maquette_url = portal_url + "scodocMaquette.php"
return maquette_url
def get_portal_api_version(self, context):
def get_portal_api_version(self):
"API version of the portal software"
api_ver = sco_preferences.get_preference("portal_api")
if not api_ver:
@ -139,7 +139,7 @@ get_maquette_url = _PI.get_maquette_url
get_portal_api_version = _PI.get_portal_api_version
def get_inscrits_etape(context, code_etape, anneeapogee=None, ntrials=2):
def get_inscrits_etape(code_etape, anneeapogee=None, ntrials=2):
"""Liste des inscrits à une étape Apogée
Result = list of dicts
ntrials: try several time the same request, useful for some bad web services
@ -148,8 +148,8 @@ def get_inscrits_etape(context, code_etape, anneeapogee=None, ntrials=2):
if anneeapogee is None:
anneeapogee = str(time.localtime()[0])
etud_url = get_etud_url(context)
api_ver = get_portal_api_version(context)
etud_url = get_etud_url()
api_ver = get_portal_api_version()
if not etud_url:
return []
portal_timeout = sco_preferences.get_preference("portal_timeout")
@ -194,13 +194,13 @@ def get_inscrits_etape(context, code_etape, anneeapogee=None, ntrials=2):
return etuds
def query_apogee_portal(context, **args):
def query_apogee_portal(**args):
"""Recupere les infos sur les etudiants nommés
args: nom, prenom, code_nip
(nom et prenom matchent des parties de noms)
"""
etud_url = get_etud_url(context)
api_ver = get_portal_api_version(context)
etud_url = get_etud_url()
api_ver = get_portal_api_version()
if not etud_url:
return []
if api_ver > 1:
@ -264,7 +264,7 @@ def xml_to_list_of_dicts(doc, req=None):
return infos
def get_infos_apogee_allaccents(context, nom, prenom):
def get_infos_apogee_allaccents(nom, prenom):
"essai recup infos avec differents codages des accents"
if nom:
nom_noaccents = scu.suppress_accents(nom)
@ -277,25 +277,23 @@ def get_infos_apogee_allaccents(context, nom, prenom):
prenom_noaccents = prenom
# avec accents
infos = query_apogee_portal(context, nom=nom, prenom=prenom)
infos = query_apogee_portal(nom=nom, prenom=prenom)
# sans accents
if nom != nom_noaccents or prenom != prenom_noaccents:
infos += query_apogee_portal(
context, nom=nom_noaccents, prenom=prenom_noaccents
)
infos += query_apogee_portal(nom=nom_noaccents, prenom=prenom_noaccents)
return infos
def get_infos_apogee(context, nom, prenom):
def get_infos_apogee(nom, prenom):
"""recupere les codes Apogee en utilisant le web service CRIT"""
if (not nom) and (not prenom):
return []
# essaie plusieurs codages: tirets, accents
infos = get_infos_apogee_allaccents(context, nom, prenom)
infos = get_infos_apogee_allaccents(nom, prenom)
nom_st = nom.replace("-", " ")
prenom_st = prenom.replace("-", " ")
if nom_st != nom or prenom_st != prenom:
infos += get_infos_apogee_allaccents(context, nom_st, prenom_st)
infos += get_infos_apogee_allaccents(nom_st, prenom_st)
# si pas de match et nom ou prenom composé, essaie en coupant
if not infos:
if nom:
@ -307,18 +305,18 @@ def get_infos_apogee(context, nom, prenom):
else:
prenom1 = prenom
if nom != nom1 or prenom != prenom1:
infos += get_infos_apogee_allaccents(context, nom1, prenom1)
infos += get_infos_apogee_allaccents(nom1, prenom1)
return infos
def get_etud_apogee(context, code_nip):
def get_etud_apogee(code_nip):
"""Informations à partir du code NIP.
None si pas d'infos sur cet etudiant.
Exception si reponse invalide.
"""
if not code_nip:
return {}
etud_url = get_etud_url(context)
etud_url = get_etud_url()
if not etud_url:
return {}
portal_timeout = sco_preferences.get_preference("portal_timeout")
@ -332,7 +330,7 @@ def get_etud_apogee(context, code_nip):
return d[0]
def get_default_etapes(context):
def get_default_etapes():
"""Liste par défaut, lue du fichier de config"""
filename = scu.SCO_TOOLS_DIR + "/default-etapes.txt"
log("get_default_etapes: reading %s" % filename)
@ -350,7 +348,7 @@ def get_default_etapes(context):
return etapes
def _parse_etapes_from_xml(context, doc):
def _parse_etapes_from_xml(doc):
"""
may raise exception if invalid xml doc
"""
@ -373,13 +371,13 @@ def _parse_etapes_from_xml(context, doc):
return infos
def get_etapes_apogee(context):
def get_etapes_apogee():
"""Liste des etapes apogee
{ departement : { code_etape : intitule } }
Demande la liste au portail, ou si échec utilise liste
par défaut
"""
etapes_url = get_etapes_url(context)
etapes_url = get_etapes_url()
infos = {}
if etapes_url:
portal_timeout = sco_preferences.get_preference("portal_timeout")
@ -389,7 +387,7 @@ def get_etapes_apogee(context):
)
doc = scu.query_portal(etapes_url, timeout=portal_timeout)
try:
infos = _parse_etapes_from_xml(context, doc)
infos = _parse_etapes_from_xml(doc)
# cache le resultat (utile si le portail repond de façon intermitente)
if infos:
log("get_etapes_apogee: caching result")
@ -399,14 +397,14 @@ def get_etapes_apogee(context):
# Avons nous la copie d'une réponse récente ?
try:
doc = open(SCO_CACHE_ETAPE_FILENAME).read()
infos = _parse_etapes_from_xml(context, doc)
infos = _parse_etapes_from_xml(doc)
log("using last saved version from " + SCO_CACHE_ETAPE_FILENAME)
except:
infos = {}
else:
# Pas de portail: utilise étapes par défaut livrées avec ScoDoc
log("get_etapes_apogee: no configured URL (using default file)")
infos = get_default_etapes(context)
infos = get_default_etapes()
return infos
@ -421,7 +419,7 @@ def _xml_list_codes(target_dict, dept, nodes):
target_dict[dept] = {code: intitule}
def get_etapes_apogee_dept(context):
def get_etapes_apogee_dept():
"""Liste des etapes apogee pour ce departement.
Utilise la propriete 'portal_dept_name' pour identifier le departement.
@ -438,7 +436,7 @@ def get_etapes_apogee_dept(context):
portal_dept_name = ""
log("get_etapes_apogee_dept: pas de sections par departement")
infos = get_etapes_apogee(context)
infos = get_etapes_apogee()
if portal_dept_name and portal_dept_name not in infos:
log(
"get_etapes_apogee_dept: pas de section '%s' dans la reponse portail"
@ -512,7 +510,7 @@ def _normalize_apo_fields(infolist):
return infolist
def check_paiement_etuds(context, etuds):
def check_paiement_etuds(etuds):
"""Interroge le portail pour vérifier l'état de "paiement" et l'étape d'inscription.
Seuls les etudiants avec code NIP sont renseignés.
@ -534,7 +532,7 @@ def check_paiement_etuds(context, etuds):
etud["etape"] = None
else:
# Modifie certains champs de l'étudiant:
infos = get_etud_apogee(context, etud["code_nip"])
infos = get_etud_apogee(etud["code_nip"])
if infos:
for k in (
"paiementinscription",
@ -551,9 +549,9 @@ def check_paiement_etuds(context, etuds):
etud["paiementinscription_str"] = "(pb cnx Apogée)"
def get_maquette_apogee(context, etape="", annee_scolaire=""):
def get_maquette_apogee(etape="", annee_scolaire=""):
"""Maquette CSV Apogee pour une étape et une annee scolaire"""
maquette_url = get_maquette_url(context)
maquette_url = get_maquette_url()
if not maquette_url:
return None
portal_timeout = sco_preferences.get_preference("portal_timeout")

View File

@ -2125,9 +2125,7 @@ class SemPreferences(object):
context = None # XXX TO REMOVE
sem = sco_formsemestre.get_formsemestre(self.formsemestre_id)
H = [
html_sco_header.html_sem_header(
context, REQUEST, "Préférences du semestre", sem
),
html_sco_header.html_sem_header(REQUEST, "Préférences du semestre", sem),
"""
<p class="help">Les paramètres définis ici ne s'appliqueront qu'à ce semestre.</p>
<p class="msg">Attention: cliquez sur "Enregistrer les modifications" en bas de page pour appliquer vos changements !</p>

View File

@ -551,7 +551,6 @@ def formsemestre_pvjury(
tab.base_url = "%s?formsemestre_id=%s" % (REQUEST.URL0, formsemestre_id)
H = [
html_sco_header.html_sem_header(
context,
REQUEST,
"Décisions du jury pour le semestre",
sem,
@ -635,13 +634,12 @@ def formsemestre_pvjury_pdf(
group_ids = [sco_groups.get_default_group(formsemestre_id)]
groups_infos = sco_groups_view.DisplayedGroupsInfos(
context, group_ids, formsemestre_id=formsemestre_id, REQUEST=REQUEST
group_ids, formsemestre_id=formsemestre_id, REQUEST=REQUEST
)
etudids = [m["etudid"] for m in groups_infos.members]
H = [
html_sco_header.html_sem_header(
context,
REQUEST,
"Edition du PV de jury %s" % etuddescr,
sem=sem,
@ -659,14 +657,14 @@ def formsemestre_pvjury_pdf(
</p>""",
html_sco_header.sco_footer(),
]
descr = descrform_pvjury(context, sem)
descr = descrform_pvjury(sem)
if etudid:
descr.append(("etudid", {"input_type": "hidden"}))
if groups_infos:
menu_choix_groupe = (
"""<div class="group_ids_sel_menu">Groupes d'étudiants à lister sur le PV: """
+ sco_groups_view.menu_groups_choice(context, groups_infos)
+ sco_groups_view.menu_groups_choice(groups_infos)
+ """</div>"""
)
else:
@ -726,7 +724,7 @@ def formsemestre_pvjury_pdf(
return scu.sendPDFFile(REQUEST, pdfdoc, filename)
def descrform_pvjury(context, sem):
def descrform_pvjury(sem):
"""Définition de formulaire pour PV jury PDF"""
F = sco_formations.formation_list(formation_id=sem["formation_id"])[0]
return [
@ -818,13 +816,12 @@ def formsemestre_lettres_individuelles(
# tous les inscrits du semestre
group_ids = [sco_groups.get_default_group(formsemestre_id)]
groups_infos = sco_groups_view.DisplayedGroupsInfos(
context, group_ids, formsemestre_id=formsemestre_id, REQUEST=REQUEST
group_ids, formsemestre_id=formsemestre_id, REQUEST=REQUEST
)
etudids = [m["etudid"] for m in groups_infos.members]
H = [
html_sco_header.html_sem_header(
context,
REQUEST,
"Edition des lettres individuelles",
sem=sem,
@ -841,7 +838,7 @@ def formsemestre_lettres_individuelles(
descr = descrform_lettres_individuelles()
menu_choix_groupe = (
"""<div class="group_ids_sel_menu">Groupes d'étudiants à lister: """
+ sco_groups_view.menu_groups_choice(context, groups_infos)
+ sco_groups_view.menu_groups_choice(groups_infos)
+ """</div>"""
)

View File

@ -603,7 +603,6 @@ def saisie_notes_tableur(context, evaluation_id, group_ids=[], REQUEST=None):
# Informations sur les groupes à afficher:
groups_infos = sco_groups_view.DisplayedGroupsInfos(
context,
group_ids=group_ids,
formsemestre_id=formsemestre_id,
select_all_when_unspecified=True,
@ -779,7 +778,6 @@ def feuille_saisie_notes(context, evaluation_id, group_ids=[], REQUEST=None):
)
groups_infos = sco_groups_view.DisplayedGroupsInfos(
context,
group_ids=group_ids,
formsemestre_id=formsemestre_id,
select_all_when_unspecified=True,
@ -878,7 +876,6 @@ def saisie_notes(context, evaluation_id, group_ids=[], REQUEST=None):
# Informations sur les groupes à afficher:
groups_infos = sco_groups_view.DisplayedGroupsInfos(
context,
group_ids=group_ids,
formsemestre_id=formsemestre_id,
select_all_when_unspecified=True,

View File

@ -339,7 +339,7 @@ class SemSet(dict):
"""Affichage de la partie Effectifs et Liste des étudiants
(actif seulement si un portail est configuré)
"""
if sco_portal_apogee.has_portal(self.context):
if sco_portal_apogee.has_portal():
return self.bilan.html_diagnostic()
else:
return ""

View File

@ -375,7 +375,7 @@ def list_synch(context, sem, anneeapogee=None):
for etape in etapes:
if etape:
etudsapo = sco_portal_apogee.get_inscrits_etape(
context, etape, anneeapogee=anneeapogee
etape, anneeapogee=anneeapogee
)
etudsapo_set = etudsapo_set.union(set([x[EKEY_APO] for x in etudsapo]))
for e in etudsapo:
@ -803,9 +803,7 @@ def formsemestre_import_etud_admission(
)
apo_etuds = {} # nip : etud apo
for etape in sem["etapes"]:
etudsapo = sco_portal_apogee.get_inscrits_etape(
context, etape, anneeapogee=anneeapogee
)
etudsapo = sco_portal_apogee.get_inscrits_etape(etape, anneeapogee=anneeapogee)
apo_etuds.update({e["nip"]: e for e in etudsapo})
for i in ins:
@ -818,7 +816,7 @@ def formsemestre_import_etud_admission(
etud = apo_etuds.get(code_nip)
if not etud:
# pas vu dans les etudiants de l'étape, tente en individuel
etud = sco_portal_apogee.get_etud_apogee(context, code_nip)
etud = sco_portal_apogee.get_etud_apogee(code_nip)
if etud:
update_etape_formsemestre_inscription(context, i, etud)
do_import_etud_admission(

View File

@ -79,7 +79,7 @@ def trombino(
etat = None # may be passed as ''
# Informations sur les groupes à afficher:
groups_infos = sco_groups_view.DisplayedGroupsInfos(
context, group_ids, formsemestre_id=formsemestre_id, etat=etat, REQUEST=REQUEST
group_ids, formsemestre_id=formsemestre_id, etat=etat, REQUEST=REQUEST
)
#
@ -225,7 +225,7 @@ def _trombino_zip(context, groups_infos, REQUEST):
# assume we have the photos (or the user acknowledged the fact)
# Archive originals (not reduced) images, in JPEG
for t in groups_infos.members:
im_path = sco_photos.photo_pathname(context, t, size="orig")
im_path = sco_photos.photo_pathname(t, size="orig")
if not im_path:
continue
img = open(im_path, "rb").read()
@ -250,12 +250,10 @@ def _trombino_zip(context, groups_infos, REQUEST):
# Copy photos from portal to ScoDoc
def trombino_copy_photos(context, group_ids=[], REQUEST=None, dialog_confirmed=False):
"Copy photos from portal to ScoDoc (overwriting local copy)"
groups_infos = sco_groups_view.DisplayedGroupsInfos(
context, group_ids, REQUEST=REQUEST
)
groups_infos = sco_groups_view.DisplayedGroupsInfos(group_ids, REQUEST=REQUEST)
back_url = "groups_view?%s&curtab=tab-photos" % groups_infos.groups_query_args
portal_url = sco_portal_apogee.get_portal_url(context)
portal_url = sco_portal_apogee.get_portal_url()
header = html_sco_header.sco_header(page_title="Chargement des photos")
footer = html_sco_header.sco_footer()
if not portal_url:
@ -300,7 +298,7 @@ def trombino_copy_photos(context, group_ids=[], REQUEST=None, dialog_confirmed=F
def _get_etud_platypus_image(context, t, image_width=2 * cm):
"""Returns aplatypus object for the photo of student t"""
try:
path = sco_photos.photo_pathname(context, t, size="small")
path = sco_photos.photo_pathname(t, size="small")
if not path:
# log('> unknown')
path = sco_photos.UNKNOWN_IMAGE_PATH
@ -494,9 +492,7 @@ def photos_generate_excel_sample(context, group_ids=[], REQUEST=None):
def photos_import_files_form(context, group_ids=[], REQUEST=None):
"""Formulaire pour importation photos"""
groups_infos = sco_groups_view.DisplayedGroupsInfos(
context, group_ids, REQUEST=REQUEST
)
groups_infos = sco_groups_view.DisplayedGroupsInfos(group_ids, REQUEST=REQUEST)
back_url = "groups_view?%s&curtab=tab-photos" % groups_infos.groups_query_args
H = [
@ -548,9 +544,7 @@ def photos_import_files(
context, group_ids=[], xlsfile=None, zipfile=None, REQUEST=None
):
"""Importation des photos"""
groups_infos = sco_groups_view.DisplayedGroupsInfos(
context, group_ids, REQUEST=REQUEST
)
groups_infos = sco_groups_view.DisplayedGroupsInfos(group_ids, REQUEST=REQUEST)
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"

View File

@ -62,7 +62,7 @@ def pdf_trombino_tours(
"""Generation du trombinoscope en fichier PDF"""
# Informations sur les groupes à afficher:
groups_infos = sco_groups_view.DisplayedGroupsInfos(
context, group_ids, formsemestre_id=formsemestre_id, REQUEST=REQUEST
group_ids, formsemestre_id=formsemestre_id, REQUEST=REQUEST
)
DeptName = sco_preferences.get_preference("DeptName")
@ -300,7 +300,7 @@ def pdf_feuille_releve_absences(
# Informations sur les groupes à afficher:
groups_infos = sco_groups_view.DisplayedGroupsInfos(
context, group_ids, formsemestre_id=formsemestre_id, REQUEST=REQUEST
group_ids, formsemestre_id=formsemestre_id, REQUEST=REQUEST
)
DeptName = sco_preferences.get_preference("DeptName")

View File

@ -225,7 +225,6 @@ def external_ue_create_form(context, formsemestre_id, etudid, REQUEST=None):
H = [
html_sco_header.html_sem_header(
context,
REQUEST,
"Ajout d'une UE externe pour %(nomprenom)s" % etud,
sem,

View File

@ -86,7 +86,7 @@ def index_html(context, REQUEST, all_depts=False, with_inactives=False, format="
all_depts = int(all_depts)
with_inactives = int(with_inactives)
H = [html_sco_header.html_sem_header(context, REQUEST, "Gestion des utilisateurs")]
H = [html_sco_header.html_sem_header(REQUEST, "Gestion des utilisateurs")]
if current_user.has_permission(Permission.ScoUsersAdmin, g.scodoc_dept):
H.append(

View File

@ -324,7 +324,7 @@ def SignaleAbsenceGrHebdo(
moduleimpl_id = None
groups_infos = sco_groups_view.DisplayedGroupsInfos(
context, group_ids, moduleimpl_id=moduleimpl_id, REQUEST=REQUEST
group_ids, moduleimpl_id=moduleimpl_id, REQUEST=REQUEST
)
if not groups_infos.members:
return (
@ -415,9 +415,7 @@ def SignaleAbsenceGrHebdo(
datelundi,
destination,
moduleimpl_id or "",
sco_groups_view.menu_groups_choice(
context, groups_infos, submit_on_change=True
),
sco_groups_view.menu_groups_choice(groups_infos, submit_on_change=True),
),
]
#
@ -489,9 +487,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(
context, group_ids, REQUEST=REQUEST
)
groups_infos = sco_groups_view.DisplayedGroupsInfos(group_ids, REQUEST=REQUEST)
if not groups_infos.members:
return (
html_sco_header.sco_header(page_title="Saisie des absences")
@ -865,9 +861,7 @@ def EtatAbsencesGr(
datedebut = ndb.DateDMYtoISO(debut)
datefin = ndb.DateDMYtoISO(fin)
# Informations sur les groupes à afficher:
groups_infos = sco_groups_view.DisplayedGroupsInfos(
context, group_ids, REQUEST=REQUEST
)
groups_infos = sco_groups_view.DisplayedGroupsInfos(group_ids, REQUEST=REQUEST)
formsemestre_id = groups_infos.formsemestre_id
sem = groups_infos.formsemestre
@ -956,7 +950,7 @@ def EtatAbsencesGr(
javascripts=["js/etud_info.js"],
),
html_title=html_sco_header.html_sem_header(
context, REQUEST, "%s" % title, sem, with_page_header=False
REQUEST, "%s" % title, sem, with_page_header=False
)
+ "<p>Période du %s au %s (nombre de <b>demi-journées</b>)<br/>" % (debut, fin),
base_url="%s&formsemestre_id=%s&debut=%s&fin=%s"
@ -997,9 +991,7 @@ def EtatAbsencesDate(
# ported from dtml
"""Etat des absences pour un groupe à une date donnée"""
# Informations sur les groupes à afficher:
groups_infos = sco_groups_view.DisplayedGroupsInfos(
context, group_ids, REQUEST=REQUEST
)
groups_infos = sco_groups_view.DisplayedGroupsInfos(group_ids, REQUEST=REQUEST)
H = [html_sco_header.sco_header(page_title="Etat des absences")]
if date:
dateiso = ndb.DateDMYtoISO(date)

View File

@ -684,7 +684,6 @@ def edit_enseignants_form(context, REQUEST, moduleimpl_id):
M, sem = sco_moduleimpl.can_change_ens(REQUEST, moduleimpl_id)
# --
header = html_sco_header.html_sem_header(
context,
REQUEST,
'Enseignants du <a href="moduleimpl_status?moduleimpl_id=%s">module %s</a>'
% (moduleimpl_id, M["module"]["titre"]),
@ -797,7 +796,6 @@ def edit_moduleimpl_resp(context, REQUEST, moduleimpl_id):
M, sem = sco_moduleimpl.can_change_module_resp(REQUEST, moduleimpl_id)
H = [
html_sco_header.html_sem_header(
context,
REQUEST,
'Modification du responsable du <a href="moduleimpl_status?moduleimpl_id=%s">module %s</a>'
% (moduleimpl_id, M["module"]["titre"]),
@ -904,7 +902,6 @@ def edit_moduleimpl_expr(context, REQUEST, moduleimpl_id):
M, sem = sco_moduleimpl.can_change_ens(REQUEST, moduleimpl_id)
H = [
html_sco_header.html_sem_header(
context,
REQUEST,
'Modification règle de calcul du <a href="moduleimpl_status?moduleimpl_id=%s">module %s</a>'
% (moduleimpl_id, M["module"]["titre"]),
@ -1003,7 +1000,6 @@ def view_module_abs(context, REQUEST, moduleimpl_id, format="html"):
H = [
html_sco_header.html_sem_header(
context,
REQUEST,
'Absences du <a href="moduleimpl_status?moduleimpl_id=%s">module %s</a>'
% (moduleimpl_id, M["module"]["titre"]),
@ -1055,7 +1051,6 @@ def edit_ue_expr(context, REQUEST, formsemestre_id, ue_id):
ue = sco_edit_ue.do_ue_list({"ue_id": ue_id})[0]
H = [
html_sco_header.html_sem_header(
context,
REQUEST,
"Modification règle de calcul de l'UE %s (%s)"
% (ue["acronyme"], ue["titre"]),
@ -1197,15 +1192,13 @@ def formsemestre_enseignants_list(context, REQUEST, formsemestre_id, format="htm
html_class="table_leftalign",
filename=scu.make_filename("Enseignants-" + sem["titreannee"]),
html_title=html_sco_header.html_sem_header(
context, 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),
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),
)
return T.make_page(
page_title=title, title=title, REQUEST=REQUEST, format=format
)
return T.make_page(page_title=title, title=title, REQUEST=REQUEST, format=format)
@bp.route("/edit_enseignants_form_delete", methods=["GET", "POST"])
@ -1453,7 +1446,7 @@ def evaluation_delete(context, REQUEST, evaluation_id):
tit = "Suppression de l'évaluation %(description)s (%(jour)s)" % E
etat = sco_evaluations.do_evaluation_etat(evaluation_id)
H = [
html_sco_header.html_sem_header(context, REQUEST, tit, with_h2=False),
html_sco_header.html_sem_header(REQUEST, tit, with_h2=False),
"""<h2 class="formsemestre">Module <tt>%(code)s</tt> %(titre)s</h2>""" % Mod,
"""<h3>%s</h3>""" % tit,
"""<p class="help">Opération <span class="redboldtext">irréversible</span>. Si vous supprimez l'évaluation, vous ne pourrez pas retrouver les notes associées.</p>""",
@ -1716,7 +1709,7 @@ def formsemestre_bulletins_choice(
"""Choix d'une version de bulletin"""
sem = sco_formsemestre.get_formsemestre(formsemestre_id)
H = [
html_sco_header.html_sem_header(context, REQUEST, title, sem),
html_sco_header.html_sem_header(REQUEST, title, sem),
"""
<form name="f" method="GET" action="%s">
<input type="hidden" name="formsemestre_id" value="%s"></input>
@ -1759,7 +1752,7 @@ def formsemestre_bulletins_mailetuds(
nt = sco_cache.NotesTableCache.get(formsemestre_id) # > get_etudids
etudids = nt.get_etudids()
#
if not sco_bulletins.can_send_bulletin_by_mail(context, formsemestre_id):
if not sco_bulletins.can_send_bulletin_by_mail(formsemestre_id):
raise AccessDenied("vous n'avez pas le droit d'envoyer les bulletins")
# Confirmation dialog
if not dialog_confirmed:

View File

@ -1178,7 +1178,7 @@ def _etudident_create_or_edit_form(context, REQUEST, edit):
# code_nip = initvalues.get("code_nip", "")
# if code_nip:
# try:
# infos = sco_portal_apogee.get_etud_apogee(context, code_nip)
# infos = sco_portal_apogee.get_etud_apogee(code_nip)
# except ValueError:
# infos = None
# pass # XXX a terminer
@ -1191,7 +1191,7 @@ def _etudident_create_or_edit_form(context, REQUEST, edit):
prenom = REQUEST.form.get("prenom", "")
if REQUEST.form.get("tf_submitted", False) and not prenom:
prenom = initvalues.get("prenom", "")
infos = sco_portal_apogee.get_infos_apogee(context, nom, prenom)
infos = sco_portal_apogee.get_infos_apogee(nom, prenom)
if infos:
formatted_infos = [
@ -1626,7 +1626,6 @@ def check_group_apogee(
cnx = ndb.GetDBConnexion()
H = [
html_sco_header.html_sem_header(
context,
REQUEST,
"Etudiants du %s" % (group["group_name"] or "semestre"),
sem,
@ -1646,7 +1645,7 @@ def check_group_apogee(
t["email"],
t["code_nip"],
)
infos = sco_portal_apogee.get_infos_apogee(context, nom, prenom)
infos = sco_portal_apogee.get_infos_apogee(nom, prenom)
if not infos:
info_apogee = (
'<b>Pas d\'information</b> (<a href="etudident_edit_form?etudid=%s">Modifier identité</a>)'
@ -2069,7 +2068,7 @@ def formsemestre_import_etud_admission(
context, formsemestre_id, import_identite=True, import_email=import_email
)
H = [
html_sco_header.html_sem_header(context, REQUEST, "Reimport données admission"),
html_sco_header.html_sem_header(REQUEST, "Reimport données admission"),
"<h3>Opération effectuée</h3>",
]
if no_nip:

View File

@ -99,4 +99,7 @@ do
# fi
done
echo
echo "Terminé. (vous pouvez ignorer les éventuels avertissements de pg_restore ci-dessus !)"
echo
#