forked from ScoDoc/ScoDoc
blackify and some minor fixes
This commit is contained in:
parent
3c567aeb18
commit
8d74f8feed
@ -1,7 +1,7 @@
|
||||
|
||||
# SCODOC - gestion de la scolarité
|
||||
|
||||
(c) Emmanuel Viennet 1999 - 2020 (voir LICENCE.txt)
|
||||
(c) Emmanuel Viennet 1999 - 2021 (voir LICENCE.txt)
|
||||
|
||||
|
||||
Installation: voir instructions à jour sur <https://scodoc.org>
|
||||
|
@ -1252,8 +1252,7 @@ class ZScoUsers(
|
||||
security.declareProtected(ScoView, "get_user_name_from_nomplogin")
|
||||
|
||||
def get_user_name_from_nomplogin(self, nomplogin):
|
||||
"""Returns user_name (login) from nomplogin
|
||||
"""
|
||||
"""Returns user_name (login) from nomplogin"""
|
||||
m = re.match(r".*\((.*)\)", nomplogin.strip())
|
||||
if m:
|
||||
return m.group(1)
|
||||
|
0
csv2rules.py
Normal file → Executable file
0
csv2rules.py
Normal file → Executable file
22
dutrules.py
22
dutrules.py
@ -4,7 +4,27 @@
|
||||
#
|
||||
# Command: ./csv2rules.py misc/parcoursDUT.csv
|
||||
#
|
||||
from sco_codes_parcours import *
|
||||
from sco_codes_parcours import (
|
||||
DUTRule,
|
||||
ADC,
|
||||
ADJ,
|
||||
ADM,
|
||||
AJ,
|
||||
ALL,
|
||||
ATB,
|
||||
ATJ,
|
||||
ATT,
|
||||
CMP,
|
||||
NAR,
|
||||
NEXT,
|
||||
RA_OR_NEXT,
|
||||
RA_OR_RS,
|
||||
RAT,
|
||||
REO,
|
||||
REDOANNEE,
|
||||
REDOSEM,
|
||||
RS_OR_NEXT,
|
||||
)
|
||||
|
||||
rules_source_file = "misc/parcoursDUT.csv"
|
||||
|
||||
|
@ -45,9 +45,20 @@ from collections import OrderedDict
|
||||
|
||||
# XML generation package (apt-get install jaxml)
|
||||
import jaxml
|
||||
import json
|
||||
|
||||
from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Frame, PageBreak
|
||||
from reportlab.platypus import Table, TableStyle, Image, KeepInFrame
|
||||
from reportlab.lib.colors import Color
|
||||
from reportlab.lib import styles
|
||||
from reportlab.lib.units import inch, cm, mm
|
||||
from reportlab.rl_config import defaultPageSize # pylint: disable=no-name-in-module
|
||||
|
||||
import sco_utils as scu
|
||||
import sco_excel
|
||||
from sco_pdf import *
|
||||
import sco_pdf
|
||||
from sco_pdf import SU
|
||||
from notes_log import log
|
||||
|
||||
|
||||
def mark_paras(L, tags):
|
||||
@ -280,7 +291,7 @@ class GenTable:
|
||||
if not row:
|
||||
return "<tr></tr>" # empty row
|
||||
|
||||
if self.html_col_width: # XXXX Obsolete ?
|
||||
if self.html_col_width:
|
||||
std = ' style="width:%s;"' % self.html_col_width
|
||||
else:
|
||||
std = ""
|
||||
@ -382,10 +393,6 @@ class GenTable:
|
||||
else:
|
||||
cls = ""
|
||||
|
||||
if self.html_col_width:
|
||||
std = ' style="width:%s;"' % self.html_col_width
|
||||
else:
|
||||
std = ""
|
||||
H = [self.html_before_table, "<table%s%s>" % (hid, cls)]
|
||||
|
||||
line_num = 0
|
||||
@ -438,14 +445,14 @@ class GenTable:
|
||||
if self.xls_link:
|
||||
H.append(
|
||||
' <a href="%s&format=xls">%s</a>'
|
||||
% (self.base_url, ICON_XLS)
|
||||
% (self.base_url, scu.ICON_XLS)
|
||||
)
|
||||
if self.xls_link and self.pdf_link:
|
||||
H.append(" ")
|
||||
if self.pdf_link:
|
||||
H.append(
|
||||
' <a href="%s&format=pdf">%s</a>'
|
||||
% (self.base_url, ICON_PDF)
|
||||
% (self.base_url, scu.ICON_PDF)
|
||||
)
|
||||
H.append("</p>")
|
||||
|
||||
@ -483,10 +490,10 @@ class GenTable:
|
||||
"PDF representation: returns a ReportLab's platypus Table instance"
|
||||
r = []
|
||||
try:
|
||||
PDFLOCK.acquire()
|
||||
sco_pdf.PDFLOCK.acquire()
|
||||
r = self._pdf()
|
||||
finally:
|
||||
PDFLOCK.release()
|
||||
sco_pdf.PDFLOCK.release()
|
||||
return r
|
||||
|
||||
def _pdf(self):
|
||||
@ -513,7 +520,7 @@ class GenTable:
|
||||
CellStyle.leading = 1.0 * self.preferences["SCOLAR_FONT_SIZE"] # vertical space
|
||||
LINEWIDTH = 0.5
|
||||
#
|
||||
titles = ["<para><b>%s</b></para>" % x for x in self.get_titles_list()]
|
||||
# titles = ["<para><b>%s</b></para>" % x for x in self.get_titles_list()]
|
||||
pdf_style_list = []
|
||||
Pt = [
|
||||
[Paragraph(SU(str(x)), CellStyle) for x in line]
|
||||
@ -530,10 +537,10 @@ class GenTable:
|
||||
# log('len(Pt)=%s' % len(Pt))
|
||||
# log( 'line lens=%s' % [ len(x) for x in Pt ] )
|
||||
# log( 'style=\n%s' % pdf_style_list)
|
||||
col_min = min([x[1][0] for x in pdf_style_list])
|
||||
col_max = max([x[2][0] for x in pdf_style_list])
|
||||
lin_min = min([x[1][1] for x in pdf_style_list])
|
||||
lin_max = max([x[2][1] for x in pdf_style_list])
|
||||
# col_min = min([x[1][0] for x in pdf_style_list])
|
||||
# col_max = max([x[2][0] for x in pdf_style_list])
|
||||
# lin_min = min([x[1][1] for x in pdf_style_list])
|
||||
# lin_max = max([x[2][1] for x in pdf_style_list])
|
||||
# log('col_min=%s col_max=%s lin_min=%s lin_max=%s' % (col_min, col_max, lin_min, lin_max))
|
||||
T = Table(Pt, repeatRows=1, colWidths=self.pdf_col_widths, style=pdf_style_list)
|
||||
|
||||
@ -559,7 +566,7 @@ class GenTable:
|
||||
The tag names <table> and <row> can be changed using
|
||||
xml_outer_tag and xml_row_tag
|
||||
"""
|
||||
doc = jaxml.XML_document(encoding=SCO_ENCODING)
|
||||
doc = jaxml.XML_document(encoding=scu.SCO_ENCODING)
|
||||
getattr(doc, self.xml_outer_tag)(
|
||||
id=self.table_id, origin=self.origin or "", caption=self.caption or ""
|
||||
)
|
||||
@ -593,7 +600,7 @@ class GenTable:
|
||||
v = str(v)
|
||||
r[cid] = v
|
||||
d.append(r)
|
||||
return json.dumps(d, encoding=SCO_ENCODING)
|
||||
return json.dumps(d, encoding=scu.SCO_ENCODING)
|
||||
|
||||
def make_page(
|
||||
self,
|
||||
@ -637,11 +644,11 @@ class GenTable:
|
||||
return "\n".join(H)
|
||||
elif format == "pdf":
|
||||
objects = self.pdf()
|
||||
doc = pdf_basic_page(
|
||||
doc = sco_pdf.pdf_basic_page(
|
||||
objects, title=title, preferences=self.preferences, context=context
|
||||
)
|
||||
if publish:
|
||||
return sendPDFFile(REQUEST, doc, filename + ".pdf")
|
||||
return scu.sendPDFFile(REQUEST, doc, filename + ".pdf")
|
||||
else:
|
||||
return doc
|
||||
elif format == "xls":
|
||||
@ -653,16 +660,16 @@ class GenTable:
|
||||
elif format == "text":
|
||||
return self.text()
|
||||
elif format == "csv":
|
||||
return sendCSVFile(REQUEST, self.text(), filename + ".csv")
|
||||
return scu.sendCSVFile(REQUEST, self.text(), filename + ".csv")
|
||||
elif format == "xml":
|
||||
xml = self.xml()
|
||||
if REQUEST and publish:
|
||||
REQUEST.RESPONSE.setHeader("content-type", XML_MIMETYPE)
|
||||
REQUEST.RESPONSE.setHeader("content-type", scu.XML_MIMETYPE)
|
||||
return xml
|
||||
elif format == "json":
|
||||
js = self.json()
|
||||
if REQUEST and publish:
|
||||
REQUEST.RESPONSE.setHeader("content-type", JSON_MIMETYPE)
|
||||
REQUEST.RESPONSE.setHeader("content-type", scu.JSON_MIMETYPE)
|
||||
return js
|
||||
else:
|
||||
log("make_page: format=%s" % format)
|
||||
@ -687,7 +694,7 @@ class SeqGenTable:
|
||||
def excel(self):
|
||||
"""Export des genTables dans un unique fichier excel avec plusieurs feuilles tagguées"""
|
||||
book = sco_excel.Workbook() # Le fichier xls en devenir
|
||||
for (name, gt) in self.genTables.items():
|
||||
for (_, gt) in self.genTables.items():
|
||||
gt.excel(wb=book) # Ecrit dans un fichier excel
|
||||
return book.savetostr()
|
||||
|
||||
|
@ -257,6 +257,5 @@ def sco_header(
|
||||
|
||||
|
||||
def sco_footer(context, REQUEST=None):
|
||||
"""Main HTMl pages footer
|
||||
"""
|
||||
"""Main HTMl pages footer"""
|
||||
return """</div><!-- /gtrcontent -->""" + CUSTOM_HTML_FOOTER + """</body></html>"""
|
||||
|
@ -158,8 +158,7 @@ def sidebar(context, REQUEST=None):
|
||||
|
||||
|
||||
def sidebar_dept(context, REQUEST=None):
|
||||
"""Partie supérieure de la marge de gauche
|
||||
"""
|
||||
"""Partie supérieure de la marge de gauche"""
|
||||
infos = {
|
||||
"BASE0": REQUEST.BASE0,
|
||||
"DeptIntranetTitle": context.get_preference("DeptIntranetTitle"),
|
||||
|
@ -49,7 +49,7 @@ def histogram_notes(notes):
|
||||
"HTML code drawing histogram"
|
||||
if not notes:
|
||||
return ""
|
||||
bins, H = listhistogram.ListHistogram(notes, 21, minmax=(0, 20))
|
||||
_, H = listhistogram.ListHistogram(notes, 21, minmax=(0, 20))
|
||||
D = ['<ul id="vhist-q-graph"><li class="vhist-qtr" id="vhist-q1"><ul>']
|
||||
left = 5
|
||||
colwidth = 16 # must match #q-graph li.bar width in stylesheet
|
||||
|
@ -61,5 +61,5 @@ class CacheFunc:
|
||||
|
||||
def inval_cache(self): # >
|
||||
"clear whole cache"
|
||||
log("inval_cache %s(%s)" % (str(self.func), str(args))) # >
|
||||
log("inval_cache %s" % (str(self.func))) # >
|
||||
self.cache = {}
|
||||
|
@ -88,7 +88,7 @@ def retreive_dept():
|
||||
return ""
|
||||
try:
|
||||
url = REQUEST.URL
|
||||
m = re.match("^.*ScoDoc/(\w+).*$", url)
|
||||
m = re.match(r"^.*ScoDoc/(\w+).*$", url)
|
||||
return m.group(1)
|
||||
except:
|
||||
return ""
|
||||
|
@ -608,7 +608,6 @@ class NotesTable:
|
||||
est_inscrit = False # inscrit à l'un des modules de cette UE ?
|
||||
|
||||
for modimpl in modimpls:
|
||||
mod_ue_id = modimpl["ue"]["ue_id"]
|
||||
# module ne faisant pas partie d'une UE capitalisee
|
||||
val = self._modmoys[modimpl["moduleimpl_id"]].get(etudid, "NI")
|
||||
# si 'NI', etudiant non inscrit a ce module
|
||||
@ -760,7 +759,6 @@ class NotesTable:
|
||||
sem_ects_pot_pro = 0.0
|
||||
|
||||
for ue in self.get_ues():
|
||||
ue_id = ue["ue_id"]
|
||||
# - On calcule la moyenne d'UE courante:
|
||||
if not block_computation:
|
||||
mu = self.comp_etud_moy_ue(etudid, ue_id=ue["ue_id"], cnx=cnx)
|
||||
@ -1000,8 +998,7 @@ class NotesTable:
|
||||
)
|
||||
|
||||
def get_table_moyennes_dict(self):
|
||||
"""{ etudid : (liste des moyennes) } comme get_table_moyennes_triees
|
||||
"""
|
||||
"""{ etudid : (liste des moyennes) } comme get_table_moyennes_triees"""
|
||||
D = {}
|
||||
for t in self.T:
|
||||
D[t[-1]] = t
|
||||
@ -1291,8 +1288,7 @@ class NotesTable:
|
||||
return len(cursor.fetchall()) > 0
|
||||
|
||||
def get_evaluations_etats(self): # evaluation_list_in_sem
|
||||
"""[ {...evaluation et son etat...} ]
|
||||
"""
|
||||
"""[ {...evaluation et son etat...} ]"""
|
||||
if self._evaluations_etats is None:
|
||||
self._evaluations_etats = sco_evaluations.do_evaluation_list_in_sem(
|
||||
self.context, self.formsemestre_id
|
||||
@ -1301,13 +1297,11 @@ class NotesTable:
|
||||
return self._evaluations_etats
|
||||
|
||||
def get_sem_evaluation_etat_list(self):
|
||||
"""Liste des evaluations de ce semestre, avec leur etat
|
||||
"""
|
||||
"""Liste des evaluations de ce semestre, avec leur etat"""
|
||||
return self.get_evaluations_etats()
|
||||
|
||||
def get_mod_evaluation_etat_list(self, moduleimpl_id):
|
||||
"""Liste des évaluations de ce module
|
||||
"""
|
||||
"""Liste des évaluations de ce module"""
|
||||
return [
|
||||
e
|
||||
for e in self.get_evaluations_etats()
|
||||
|
@ -474,8 +474,7 @@ def get_templates_from_distrib(template="avis"):
|
||||
|
||||
# ----------------------------------------------------------------------------------------
|
||||
def table_syntheseAnnotationPE(context, syntheseJury, tag_annotation_pe):
|
||||
"""Génère un fichier excel synthétisant les annotations PE telles qu'inscrites dans les fiches de chaque étudiant
|
||||
"""
|
||||
"""Génère un fichier excel synthétisant les annotations PE telles qu'inscrites dans les fiches de chaque étudiant"""
|
||||
sT = SeqGenTable() # le fichier excel à générer
|
||||
|
||||
# Les etudids des étudiants à afficher, triés par ordre alphabétiques de nom+prénom
|
||||
|
12
pe_jurype.py
12
pe_jurype.py
@ -210,8 +210,7 @@ class JuryPE:
|
||||
|
||||
# ------------------------------------------------------------------------------------------------------------------
|
||||
def get_zipped_data(self):
|
||||
"""returns zipped data with all generated (CSV) files
|
||||
"""
|
||||
"""returns zipped data with all generated (CSV) files"""
|
||||
if self.zipfile:
|
||||
self.zipfile.close()
|
||||
self.zipfile = None
|
||||
@ -868,9 +867,7 @@ class JuryPE:
|
||||
return semDeb["annee_debut"]
|
||||
|
||||
def get_parcoursIUT(self, etudid):
|
||||
"""Renvoie une liste d'infos sur les semestres du parcours d'un étudiant
|
||||
|
||||
"""
|
||||
"""Renvoie une liste d'infos sur les semestres du parcours d'un étudiant"""
|
||||
etudinfo = self.ETUDINFO_DICT[etudid]
|
||||
sems = self.get_semestresDUT_d_un_etudiant(etudid)
|
||||
|
||||
@ -1127,10 +1124,9 @@ class JuryPE:
|
||||
|
||||
# ------------------------------------------------------------------------------------------------------------------
|
||||
def get_cache_notes_d_un_semestre(
|
||||
cls, context, formsemestre_id
|
||||
self, context, formsemestre_id
|
||||
): # inutile en realité !
|
||||
"""Charge la table des notes d'un formsemestre
|
||||
"""
|
||||
"""Charge la table des notes d'un formsemestre"""
|
||||
return context.Notes._getNotesCache().get_NotesTable(
|
||||
context.Notes, formsemestre_id
|
||||
)
|
||||
|
@ -144,8 +144,7 @@ class SetTag(pe_tagtable.TableTag):
|
||||
|
||||
# -------------------------------------------------------------------------------------------------------------------
|
||||
def do_tagdict(self):
|
||||
"""Synthétise la liste des modules pris en compte dans le calcul d'un tag (pour analyse des résultats)
|
||||
"""
|
||||
"""Synthétise la liste des modules pris en compte dans le calcul d'un tag (pour analyse des résultats)"""
|
||||
self.tagdict = {}
|
||||
for semtag in self.SemTagDict.values():
|
||||
for tag in semtag.get_all_tags():
|
||||
|
@ -122,8 +122,7 @@ def remove_accents(input_unicode_str):
|
||||
|
||||
|
||||
def escape_for_latex(s):
|
||||
"""Protège les caractères pour inclusion dans du source LaTeX
|
||||
"""
|
||||
"""Protège les caractères pour inclusion dans du source LaTeX"""
|
||||
if not s:
|
||||
return ""
|
||||
conv = {
|
||||
@ -162,8 +161,7 @@ def list_directory_filenames(path):
|
||||
|
||||
|
||||
def add_local_file_to_zip(zipfile, ziproot, pathname, path_in_zip):
|
||||
"""Read pathname server file and add content to zip under path_in_zip
|
||||
"""
|
||||
"""Read pathname server file and add content to zip under path_in_zip"""
|
||||
rooted_path_in_zip = os.path.join(ziproot, path_in_zip)
|
||||
data = open(pathname).read()
|
||||
zipfile.writestr(rooted_path_in_zip, data)
|
||||
|
@ -64,8 +64,7 @@ def abs_notify(context, etudid, date):
|
||||
|
||||
|
||||
def do_abs_notify(context, sem, etudid, date, nbabs, nbabsjust):
|
||||
"""Given new counts of absences, check if notifications are requested and send them.
|
||||
"""
|
||||
"""Given new counts of absences, check if notifications are requested and send them."""
|
||||
# prefs fallback to global pref if sem is None:
|
||||
if sem:
|
||||
formsemestre_id = sem["formsemestre_id"]
|
||||
@ -131,8 +130,7 @@ def abs_notify_send(
|
||||
|
||||
|
||||
def abs_notify_get_destinations(context, sem, prefs, etudid, date, nbabs, nbabsjust):
|
||||
"""Returns set of destination emails to be notified
|
||||
"""
|
||||
"""Returns set of destination emails to be notified"""
|
||||
formsemestre_id = sem["formsemestre_id"]
|
||||
|
||||
destinations = [] # list of email address to notify
|
||||
@ -282,8 +280,7 @@ def retreive_current_formsemestre(context, etudid, cur_date):
|
||||
|
||||
|
||||
def mod_with_evals_at_date(context, date_abs, etudid):
|
||||
"""Liste des moduleimpls avec des evaluations a la date indiquée
|
||||
"""
|
||||
"""Liste des moduleimpls avec des evaluations a la date indiquée"""
|
||||
req = """SELECT m.* FROM notes_moduleimpl m, notes_evaluation e, notes_moduleimpl_inscription i
|
||||
WHERE m.moduleimpl_id = e.moduleimpl_id AND e.moduleimpl_id = i.moduleimpl_id
|
||||
AND i.etudid = %(etudid)s AND e.jour = %(date_abs)s"""
|
||||
|
@ -62,8 +62,7 @@ _help_txt = """
|
||||
|
||||
|
||||
def apo_compare_csv_form(context, REQUEST=None):
|
||||
"""Form: submit 2 CSV files to compare them.
|
||||
"""
|
||||
"""Form: submit 2 CSV files to compare them."""
|
||||
H = [
|
||||
context.sco_header(REQUEST, page_title="Comparaison de fichiers Apogée"),
|
||||
"""<h2>Comparaison de fichiers Apogée</h2>
|
||||
@ -90,8 +89,7 @@ def apo_compare_csv_form(context, REQUEST=None):
|
||||
|
||||
|
||||
def apo_compare_csv(context, A_file, B_file, autodetect=True, REQUEST=None):
|
||||
"""Page comparing 2 Apogee CSV files
|
||||
"""
|
||||
"""Page comparing 2 Apogee CSV files"""
|
||||
A = _load_apo_data(A_file, autodetect=autodetect)
|
||||
B = _load_apo_data(B_file, autodetect=autodetect)
|
||||
|
||||
@ -182,7 +180,11 @@ def _apo_compare_csv(context, A, B, REQUEST=None):
|
||||
elts_only_B = B_elts - A_elts.intersection(B_elts)
|
||||
L.append(
|
||||
'<span class="val_dif">différents (%d en commun, %d seulement dans A, %d seulement dans B)</span>'
|
||||
% (len(elts_communs), len(elts_only_A), len(elts_only_B),)
|
||||
% (
|
||||
len(elts_communs),
|
||||
len(elts_only_A),
|
||||
len(elts_only_B),
|
||||
)
|
||||
)
|
||||
if elts_only_A:
|
||||
L.append(
|
||||
@ -244,8 +246,7 @@ def _apo_compare_csv(context, A, B, REQUEST=None):
|
||||
|
||||
|
||||
def apo_table_compare_etud_results(context, A, B, REQUEST=None):
|
||||
"""
|
||||
"""
|
||||
""""""
|
||||
D = compare_etuds_res(A, B)
|
||||
T = GenTable(
|
||||
rows=D,
|
||||
|
@ -112,8 +112,7 @@ APO_NEWLINE = "\r\n"
|
||||
|
||||
|
||||
def code_scodoc_to_apo(code):
|
||||
"""Conversion code jury ScoDoc en code Apogée
|
||||
"""
|
||||
"""Conversion code jury ScoDoc en code Apogée"""
|
||||
return {
|
||||
ATT: "AJAC",
|
||||
ATB: "AJAC",
|
||||
@ -241,8 +240,7 @@ VOID_APO_RES = dict(N="", B="", J="", R="", M="")
|
||||
|
||||
|
||||
class ApoEtud(dict):
|
||||
"""Etudiant Apogee:
|
||||
"""
|
||||
"""Etudiant Apogee:"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
@ -701,8 +699,7 @@ class ApoData:
|
||||
self.periode = periode
|
||||
|
||||
def setup(self, context):
|
||||
"""Recherche semestres ScoDoc concernés
|
||||
"""
|
||||
"""Recherche semestres ScoDoc concernés"""
|
||||
self.context = context
|
||||
self.sems_etape = comp_apo_sems(context, self.etape_apogee, self.annee_scolaire)
|
||||
self.etape_formsemestre_ids = {s["formsemestre_id"] for s in self.sems_etape}
|
||||
@ -849,8 +846,7 @@ class ApoData:
|
||||
return L
|
||||
|
||||
def get_etape_apogee(self):
|
||||
"""Le code etape: 'V1RT', donné par le code de l'élément VET
|
||||
"""
|
||||
"""Le code etape: 'V1RT', donné par le code de l'élément VET"""
|
||||
for elt in self.apo_elts.values():
|
||||
if elt.type_objet == "VET":
|
||||
return elt.code
|
||||
@ -893,8 +889,7 @@ class ApoData:
|
||||
f.write(self.column_titles)
|
||||
|
||||
def write_etuds(self, f):
|
||||
"""write apo CSV etuds on f
|
||||
"""
|
||||
"""write apo CSV etuds on f"""
|
||||
for e in self.etuds:
|
||||
fs = [] # e['nip'], e['nom'], e['prenom'], e['naissance'] ]
|
||||
for col_id in self.col_ids:
|
||||
@ -983,8 +978,7 @@ class ApoData:
|
||||
return codes_by_sem
|
||||
|
||||
def build_cr_table(self):
|
||||
"""Table compte rendu des décisions
|
||||
"""
|
||||
"""Table compte rendu des décisions"""
|
||||
CR = [] # tableau compte rendu des decisions
|
||||
for e in self.etuds:
|
||||
cr = {
|
||||
@ -1116,8 +1110,7 @@ def comp_apo_sems(context, etape_apogee, annee_scolaire):
|
||||
|
||||
|
||||
def nar_etuds_table(context, apo_data, NAR_Etuds):
|
||||
"""Liste les NAR -> excel table
|
||||
"""
|
||||
"""Liste les NAR -> excel table"""
|
||||
code_etape = apo_data.etape_apogee
|
||||
today = datetime.datetime.today().strftime("%d/%m/%y")
|
||||
L = []
|
||||
|
@ -49,14 +49,12 @@ EtudsArchive = EtudsArchiver()
|
||||
|
||||
|
||||
def can_edit_etud_archive(context, authuser):
|
||||
"""True si l'utilisateur peut modifier les archives etudiantes
|
||||
"""
|
||||
"""True si l'utilisateur peut modifier les archives etudiantes"""
|
||||
return authuser.has_permission(ScoEtudAddAnnotations, context)
|
||||
|
||||
|
||||
def etud_list_archives_html(context, REQUEST, etudid):
|
||||
"""HTML snippet listing archives
|
||||
"""
|
||||
"""HTML snippet listing archives"""
|
||||
can_edit = can_edit_etud_archive(context, REQUEST.AUTHENTICATED_USER)
|
||||
L = []
|
||||
for archive_id in EtudsArchive.list_obj_archives(context, etudid):
|
||||
@ -122,8 +120,7 @@ def add_archives_info_to_etud_list(context, etuds):
|
||||
|
||||
|
||||
def etud_upload_file_form(context, REQUEST, etudid):
|
||||
"""Page with a form to choose and upload a file, with a description.
|
||||
"""
|
||||
"""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):
|
||||
raise AccessDenied(
|
||||
@ -178,8 +175,7 @@ def etud_upload_file_form(context, REQUEST, etudid):
|
||||
def _store_etud_file_to_new_archive(
|
||||
context, REQUEST, etudid, data, filename, description=""
|
||||
):
|
||||
"""Store data to new archive.
|
||||
"""
|
||||
"""Store data to new archive."""
|
||||
filesize = len(data)
|
||||
if filesize < 10 or filesize > CONFIG.ETUD_MAX_FILE_SIZE:
|
||||
return 0, "Fichier image de taille invalide ! (%d)" % filesize
|
||||
@ -188,8 +184,7 @@ def _store_etud_file_to_new_archive(
|
||||
|
||||
|
||||
def etud_delete_archive(context, REQUEST, etudid, archive_name, dialog_confirmed=False):
|
||||
"""Delete an archive
|
||||
"""
|
||||
"""Delete an archive"""
|
||||
# check permission
|
||||
if not can_edit_etud_archive(context, REQUEST.AUTHENTICATED_USER):
|
||||
raise AccessDenied(
|
||||
@ -218,8 +213,7 @@ def etud_delete_archive(context, REQUEST, etudid, archive_name, dialog_confirmed
|
||||
|
||||
|
||||
def etud_get_archived_file(context, REQUEST, etudid, archive_name, filename):
|
||||
"""Send file to client.
|
||||
"""
|
||||
"""Send file to client."""
|
||||
return EtudsArchive.get_archived_file(
|
||||
context, REQUEST, etudid, archive_name, filename
|
||||
)
|
||||
@ -227,8 +221,7 @@ def etud_get_archived_file(context, REQUEST, etudid, archive_name, filename):
|
||||
|
||||
# --- Upload d'un ensemble de fichiers (pour un groupe d'étudiants)
|
||||
def etudarchive_generate_excel_sample(context, group_id=None, REQUEST=None):
|
||||
"""Feuille excel pour import fichiers etudiants (utilisé pour admissions)
|
||||
"""
|
||||
"""Feuille excel pour import fichiers etudiants (utilisé pour admissions)"""
|
||||
fmt = ImportScolars.sco_import_format()
|
||||
data = ImportScolars.sco_import_generate_excel_sample(
|
||||
fmt,
|
||||
@ -249,8 +242,7 @@ def etudarchive_generate_excel_sample(context, group_id=None, REQUEST=None):
|
||||
|
||||
|
||||
def etudarchive_import_files_form(context, group_id, REQUEST=None):
|
||||
"""Formualaire pour importation fichiers d'un groupe
|
||||
"""
|
||||
"""Formualaire pour importation fichiers d'un groupe"""
|
||||
H = [
|
||||
context.sco_header(
|
||||
REQUEST, page_title="Import de fichiers associés aux étudiants"
|
||||
|
@ -162,4 +162,4 @@ class Baccalaureat:
|
||||
return self.type() == "G"
|
||||
|
||||
def is_techno(self):
|
||||
return selt.type() == "T"
|
||||
return self.type() == "T"
|
||||
|
@ -80,8 +80,7 @@ class BulletinGeneratorLegacy(sco_bulletins_generator.BulletinGenerator):
|
||||
return [self.buildTableObject(P, pdfTableStyle, colWidths)]
|
||||
|
||||
def bul_table_html(self):
|
||||
"""Génère la table centrale du bulletin de notes: chaine HTML
|
||||
"""
|
||||
"""Génère la table centrale du bulletin de notes: chaine HTML"""
|
||||
format = "html"
|
||||
I = self.infos
|
||||
authuser = self.authuser
|
||||
@ -130,14 +129,11 @@ class BulletinGeneratorLegacy(sco_bulletins_generator.BulletinGenerator):
|
||||
continue # saute les modules où on n'est pas inscrit
|
||||
H.append('<tr class="notes_bulletin_row_mod%s">' % rowstyle)
|
||||
if context.get_preference("bul_show_minmax_mod", formsemestre_id):
|
||||
rang_minmax = (
|
||||
'%s <span class="bul_minmax" title="[min, max] UE">[%s, %s]</span>'
|
||||
% (
|
||||
rang_minmax = '%s <span class="bul_minmax" title="[min, max] UE">[%s, %s]</span>' % (
|
||||
mod["mod_rang_txt"],
|
||||
fmt_note(mod["stats"]["min"]),
|
||||
fmt_note(mod["stats"]["max"]),
|
||||
)
|
||||
)
|
||||
else:
|
||||
rang_minmax = mod["mod_rang_txt"] # vide si pas option rang
|
||||
H.append(
|
||||
@ -386,8 +382,7 @@ sco_bulletins_generator.register_bulletin_class(BulletinGeneratorLegacy)
|
||||
|
||||
|
||||
class BulTableStyle:
|
||||
"""Construction du style de tables reportlab platypus pour les bulletins "classiques"
|
||||
"""
|
||||
"""Construction du style de tables reportlab platypus pour les bulletins "classiques" """
|
||||
|
||||
LINEWIDTH = 0.5
|
||||
LINECOLOR = Color(0, 0, 0)
|
||||
|
@ -57,8 +57,7 @@ import os
|
||||
|
||||
|
||||
def form_change_bul_sig(context, side, formsemestre_id=None, REQUEST=None):
|
||||
"""Change pdf signature
|
||||
"""
|
||||
"""Change pdf signature"""
|
||||
filename = _get_sig_existing_filename(
|
||||
context, side, formsemestre_id=formsemestre_id
|
||||
)
|
||||
|
@ -305,5 +305,4 @@ sco_bulletins_generator.register_bulletin_class(BulletinGeneratorUCAC)
|
||||
|
||||
|
||||
def bulletin_table_ucac(context, I, version=None):
|
||||
"""
|
||||
"""
|
||||
""""""
|
||||
|
@ -35,6 +35,7 @@ import thread, time
|
||||
# Cache data
|
||||
class simpleCache:
|
||||
def __init__(self):
|
||||
self.cache = {}
|
||||
self.inval_cache() # >
|
||||
|
||||
def inval_cache(self, key=None): # >
|
||||
|
@ -64,8 +64,7 @@ SCO_DUMP_LOCK = "/tmp/scodump.lock"
|
||||
|
||||
|
||||
def sco_dump_and_send_db(context, REQUEST=None):
|
||||
"""Dump base de données du département courant et l'envoie anonymisée pour debug
|
||||
"""
|
||||
"""Dump base de données du département courant et l'envoie anonymisée pour debug"""
|
||||
H = [context.sco_header(REQUEST, page_title="Assistance technique")]
|
||||
# get currect (dept) DB name:
|
||||
cursor = SimpleQuery(context, "SELECT current_database()", {})
|
||||
@ -150,8 +149,7 @@ def _duplicate_db(db_name, ano_db_name):
|
||||
|
||||
|
||||
def _anonymize_db(ano_db_name):
|
||||
"""Anonymize a departement database
|
||||
"""
|
||||
"""Anonymize a departement database"""
|
||||
cmd = os.path.join(SCO_CONFIG_DIR, "anonymize_db.py")
|
||||
log("_anonymize_db: {}".format(cmd))
|
||||
try:
|
||||
@ -171,8 +169,7 @@ def _get_scodoc_serial(context):
|
||||
|
||||
|
||||
def _send_db(context, REQUEST, ano_db_name):
|
||||
"""Dump this (anonymized) database and send it to tech support
|
||||
"""
|
||||
"""Dump this (anonymized) database and send it to tech support"""
|
||||
log("dumping anonymized database {}".format(ano_db_name))
|
||||
try:
|
||||
data = subprocess.check_output("pg_dump {} | gzip".format(ano_db_name), shell=1)
|
||||
|
@ -37,8 +37,7 @@ import sco_formsemestre
|
||||
|
||||
|
||||
def formation_delete(context, formation_id=None, dialog_confirmed=False, REQUEST=None):
|
||||
"""Delete a formation
|
||||
"""
|
||||
"""Delete a formation"""
|
||||
F = context.formation_list(args={"formation_id": formation_id})
|
||||
if not F:
|
||||
raise ScoValueError("formation inexistante !")
|
||||
@ -89,14 +88,12 @@ def formation_delete(context, formation_id=None, dialog_confirmed=False, REQUEST
|
||||
|
||||
|
||||
def formation_create(context, REQUEST=None):
|
||||
"""Creation d'une formation
|
||||
"""
|
||||
"""Creation d'une formation"""
|
||||
return formation_edit(context, create=True, REQUEST=REQUEST)
|
||||
|
||||
|
||||
def formation_edit(context, formation_id=None, create=False, REQUEST=None):
|
||||
"""Edit or create a formation
|
||||
"""
|
||||
"""Edit or create a formation"""
|
||||
if create:
|
||||
H = [
|
||||
context.sco_header(REQUEST, page_title="Création d'une formation"),
|
||||
|
@ -36,8 +36,7 @@ import sco_formsemestre
|
||||
|
||||
|
||||
def matiere_create(context, ue_id=None, REQUEST=None):
|
||||
"""Creation d'une matiere
|
||||
"""
|
||||
"""Creation d'une matiere"""
|
||||
UE = context.do_ue_list(args={"ue_id": ue_id})[0]
|
||||
H = [
|
||||
context.sco_header(REQUEST, page_title="Création d'une matière"),
|
||||
|
@ -55,8 +55,7 @@ saisir et modifier les notes de ce module.
|
||||
|
||||
|
||||
def module_create(context, matiere_id=None, REQUEST=None):
|
||||
"""Creation d'un module
|
||||
"""
|
||||
"""Creation d'un module"""
|
||||
if not matiere_id:
|
||||
raise ScoValueError("invalid matiere !")
|
||||
M = context.do_matiere_list(args={"matiere_id": matiere_id})[0]
|
||||
@ -436,8 +435,7 @@ def module_list(context, formation_id, REQUEST=None):
|
||||
|
||||
|
||||
def formation_add_malus_modules(context, formation_id, titre=None, REQUEST=None):
|
||||
"""Création d'un module de "malus" dans chaque UE d'une formation
|
||||
"""
|
||||
"""Création d'un module de "malus" dans chaque UE d'une formation"""
|
||||
ue_list = context.do_ue_list(args={"formation_id": formation_id})
|
||||
|
||||
for ue in ue_list:
|
||||
@ -457,8 +455,7 @@ def formation_add_malus_modules(context, formation_id, titre=None, REQUEST=None)
|
||||
|
||||
|
||||
def ue_add_malus_module(context, ue_id, titre=None, code=None, REQUEST=None):
|
||||
"""Add a malus module in this ue
|
||||
"""
|
||||
"""Add a malus module in this ue"""
|
||||
ue = context.do_ue_list(args={"ue_id": ue_id})[0]
|
||||
|
||||
if titre is None:
|
||||
|
@ -41,14 +41,12 @@ import sco_tag_module
|
||||
|
||||
|
||||
def ue_create(context, formation_id=None, REQUEST=None):
|
||||
"""Creation d'une UE
|
||||
"""
|
||||
"""Creation d'une UE"""
|
||||
return ue_edit(context, create=True, formation_id=formation_id, REQUEST=REQUEST)
|
||||
|
||||
|
||||
def ue_edit(context, ue_id=None, create=False, formation_id=None, REQUEST=None):
|
||||
"""Modification ou creation d'une UE
|
||||
"""
|
||||
"""Modification ou creation d'une UE"""
|
||||
create = int(create)
|
||||
if not create:
|
||||
U = context.do_ue_list(args={"ue_id": ue_id})
|
||||
@ -781,8 +779,7 @@ def edit_ue_set_code_apogee(context, id=None, value=None, REQUEST=None):
|
||||
|
||||
# ---- Table recap formation
|
||||
def formation_table_recap(context, formation_id, format="html", REQUEST=None):
|
||||
"""
|
||||
"""
|
||||
""""""
|
||||
F = context.formation_list(args={"formation_id": formation_id})
|
||||
if not F:
|
||||
raise ScoValueError("invalid formation_id")
|
||||
|
@ -67,8 +67,7 @@ def formsemestre_get_ics_url(context, sem):
|
||||
|
||||
|
||||
def formsemestre_load_ics(context, sem):
|
||||
"""Load ics data, from our cache or, when necessary, from external provider
|
||||
"""
|
||||
"""Load ics data, from our cache or, when necessary, from external provider"""
|
||||
# TODO: cacher le résultat
|
||||
ics_url = formsemestre_get_ics_url(context, sem)
|
||||
if not ics_url:
|
||||
@ -86,15 +85,13 @@ def formsemestre_load_ics(context, sem):
|
||||
|
||||
|
||||
def formsemestre_edt_groups_used(context, sem):
|
||||
"""L'ensemble des groupes EDT utilisés dans l'emplois du temps publié
|
||||
"""
|
||||
"""L'ensemble des groupes EDT utilisés dans l'emplois du temps publié"""
|
||||
cal = formsemestre_load_ics(context, sem)
|
||||
return {e["X-GROUP-ID"].decode("utf8") for e in events}
|
||||
|
||||
|
||||
def get_edt_transcodage_groups(context, formsemestre_id):
|
||||
""" -> { nom_groupe_edt : nom_groupe_scodoc }
|
||||
"""
|
||||
"""-> { nom_groupe_edt : nom_groupe_scodoc }"""
|
||||
# TODO: valider ces données au moment où on enregistre les préférences
|
||||
edt2sco = {}
|
||||
sco2edt = {}
|
||||
@ -161,8 +158,7 @@ for e in events:
|
||||
|
||||
|
||||
def experimental_calendar(context, group_id=None, formsemestre_id=None, REQUEST=None):
|
||||
"""experimental page
|
||||
"""
|
||||
"""experimental page"""
|
||||
return "\n".join(
|
||||
[
|
||||
context.sco_header(
|
||||
|
@ -190,8 +190,7 @@ def apo_csv_list_stored_etapes(context, annee_scolaire, sem_id=None, etapes=None
|
||||
|
||||
|
||||
def apo_csv_delete(context, archive_id):
|
||||
"""Delete archived CSV
|
||||
"""
|
||||
"""Delete archived CSV"""
|
||||
ApoCSVArchive.delete_archive(archive_id)
|
||||
|
||||
|
||||
@ -235,8 +234,7 @@ def apo_get_sem_etapes(context, sem):
|
||||
|
||||
|
||||
def apo_csv_check_etape(context, semset, set_nips, etape_apo):
|
||||
"""Check etape vs set of sems
|
||||
"""
|
||||
"""Check etape vs set of sems"""
|
||||
# Etudiants dans la maquette CSV:
|
||||
csv_data = apo_csv_get(
|
||||
context, etape_apo, semset["annee_scolaire"], semset["sem_id"]
|
||||
@ -254,7 +252,10 @@ def apo_csv_check_etape(context, semset, set_nips, etape_apo):
|
||||
|
||||
return nips_ok, apo_nips, nips_no_apo, nips_no_sco, maq_elems, sem_elems
|
||||
|
||||
def apo_csv_semset_check(context, semset, allow_missing_apo=False, allow_missing_csv=False): # was apo_csv_check
|
||||
|
||||
def apo_csv_semset_check(
|
||||
context, semset, allow_missing_apo=False, allow_missing_csv=False
|
||||
): # was apo_csv_check
|
||||
"""
|
||||
check students in stored maqs vs students in semset
|
||||
Cas à détecter:
|
||||
|
@ -58,9 +58,7 @@ def apo_semset_maq_status(
|
||||
block_export_res_sdj=True,
|
||||
REQUEST=None,
|
||||
):
|
||||
"""Page statut / tableau de bord
|
||||
|
||||
"""
|
||||
"""Page statut / tableau de bord"""
|
||||
if not semset_id:
|
||||
raise ValueError("invalid null semset_id")
|
||||
semset = sco_semset.SemSet(context, semset_id=semset_id)
|
||||
@ -91,7 +89,9 @@ def apo_semset_maq_status(
|
||||
apo_dups,
|
||||
maq_elems,
|
||||
sem_elems,
|
||||
) = sco_etape_apogee.apo_csv_semset_check(context, semset, allow_missing_apo, allow_missing_csv)
|
||||
) = sco_etape_apogee.apo_csv_semset_check(
|
||||
context, semset, allow_missing_apo, allow_missing_csv
|
||||
)
|
||||
|
||||
if not allow_missing_decisions:
|
||||
ok_for_export &= semset["jury_ok"]
|
||||
@ -265,9 +265,7 @@ def apo_semset_maq_status(
|
||||
)
|
||||
if allow_missing_csv:
|
||||
H.append("checked")
|
||||
H.append(
|
||||
""" >autoriser export même si étapes sans maquettes</input></div>"""
|
||||
)
|
||||
H.append(""" >autoriser export même si étapes sans maquettes</input></div>""")
|
||||
H.append("""</form>""")
|
||||
|
||||
if semset and ok_for_export:
|
||||
@ -295,7 +293,9 @@ def apo_semset_maq_status(
|
||||
H.append(
|
||||
"""<div><label><input type="checkbox" name="block_export_res_etape" value="1" %s %s>%s</input></label></div>"""
|
||||
% checked(
|
||||
block_export_res_etape, "export_res_etape", "résultat de l'étape (VET), sauf si diplôme"
|
||||
block_export_res_etape,
|
||||
"export_res_etape",
|
||||
"résultat de l'étape (VET), sauf si diplôme",
|
||||
)
|
||||
)
|
||||
H.append(
|
||||
@ -424,8 +424,7 @@ def apo_semset_maq_status(
|
||||
|
||||
|
||||
def table_apo_csv_list(context, semset, REQUEST=None):
|
||||
"""Table des archives (triée par date d'archivage)
|
||||
"""
|
||||
"""Table des archives (triée par date d'archivage)"""
|
||||
annee_scolaire = semset["annee_scolaire"]
|
||||
sem_id = semset["sem_id"]
|
||||
|
||||
@ -481,8 +480,7 @@ def table_apo_csv_list(context, semset, REQUEST=None):
|
||||
|
||||
|
||||
def view_apo_etuds(context, semset_id, title="", nips=[], format="html", REQUEST=None):
|
||||
"""Table des étudiants Apogée par nips
|
||||
"""
|
||||
"""Table des étudiants Apogée par nips"""
|
||||
if not semset_id:
|
||||
raise ValueError("invalid null semset_id")
|
||||
semset = sco_semset.SemSet(context, semset_id=semset_id)
|
||||
@ -520,8 +518,7 @@ def view_apo_etuds(context, semset_id, title="", nips=[], format="html", REQUEST
|
||||
def view_scodoc_etuds(
|
||||
context, semset_id, title="", etudids=None, nips=None, format="html", REQUEST=None
|
||||
):
|
||||
"""Table des étudiants ScoDoc par nips ou etudids
|
||||
"""
|
||||
"""Table des étudiants ScoDoc par nips ou etudids"""
|
||||
if etudids is not None:
|
||||
if type(etudids) != type([]):
|
||||
etudids = [etudids]
|
||||
@ -636,8 +633,7 @@ def view_apo_csv_store(
|
||||
|
||||
|
||||
def view_apo_csv_download_and_store(context, etape_apo="", semset_id="", REQUEST=None):
|
||||
"""Download maquette and store it
|
||||
"""
|
||||
"""Download maquette and store it"""
|
||||
if not semset_id:
|
||||
raise ValueError("invalid null semset_id")
|
||||
semset = sco_semset.SemSet(context, semset_id=semset_id)
|
||||
@ -656,8 +652,7 @@ def view_apo_csv_download_and_store(context, etape_apo="", semset_id="", REQUEST
|
||||
def view_apo_csv_delete(
|
||||
context, etape_apo="", semset_id="", dialog_confirmed=False, REQUEST=None
|
||||
):
|
||||
"""Delete CSV file
|
||||
"""
|
||||
"""Delete CSV file"""
|
||||
if not semset_id:
|
||||
raise ValueError("invalid null semset_id")
|
||||
semset = sco_semset.SemSet(context, semset_id=semset_id)
|
||||
|
@ -237,8 +237,7 @@ class ScoExcelSheet:
|
||||
|
||||
|
||||
def Excel_SimpleTable(titles=[], lines=[[]], SheetName="feuille", titlesStyles=[]):
|
||||
"""Export simple type 'CSV': 1ere ligne en gras, le reste tel quel
|
||||
"""
|
||||
"""Export simple type 'CSV': 1ere ligne en gras, le reste tel quel"""
|
||||
# XXX devrait maintenant utiliser ScoExcelSheet
|
||||
wb = Workbook()
|
||||
ws0 = wb.add_sheet(SheetName.decode(SCO_ENCODING))
|
||||
|
@ -201,8 +201,7 @@ def _build_results_list(context, dpv_by_sem, etuds_infos):
|
||||
|
||||
|
||||
def get_set_formsemestre_id_dates(context, start_date, end_date):
|
||||
"""Ensemble des formsemestre_id entre ces dates
|
||||
"""
|
||||
"""Ensemble des formsemestre_id entre ces dates"""
|
||||
s = SimpleDictFetch(
|
||||
context,
|
||||
"SELECT formsemestre_id FROM notes_formsemestre WHERE date_debut >= %(start_date)s AND date_fin <= %(end_date)s",
|
||||
|
@ -286,8 +286,7 @@ def search_etud_by_name(context, term, REQUEST=None):
|
||||
|
||||
|
||||
def form_search_etud_in_accessible_depts(context, REQUEST):
|
||||
"""Form recherche etudiants pour page accueil ScoDoc
|
||||
"""
|
||||
"""Form recherche etudiants pour page accueil ScoDoc"""
|
||||
authuser = REQUEST.AUTHENTICATED_USER
|
||||
# present form only to authenticated users
|
||||
if not authuser.has_role("Authenticated"):
|
||||
|
@ -690,8 +690,7 @@ def formsemestre_recap_parcours_table(
|
||||
def form_decision_manuelle(
|
||||
context, Se, formsemestre_id, etudid, desturl="", sortcol=None
|
||||
):
|
||||
"""Formulaire pour saisie décision manuelle
|
||||
"""
|
||||
"""Formulaire pour saisie décision manuelle"""
|
||||
H = [
|
||||
"""
|
||||
<script type="text/javascript">
|
||||
@ -1033,8 +1032,7 @@ def formsemestre_fix_validation_ues(context, formsemestre_id, REQUEST=None):
|
||||
|
||||
|
||||
def formsemestre_validation_suppress_etud(context, formsemestre_id, etudid):
|
||||
"""Suppression des decisions de jury pour un etudiant.
|
||||
"""
|
||||
"""Suppression des decisions de jury pour un etudiant."""
|
||||
log("formsemestre_validation_suppress_etud( %s, %s)" % (formsemestre_id, etudid))
|
||||
cnx = context.GetDBConnexion(autocommit=False)
|
||||
cursor = cnx.cursor(cursor_factory=ScoDocCursor)
|
||||
@ -1265,8 +1263,7 @@ def _invalidate_etud_formation_caches(context, etudid, formation_id):
|
||||
|
||||
|
||||
def get_etud_ue_cap_html(context, etudid, formsemestre_id, ue_id, REQUEST=None):
|
||||
"""Ramene bout de HTML pour pouvoir supprimer une validation de cette UE
|
||||
"""
|
||||
"""Ramene bout de HTML pour pouvoir supprimer une validation de cette UE"""
|
||||
valids = SimpleDictFetch(
|
||||
context,
|
||||
"""SELECT SFV.* FROM scolar_formsemestre_validation SFV
|
||||
|
@ -39,8 +39,7 @@ TITLES = ("user_name", "nom", "prenom", "email", "roles", "dept")
|
||||
|
||||
|
||||
def generate_excel_sample():
|
||||
"""generates an excel document suitable to import users
|
||||
"""
|
||||
"""generates an excel document suitable to import users"""
|
||||
style = sco_excel.Excel_MakeStyle(bold=True)
|
||||
titles = TITLES
|
||||
titlesStyles = [style] * len(titles)
|
||||
|
@ -45,8 +45,7 @@ import sco_formsemestre
|
||||
def formsemestre_table_etuds_lycees(
|
||||
context, formsemestre_id, group_lycees=True, only_primo=False
|
||||
):
|
||||
"""Récupère liste d'etudiants avec etat et decision.
|
||||
"""
|
||||
"""Récupère liste d'etudiants avec etat et decision."""
|
||||
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
|
||||
etuds = sco_report.tsp_etud_list(context, formsemestre_id, only_primo=only_primo)[0]
|
||||
if only_primo:
|
||||
@ -60,8 +59,7 @@ def formsemestre_table_etuds_lycees(
|
||||
|
||||
|
||||
def scodoc_table_etuds_lycees(context, format="html", REQUEST=None):
|
||||
"""Table avec _tous_ les étudiants des semestres non verrouillés de _tous_ les départements.
|
||||
"""
|
||||
"""Table avec _tous_ les étudiants des semestres non verrouillés de _tous_ les départements."""
|
||||
semdepts = sco_formsemestre.scodoc_get_all_unlocked_sems(context)
|
||||
etuds = []
|
||||
for (sem, deptcontext) in semdepts:
|
||||
|
@ -41,8 +41,7 @@ import sco_codes_parcours
|
||||
|
||||
|
||||
def list_formsemestres_modalites(context, sems):
|
||||
"""Liste ordonnée des modalités présentes dans ces formsemestres
|
||||
"""
|
||||
"""Liste ordonnée des modalités présentes dans ces formsemestres"""
|
||||
modalites = {}
|
||||
for sem in sems:
|
||||
if sem["modalite"] not in modalites:
|
||||
@ -86,8 +85,7 @@ _modaliteEditor = EditableTable(
|
||||
|
||||
|
||||
def do_modalite_list(context, *args, **kw):
|
||||
"""Liste des modalites
|
||||
"""
|
||||
"""Liste des modalites"""
|
||||
cnx = context.GetDBConnexion()
|
||||
return _modaliteEditor.list(cnx, *args, **kw)
|
||||
|
||||
|
@ -273,9 +273,9 @@ def ficheEtud(context, etudid=None, REQUEST=None):
|
||||
if not context.canSuppressAnnotation(a["id"], REQUEST):
|
||||
a["dellink"] = ""
|
||||
else:
|
||||
a["dellink"] = (
|
||||
'<td class="annodel"><a href="doSuppressAnnotation?etudid=%s&annotation_id=%s">%s</a></td>'
|
||||
% (
|
||||
a[
|
||||
"dellink"
|
||||
] = '<td class="annodel"><a href="doSuppressAnnotation?etudid=%s&annotation_id=%s">%s</a></td>' % (
|
||||
etudid,
|
||||
a["id"],
|
||||
icontag(
|
||||
@ -285,7 +285,6 @@ def ficheEtud(context, etudid=None, REQUEST=None):
|
||||
title="Supprimer cette annotation",
|
||||
),
|
||||
)
|
||||
)
|
||||
alist.append(
|
||||
'<tr><td><span class="annodate">Le %(date)s par %(zope_authenticated_user)s : </span><span class="annoc">%(comment)s</span></td>%(dellink)s</tr>'
|
||||
% a
|
||||
@ -486,8 +485,7 @@ def ficheEtud(context, etudid=None, REQUEST=None):
|
||||
|
||||
|
||||
def menus_etud(context, REQUEST=None):
|
||||
"""Menu etudiant (operations sur l'etudiant)
|
||||
"""
|
||||
"""Menu etudiant (operations sur l'etudiant)"""
|
||||
if not REQUEST.form.has_key("etudid"):
|
||||
return ""
|
||||
authuser = REQUEST.AUTHENTICATED_USER
|
||||
|
@ -41,7 +41,7 @@ from reportlab.platypus import Table, TableStyle, Image, KeepInFrame
|
||||
from reportlab.platypus.flowables import Flowable
|
||||
from reportlab.platypus.doctemplate import PageTemplate, BaseDocTemplate
|
||||
from reportlab.lib.styles import getSampleStyleSheet
|
||||
from reportlab.rl_config import defaultPageSize
|
||||
from reportlab.rl_config import defaultPageSize # pylint: disable=no-name-in-module
|
||||
from reportlab.lib.units import inch, cm, mm
|
||||
from reportlab.lib.colors import pink, black, red, blue, green, magenta, red
|
||||
from reportlab.lib.colors import Color
|
||||
|
@ -197,7 +197,9 @@ def do_placement_selectetuds(context, REQUEST):
|
||||
numbering = tf[2]["numbering"]
|
||||
if columns in ("3", "4", "5", "6", "7", "8"):
|
||||
gs = [("group_ids%3Alist=" + urllib.quote_plus(x)) for x in group_ids]
|
||||
query = "evaluation_id=%s&placement_method=%s&teachers=%s&building=%s&room=%s&columns=%s&numbering=%s&" % (
|
||||
query = (
|
||||
"evaluation_id=%s&placement_method=%s&teachers=%s&building=%s&room=%s&columns=%s&numbering=%s&"
|
||||
% (
|
||||
evaluation_id,
|
||||
placement_method,
|
||||
teachers,
|
||||
@ -205,8 +207,8 @@ def do_placement_selectetuds(context, REQUEST):
|
||||
room,
|
||||
columns,
|
||||
numbering,
|
||||
) + "&".join(
|
||||
gs
|
||||
)
|
||||
+ "&".join(gs)
|
||||
)
|
||||
return REQUEST.RESPONSE.redirect(REQUEST.URL1 + "/do_placement?" + query)
|
||||
else:
|
||||
@ -385,8 +387,7 @@ def do_placement(context, REQUEST):
|
||||
|
||||
|
||||
def placement_eval_selectetuds(context, evaluation_id, REQUEST=None):
|
||||
"""Dialogue placement etudiants: choix methode et localisation
|
||||
"""
|
||||
"""Dialogue placement etudiants: choix methode et localisation"""
|
||||
evals = context.do_evaluation_list({"evaluation_id": evaluation_id})
|
||||
if not evals:
|
||||
raise ScoValueError("invalid evaluation_id")
|
||||
|
@ -41,8 +41,7 @@ from sco_codes_parcours import code_semestre_validant, code_semestre_attente
|
||||
|
||||
|
||||
def etud_get_poursuite_info(context, sem, etud):
|
||||
"""{ 'nom' : ..., 'semlist' : [ { 'semestre_id': , 'moy' : ... }, {}, ...] }
|
||||
"""
|
||||
"""{ 'nom' : ..., 'semlist' : [ { 'semestre_id': , 'moy' : ... }, {}, ...] }"""
|
||||
I = {}
|
||||
I.update(etud) # copie nom, prenom, sexe, ...
|
||||
|
||||
@ -153,8 +152,7 @@ def _flatten_info(info):
|
||||
def formsemestre_poursuite_report(
|
||||
context, formsemestre_id, format="html", REQUEST=None
|
||||
):
|
||||
"""Table avec informations "poursuite"
|
||||
"""
|
||||
"""Table avec informations "poursuite" """
|
||||
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
|
||||
nt = context._getNotesCache().get_NotesTable(context, formsemestre_id)
|
||||
etuds = context.getEtudInfoGroupes(
|
||||
|
@ -270,8 +270,7 @@ def do_evaluation_upload_xls(context, REQUEST):
|
||||
def do_evaluation_set_missing(
|
||||
context, evaluation_id, value, REQUEST=None, dialog_confirmed=False
|
||||
):
|
||||
"""Initialisation des notes manquantes
|
||||
"""
|
||||
"""Initialisation des notes manquantes"""
|
||||
authuser = REQUEST.AUTHENTICATED_USER
|
||||
evaluation_id = REQUEST.form["evaluation_id"]
|
||||
E = context.do_evaluation_list({"evaluation_id": evaluation_id})[0]
|
||||
@ -547,9 +546,9 @@ def _notes_add(context, uid, evaluation_id, notes, comment=None, do_it=True):
|
||||
|
||||
|
||||
def saisie_notes_tableur(context, evaluation_id, group_ids=[], REQUEST=None):
|
||||
"""Saisie des notes via un fichier Excel
|
||||
"""
|
||||
"""Saisie des notes via un fichier Excel"""
|
||||
authuser = REQUEST.AUTHENTICATED_USER
|
||||
authusername = str(authuser)
|
||||
evals = context.do_evaluation_list({"evaluation_id": evaluation_id})
|
||||
if not evals:
|
||||
raise ScoValueError("invalid evaluation_id")
|
||||
@ -724,8 +723,7 @@ def saisie_notes_tableur(context, evaluation_id, group_ids=[], REQUEST=None):
|
||||
|
||||
|
||||
def feuille_saisie_notes(context, evaluation_id, group_ids=[], REQUEST=None):
|
||||
"""Document Excel pour saisie notes dans l'évaluation et les groupes indiqués
|
||||
"""
|
||||
"""Document Excel pour saisie notes dans l'évaluation et les groupes indiqués"""
|
||||
evals = context.do_evaluation_list({"evaluation_id": evaluation_id})
|
||||
if not evals:
|
||||
raise ScoValueError("invalid evaluation_id")
|
||||
@ -825,8 +823,7 @@ def has_existing_decision(context, M, E, etudid):
|
||||
|
||||
|
||||
def saisie_notes(context, evaluation_id, group_ids=[], REQUEST=None):
|
||||
"""Formulaire saisie notes d'une évaluation pour un groupe
|
||||
"""
|
||||
"""Formulaire saisie notes d'une évaluation pour un groupe"""
|
||||
authuser = REQUEST.AUTHENTICATED_USER
|
||||
authusername = str(authuser)
|
||||
|
||||
@ -1182,8 +1179,7 @@ def _form_saisie_notes(context, E, M, group_ids, REQUEST=None):
|
||||
def save_note(
|
||||
context, etudid=None, evaluation_id=None, value=None, comment="", REQUEST=None
|
||||
):
|
||||
"""Enregistre une note (ajax)
|
||||
"""
|
||||
"""Enregistre une note (ajax)"""
|
||||
authuser = REQUEST.AUTHENTICATED_USER
|
||||
log(
|
||||
"save_note: evaluation_id=%s etudid=%s uid=%s value=%s"
|
||||
|
@ -63,8 +63,7 @@ semset_delete = _semset_editor.delete
|
||||
|
||||
class SemSet(dict):
|
||||
def __init__(self, context, semset_id=None, title="", annee_scolaire="", sem_id=""):
|
||||
"""Load and init, or, if semset_id is not specified, create
|
||||
"""
|
||||
"""Load and init, or, if semset_id is not specified, create"""
|
||||
if not annee_scolaire and not semset_id:
|
||||
# on autorise annee_scolaire null si sem_id pour pouvoir lire les anciens semsets
|
||||
# mal construits...
|
||||
@ -201,8 +200,7 @@ class SemSet(dict):
|
||||
return etapes
|
||||
|
||||
def list_possible_sems(self):
|
||||
"""List sems that can be added to this set
|
||||
"""
|
||||
"""List sems that can be added to this set"""
|
||||
sems = sco_formsemestre.do_formsemestre_list(self.context)
|
||||
# remove sems already here:
|
||||
sems = [
|
||||
@ -243,8 +241,7 @@ class SemSet(dict):
|
||||
self["jury_ok"] &= sem["jury_ok"]
|
||||
|
||||
def html_descr(self):
|
||||
"""Short HTML description
|
||||
"""
|
||||
"""Short HTML description"""
|
||||
H = [
|
||||
"""<span class="box_title">Ensemble de semestres %(title)s</span>""" % self
|
||||
]
|
||||
@ -354,7 +351,7 @@ def do_semset_create(context, title="", annee_scolaire=None, sem_id=None, REQUES
|
||||
"do_semset_create(title=%s, annee_scolaire=%s, sem_id=%s)"
|
||||
% (title, annee_scolaire, sem_id)
|
||||
)
|
||||
s = SemSet(context, title=title, annee_scolaire=annee_scolaire, sem_id=sem_id)
|
||||
SemSet(context, title=title, annee_scolaire=annee_scolaire, sem_id=sem_id)
|
||||
return REQUEST.RESPONSE.redirect("semset_page")
|
||||
|
||||
|
||||
@ -376,12 +373,11 @@ def do_semset_delete(context, semset_id, dialog_confirmed=False, REQUEST=None):
|
||||
|
||||
|
||||
def edit_semset_set_title(context, id=None, value=None, REQUEST=None):
|
||||
"""Change title of semset
|
||||
"""
|
||||
"""Change title of semset"""
|
||||
title = value.strip()
|
||||
if not id:
|
||||
raise ScoValueError("empty semset_id")
|
||||
s = SemSet(context, semset_id=id)
|
||||
SemSet(context, semset_id=id)
|
||||
cnx = context.GetDBConnexion()
|
||||
semset_edit(cnx, {"semset_id": id, "title": title})
|
||||
return title
|
||||
@ -393,7 +389,7 @@ def do_semset_add_sem(context, semset_id, formsemestre_id, REQUEST=None):
|
||||
raise ScoValueError("empty semset_id")
|
||||
s = SemSet(context, semset_id=semset_id)
|
||||
# check for valid formsemestre_id
|
||||
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id) # raise exc
|
||||
_ = sco_formsemestre.get_formsemestre(context, formsemestre_id) # raise exc
|
||||
|
||||
s.add(formsemestre_id)
|
||||
|
||||
@ -431,9 +427,10 @@ def semset_page(context, format="html", REQUEST=None):
|
||||
# (remplacé par n liens vers chacun des semestres)
|
||||
# s['_semtitles_str_target'] = s['_export_link_target']
|
||||
# Experimental:
|
||||
s["_title_td_attrs"] = (
|
||||
'class="inplace_edit" data-url="edit_semset_set_title" id="%s"'
|
||||
% (s["semset_id"])
|
||||
s[
|
||||
"_title_td_attrs"
|
||||
] = 'class="inplace_edit" data-url="edit_semset_set_title" id="%s"' % (
|
||||
s["semset_id"]
|
||||
)
|
||||
|
||||
tab = GenTable(
|
||||
|
@ -53,8 +53,7 @@ from notes_log import log
|
||||
|
||||
|
||||
class ScoTag:
|
||||
"""Generic tags for ScoDoc
|
||||
"""
|
||||
"""Generic tags for ScoDoc"""
|
||||
|
||||
# must be overloaded:
|
||||
tag_table = None # table (tag_id, title)
|
||||
@ -62,8 +61,7 @@ class ScoTag:
|
||||
obj_colname = None # column name for object_id in assoc_table
|
||||
|
||||
def __init__(self, context, title, object_id=""):
|
||||
"""Load tag, or create if does not exist
|
||||
"""
|
||||
"""Load tag, or create if does not exist"""
|
||||
self.context = context
|
||||
self.title = title.strip()
|
||||
if not self.title:
|
||||
@ -153,16 +151,14 @@ class ScoTag:
|
||||
|
||||
|
||||
class ModuleTag(ScoTag):
|
||||
"""Tags sur les modules dans les programmes pédagogiques
|
||||
"""
|
||||
"""Tags sur les modules dans les programmes pédagogiques"""
|
||||
|
||||
tag_table = "notes_tags" # table (tag_id, title)
|
||||
assoc_table = "notes_modules_tags" # table (tag_id, object_id)
|
||||
obj_colname = "module_id" # column name for object_id in assoc_table
|
||||
|
||||
def list_modules(self, formation_code=""):
|
||||
"""Liste des modules des formations de code donné (formation_code) avec ce tag
|
||||
"""
|
||||
"""Liste des modules des formations de code donné (formation_code) avec ce tag"""
|
||||
args = {"tag_id": self.tag_id}
|
||||
if not formation_code:
|
||||
# tous les modules de toutes les formations !
|
||||
@ -212,8 +208,7 @@ def module_tag_search(context, term, REQUEST=None):
|
||||
|
||||
|
||||
def module_tag_list(context, module_id=""):
|
||||
"""les noms de tags associés à ce module
|
||||
"""
|
||||
"""les noms de tags associés à ce module"""
|
||||
r = SimpleDictFetch(
|
||||
context,
|
||||
"""SELECT t.title
|
||||
|
@ -66,8 +66,7 @@ def pdf_trombino_tours(
|
||||
formsemestre_id=None, # utilisé si pas de groupes selectionné
|
||||
REQUEST=None,
|
||||
):
|
||||
"""Generation du trombinoscope en fichier PDF
|
||||
"""
|
||||
"""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
|
||||
@ -294,8 +293,7 @@ def pdf_feuille_releve_absences(
|
||||
formsemestre_id=None, # utilisé si pas de groupes selectionné
|
||||
REQUEST=None,
|
||||
):
|
||||
"""Generation de la feuille d'absence en fichier PDF, avec photos
|
||||
"""
|
||||
"""Generation de la feuille d'absence en fichier PDF, avec photos"""
|
||||
|
||||
NB_CELL_AM = context.get_preference("feuille_releve_abs_AM")
|
||||
NB_CELL_PM = context.get_preference("feuille_releve_abs_PM")
|
||||
|
@ -72,8 +72,7 @@ def external_ue_create(
|
||||
ects=0.0,
|
||||
REQUEST=None,
|
||||
):
|
||||
"""Crée UE/matiere/module/evaluation puis saisie les notes
|
||||
"""
|
||||
"""Crée UE/matiere/module/evaluation puis saisie les notes"""
|
||||
log("external_ue_create( formsemestre_id=%s, titre=%s )" % (formsemestre_id, titre))
|
||||
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
|
||||
# Contrôle d'accès:
|
||||
@ -203,6 +202,7 @@ def external_ue_create_form(context, formsemestre_id, etudid, REQUEST=None):
|
||||
Note: pour l'édition éventuelle de ces informations, on utilisera les
|
||||
fonctions standards sur les UE/modules/notes
|
||||
"""
|
||||
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
|
||||
# Contrôle d'accès:
|
||||
authuser = REQUEST.AUTHENTICATED_USER
|
||||
if not authuser.has_permission(ScoImplement, context):
|
||||
@ -210,9 +210,7 @@ def external_ue_create_form(context, formsemestre_id, etudid, REQUEST=None):
|
||||
raise AccessDenied("vous n'avez pas le droit d'effectuer cette opération")
|
||||
|
||||
etud = context.getEtudInfo(etudid=etudid, filled=1, REQUEST=REQUEST)[0]
|
||||
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
|
||||
formation_id = sem["formation_id"]
|
||||
F = context.formation_list(args={"formation_id": formation_id})[0]
|
||||
existing_external_ue = get_existing_external_ue(context, formation_id)
|
||||
|
||||
H = [
|
||||
|
@ -123,8 +123,7 @@ def is_up_to_date(context):
|
||||
|
||||
|
||||
def html_up_to_date_box(context):
|
||||
"""
|
||||
"""
|
||||
""""""
|
||||
status, msg = is_up_to_date(context)
|
||||
if status:
|
||||
return ""
|
||||
|
@ -57,8 +57,7 @@ def logdb(REQUEST=None, cnx=None, method=None, etudid=None, msg=None, commit=Tru
|
||||
|
||||
|
||||
def loglist(cnx, method=None, authenticated_user=None):
|
||||
"""List of events logged for these method and user
|
||||
"""
|
||||
"""List of events logged for these method and user"""
|
||||
cursor = cnx.cursor(cursor_factory=ScoDocCursor)
|
||||
cursor.execute(
|
||||
"select * from scolog where method=%(method)s and authenticated_user=%(authenticated_user)s",
|
||||
|
Loading…
Reference in New Issue
Block a user