From ba3832bf29dc9a842212dd1d62331f73197446d1 Mon Sep 17 00:00:00 2001 From: Jean-Marie PLACE Date: Sun, 10 Apr 2022 11:01:28 +0200 Subject: [PATCH] nettoyage --- app/forms/main/config_main.py | 67 ++--------------------------------- app/models/config.py | 26 +++----------- app/scodoc/sco_etud.py | 1 - app/scodoc/sco_utils.py | 1 - 4 files changed, 6 insertions(+), 89 deletions(-) diff --git a/app/forms/main/config_main.py b/app/forms/main/config_main.py index 845b9c413..94adc151c 100644 --- a/app/forms/main/config_main.py +++ b/app/forms/main/config_main.py @@ -68,75 +68,12 @@ class ScoDocConfigurationForm(FlaskForm): capitalize_all_ues = BooleanField(label="Capitalise toutes les UE des semestres validés (règles DUT)") allow_null_prenom = BooleanField(label="Autorise les étudiants sans prénom (UCAC)") publish_portal_photo_url = BooleanField(label="Si pas de photo et portail, publie l'url (était vrai jusqu'en oct 2016)") - default_pdf_footer_template = StringField( - label="Pied de page par défaut des documents PDF", - ) - logo_header_height = IntegerField( - label="hauteur en mm du logo d'entête", - ) - logo_footer_height = IntegerField( - label="hauteur en mm du logo de pied de page", - ) - custom_html_header = StringField( - label="Fichier d'entete html", - ) - custom_html_footer = StringField( - label="fichier pied de page html", - ) - custom_html_header_cnx = StringField( - label="Fichier d'entete html (connexion)", - ) - custom_html_footer_cnx = StringField( - label="fichier pied de page html (connexion)", - ) - capitalize_all_ues = BooleanField( - label="Capitalise toutes les UE des semestres validés (règles DUT)", - ) - allow_null_prenom = BooleanField( - label="Autorise les étudiants sans prénom (UCAC)", - ) - publish_portal_photo_url = BooleanField( - label="Si pas de photo et portail, publie l'url (était vrai jusqu'en oct 2016)", - ) - alwways_require_ine = BooleanField(label="Rendre l'INE obligatoire") - etud_max_filesize = IntegerField(label="Taille maximale des fichiers archives étudiants en octets") logo_header_height = IntegerField(label="hauteur en mm du logo d'entête") logo_footer_height = IntegerField(label="hauteur en mm du logo de pied de page") + alwways_require_ine = BooleanField(label="Rendre l'INE obligatoire") + etud_max_filesize = IntegerField(label="Taille maximale des fichiers archives étudiants en octets") - etud_max_filesize = IntegerField( - label="Taille maximale des fichiers archives étudiants en octets", - ) - default_pdf_footer_template = StringField( - label="Pied de page par défaut des documents PDF", - ) - custom_html_header = StringField( - label="Fichier d'entete html", - ) - custom_html_footer = StringField( - label="fichier pied de page html", - ) - custom_html_header_cnx = StringField( - label="Fichier d'entete html (connexion)", - ) - custom_html_footer_cnx = StringField( - label="fichier pied de page html (connexion)", - ) - capitalize_all_ues = BooleanField( - label="Capitalise toutes les UE des semestres validés (règles DUT)", - ) - allow_null_prenom = BooleanField( - label="Autorise les étudiants sans prénom (UCAC)", - ) - publish_portal_photo_url = BooleanField( - label="Si pas de photo et portail, publie l'url (était vrai jusqu'en oct 2016)", - ) - alwways_require_ine = BooleanField( - label="Rendre l'INE obligatoire" - ) - etud_max_filesize = IntegerField( - label="Taille maximale des fichiers archives étudiants en octets", - ) submit = SubmitField("Valider") cancel = SubmitField("Annuler", render_kw={"formnovalidate": True}) diff --git a/app/models/config.py b/app/models/config.py index 85519aab5..f2f77c279 100644 --- a/app/models/config.py +++ b/app/models/config.py @@ -5,10 +5,9 @@ from enum import Enum from flask import flash -from app import db, log, ScoValueError +from app import db, log from app.comp import bonus_spo -from flask_wtf import FlaskForm -from wtforms import SelectField, SubmitField, StringField, BooleanField, IntegerField +from app.scodoc.sco_exceptions import ScoValueError from app.scodoc.sco_codes_parcours import ( ADC, @@ -332,19 +331,6 @@ class ScoDocSiteConfig(db.Model): "DEFAULT_PDF_FOOTER_TEMPLATE": str, "enable_entreprises": bool, } - # BONUS_SPORT = "bonus_sport_func_name" - - # NAMES = { - # # BONUS_SPORT: str, - # "always_require_ine": bool, - # "SCOLAR_FONT": str, - # "SCOLAR_FONT_SIZE": str, - # "SCOLAR_FONT_SIZE_FOOT": str, - # "INSTITUTION_NAME": str, - # "INSTITUTION_ADDRESS": str, - # "INSTITUTION_CITY": str, - # # DEFAULT_PDF_FOOTER_TEMPLATE: str, - # } def __init__(self, name, value): self.name = name @@ -368,9 +354,7 @@ class ScoDocSiteConfig(db.Model): """ if class_name not in cls.get_bonus_sport_class_names(): raise NameError("invalid class name for bonus_sport") - c = ScoDocSiteConfig.query.filter_by( - name=SiteConfig.BONUS_SPORT.db_name() - ).first() + c = ScoDocSiteConfig.query.filter_by(name=SiteConfig.BONUS_SPORT.db_name()).first() if c: log("setting to " + class_name) c.value = class_name @@ -402,9 +386,7 @@ class ScoDocSiteConfig(db.Model): and flash a warning. """ if not class_name: # None or "" - c = ScoDocSiteConfig.query.filter_by( - name=SiteConfig.BONUS_SPORT.db_name() - ).first() + c = ScoDocSiteConfig.query.filter_by(name=SiteConfig.BONUS_SPORT.db_name()).first() if c is None: return None class_name = c.value diff --git a/app/scodoc/sco_etud.py b/app/scodoc/sco_etud.py index 0bcedf31c..894188254 100644 --- a/app/scodoc/sco_etud.py +++ b/app/scodoc/sco_etud.py @@ -38,7 +38,6 @@ from flask import url_for, g from app import email from app import log from app.models.config import SiteConfig -from app.models.config import SiteConfig from app.models import Admission from app.models.etudiants import make_etud_args import app.scodoc.sco_utils as scu diff --git a/app/scodoc/sco_utils.py b/app/scodoc/sco_utils.py index 562f63490..85c7af833 100644 --- a/app/scodoc/sco_utils.py +++ b/app/scodoc/sco_utils.py @@ -76,7 +76,6 @@ INSCRIT = "I" DEMISSION = "D" DEF = "DEF" - # Types de modules class ModuleType(IntEnum): """Code des types de module."""