small fixes

This commit is contained in:
Emmanuel Viennet 2021-09-27 13:43:11 +02:00
parent 2a1c541fbd
commit b1fa9b8ef8
6 changed files with 27 additions and 9 deletions

View File

@ -2,7 +2,7 @@
# pylint: disable=invalid-name
import os
import re
import reprlib
import socket
import sys
import time
@ -112,7 +112,8 @@ class LogExceptionFormatter(logging.Formatter):
if request.method == "GET":
record.http_params = str(request.args)
else:
record.http_params = "(post data not loggued)"
rep = reprlib.Repr() # abbrège
record.http_params = str(rep.repr(request.form))
else:
record.url = None
record.remote_addr = None

View File

@ -33,7 +33,7 @@ class Departement(db.Model):
semsets = db.relationship("NotesSemSet", lazy="dynamic", backref="departement")
def __repr__(self):
return f"<Departement {self.acronym}>"
return f"<{self.__class__.__name__}(id={self.id}, acronym='{self.acronym}')>"
def to_dict(self):
data = {
@ -44,6 +44,3 @@ class Departement(db.Model):
"date_creation": self.date_creation,
}
return data
def __repr__(self):
return f"<{self.__class__.__name__}(id={self.id}, acronym='{self.acronym}')>"

View File

@ -447,6 +447,7 @@ def retreive_formsemestre_from_request() -> int:
args = request.form
else:
return None
formsemestre_id = None
# Search formsemestre
group_ids = args.get("group_ids", [])
if "formsemestre_id" in args:
@ -479,7 +480,8 @@ def retreive_formsemestre_from_request() -> int:
elif "partition_id" in args:
partition = sco_groups.get_partition(args["partition_id"])
formsemestre_id = partition["formsemestre_id"]
else:
if not formsemestre_id:
return None # no current formsemestre
return int(formsemestre_id)

View File

@ -287,8 +287,10 @@ def formsemestre_inscr_passage(
header = html_sco_header.sco_header(page_title="Passage des étudiants")
footer = html_sco_header.sco_footer()
H = [header]
if type(etuds) == type(""):
if isinstance(etuds, str):
etuds = etuds.split(",") # vient du form de confirmation
elif isinstance(etuds, int):
etuds = [etuds]
auth_etuds_by_sem, inscrits, candidats = list_authorized_etuds_by_sem(sem)
etuds_set = set(etuds)

View File

@ -132,7 +132,7 @@ def formsemestre_synchro_etuds(
inscrits_without_key = inscrits_without_key.split(",")
elif not isinstance(inscrits_without_key, list):
raise ValueError("invalid type for inscrits_without_key")
inscrits_without_key = [int(x) for x in inscrits_without_key]
inscrits_without_key = [int(x) for x in inscrits_without_key if x]
(
etuds_by_cat,
a_importer,

View File

@ -3,3 +3,19 @@
# List of plugins (as comma separated values of python module names) to load,
# usually to register additional checkers.
load-plugins=pylint_flask_sqlalchemy, pylint_flask
[TYPECHECK]
# List of class names for which member attributes should not be checked (useful
# for classes with dynamically set attributes). This supports the use of
# qualified names.
ignored-classes=Permission,
SQLObject,
Registrant,
scoped_session,
func
# List of module names for which member attributes should not be checked
# (useful for modules/projects where namespaces are manipulated during runtime
# and thus existing member attributes cannot be deduced by static analysis). It
# supports qualified module names, as well as Unix pattern matching.
ignored-modules=entreprises