2021-07-04 12:32:13 +02:00
|
|
|
# -*- mode: python -*-
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
#
|
|
|
|
# ScoDoc
|
|
|
|
#
|
2023-12-31 23:04:06 +01:00
|
|
|
# Copyright (c) 1999 - 2024 Emmanuel Viennet. All rights reserved.
|
2021-07-04 12:32:13 +02:00
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
#
|
|
|
|
# Emmanuel Viennet emmanuel.viennet@viennet.net
|
|
|
|
#
|
|
|
|
##############################################################################
|
|
|
|
|
|
|
|
"""
|
|
|
|
Module main: page d'accueil, avec liste des départements
|
|
|
|
|
|
|
|
Emmanuel Viennet, 2021
|
|
|
|
"""
|
2021-12-11 17:20:34 +01:00
|
|
|
import datetime
|
2021-11-07 09:19:27 +01:00
|
|
|
import io
|
2022-01-27 18:12:40 +01:00
|
|
|
import re
|
2021-11-07 09:19:27 +01:00
|
|
|
|
2021-07-04 12:32:13 +02:00
|
|
|
import flask
|
2022-02-12 14:59:18 +01:00
|
|
|
from flask import (
|
|
|
|
abort,
|
|
|
|
flash,
|
|
|
|
make_response,
|
|
|
|
redirect,
|
|
|
|
render_template,
|
|
|
|
send_file,
|
|
|
|
url_for,
|
|
|
|
)
|
2021-07-28 09:51:18 +02:00
|
|
|
from flask import request
|
2021-09-11 19:05:19 +02:00
|
|
|
import flask_login
|
2021-11-07 09:19:27 +01:00
|
|
|
from flask_login.utils import login_required, current_user
|
2022-01-21 00:46:45 +01:00
|
|
|
from PIL import Image as PILImage
|
|
|
|
|
2021-09-08 23:00:01 +02:00
|
|
|
from werkzeug.exceptions import BadRequest, NotFound
|
|
|
|
|
2022-01-21 00:46:45 +01:00
|
|
|
|
2023-12-28 23:05:19 +01:00
|
|
|
from app import db, log
|
2024-04-09 00:36:46 +02:00
|
|
|
from app import entreprises
|
2023-09-04 21:34:23 +02:00
|
|
|
from app.auth.models import User, Role
|
2023-02-26 21:36:25 +01:00
|
|
|
from app.auth.cas import set_cas_configuration
|
2022-03-19 22:00:31 +01:00
|
|
|
from app.decorators import (
|
|
|
|
admin_required,
|
|
|
|
scodoc7func,
|
|
|
|
scodoc,
|
|
|
|
)
|
2023-09-29 21:17:31 +02:00
|
|
|
from app.forms.generic import SimpleConfirmationForm
|
2022-01-25 23:48:39 +01:00
|
|
|
from app.forms.main import config_logos, config_main
|
2024-04-09 00:36:46 +02:00
|
|
|
from app.forms.main.activate_entreprises import ActivateEntreprisesForm
|
2023-07-31 16:14:16 +02:00
|
|
|
from app.forms.main.config_assiduites import ConfigAssiduitesForm
|
2022-01-21 00:46:45 +01:00
|
|
|
from app.forms.main.config_apo import CodesDecisionsForm
|
2023-02-26 21:24:07 +01:00
|
|
|
from app.forms.main.config_cas import ConfigCASForm
|
2023-07-31 16:14:16 +02:00
|
|
|
from app.forms.main.config_personalized_links import PersonalizedLinksForm
|
|
|
|
from app.forms.main.create_dept import CreateDeptForm
|
2023-09-29 21:17:31 +02:00
|
|
|
from app.forms.main.role_create import CreateRoleForm
|
2024-01-20 19:29:32 +01:00
|
|
|
from app.forms.main.config_rgpd import ConfigRGPDForm
|
2023-09-29 21:17:31 +02:00
|
|
|
|
2022-01-21 00:46:45 +01:00
|
|
|
from app import models
|
2023-07-31 16:14:16 +02:00
|
|
|
from app.models import (
|
|
|
|
Departement,
|
|
|
|
FormSemestre,
|
|
|
|
FormSemestreInscription,
|
|
|
|
Identite,
|
|
|
|
ScoDocSiteConfig,
|
|
|
|
UniteEns,
|
|
|
|
)
|
2021-12-23 16:03:30 +01:00
|
|
|
from app.models import departements
|
2023-07-31 16:14:16 +02:00
|
|
|
from app.models.config import PersonalizedLink
|
|
|
|
|
2023-11-14 15:55:52 +01:00
|
|
|
from app.scodoc import sco_edt_cal
|
2021-07-28 09:51:18 +02:00
|
|
|
from app.scodoc import sco_find_etud
|
2022-03-19 22:00:31 +01:00
|
|
|
from app.scodoc import sco_logos
|
2021-09-08 23:00:01 +02:00
|
|
|
from app.scodoc import sco_utils as scu
|
2022-03-19 22:00:31 +01:00
|
|
|
|
2023-02-27 10:20:59 +01:00
|
|
|
from app.scodoc.sco_exceptions import AccessDenied, ScoValueError
|
2021-07-04 12:32:13 +02:00
|
|
|
from app.scodoc.sco_permissions import Permission
|
2023-09-29 21:17:31 +02:00
|
|
|
from app.scodoc.sco_roles_default import SCO_ROLES_DEFAULTS
|
2021-08-13 09:31:49 +02:00
|
|
|
from app.views import scodoc_bp as bp
|
2022-01-21 00:46:45 +01:00
|
|
|
import sco_version
|
2021-11-07 09:19:27 +01:00
|
|
|
|
2021-07-04 12:32:13 +02:00
|
|
|
|
2021-08-17 22:11:35 +02:00
|
|
|
@bp.route("/")
|
2021-07-04 12:32:13 +02:00
|
|
|
@bp.route("/ScoDoc")
|
|
|
|
@bp.route("/ScoDoc/index")
|
2021-08-13 09:31:49 +02:00
|
|
|
def index():
|
|
|
|
"Page d'accueil: liste des départements"
|
2022-01-04 18:10:14 +01:00
|
|
|
depts = Departement.query.filter_by().order_by(Departement.acronym).all()
|
2021-07-04 12:32:13 +02:00
|
|
|
return render_template(
|
2023-01-30 22:25:17 +01:00
|
|
|
"scodoc.j2",
|
2021-08-21 17:07:44 +02:00
|
|
|
title=sco_version.SCONAME,
|
2021-07-04 12:32:13 +02:00
|
|
|
current_app=flask.current_app,
|
2021-08-13 09:31:49 +02:00
|
|
|
depts=depts,
|
2021-07-04 12:32:13 +02:00
|
|
|
Permission=Permission,
|
2022-01-06 23:37:57 +01:00
|
|
|
scu=scu,
|
2021-07-04 12:32:13 +02:00
|
|
|
)
|
2021-07-28 09:51:18 +02:00
|
|
|
|
|
|
|
|
2021-10-04 22:30:57 +02:00
|
|
|
# Renvoie les url /ScoDoc/RT/ vers /ScoDoc/RT/Scolarite
|
|
|
|
@bp.route("/ScoDoc/<scodoc_dept>/")
|
|
|
|
def index_dept(scodoc_dept):
|
|
|
|
return redirect(url_for("scolar.index_html", scodoc_dept=scodoc_dept))
|
|
|
|
|
|
|
|
|
2021-12-23 16:03:30 +01:00
|
|
|
@bp.route("/ScoDoc/create_dept", methods=["GET", "POST"])
|
|
|
|
@admin_required
|
|
|
|
def create_dept():
|
|
|
|
"""Form création département"""
|
|
|
|
form = CreateDeptForm()
|
|
|
|
if request.method == "POST" and form.cancel.data: # cancel button
|
|
|
|
return redirect(url_for("scodoc.index"))
|
|
|
|
if form.validate_on_submit():
|
2022-01-05 16:06:56 +01:00
|
|
|
departements.create_dept(
|
|
|
|
form.acronym.data,
|
|
|
|
visible=form.visible.data,
|
|
|
|
# description=form.description.data,
|
|
|
|
)
|
2021-12-23 16:03:30 +01:00
|
|
|
flash(f"Département {form.acronym.data} créé.")
|
|
|
|
return redirect(url_for("scodoc.index"))
|
|
|
|
return render_template(
|
2023-01-30 22:25:17 +01:00
|
|
|
"create_dept.j2",
|
2021-12-23 16:03:30 +01:00
|
|
|
form=form,
|
|
|
|
title="Création d'un nouveau département",
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2022-02-15 13:15:56 +01:00
|
|
|
@bp.route("/ScoDoc/toggle_dept_vis/<int:dept_id>", methods=["GET", "POST"])
|
2022-01-04 18:10:14 +01:00
|
|
|
@admin_required
|
|
|
|
def toggle_dept_vis(dept_id):
|
|
|
|
"""Cache ou rend visible un dept"""
|
|
|
|
dept = Departement.query.get_or_404(dept_id)
|
|
|
|
dept.visible = not dept.visible
|
|
|
|
db.session.add(dept)
|
|
|
|
db.session.commit()
|
|
|
|
return redirect(url_for("scodoc.index"))
|
|
|
|
|
|
|
|
|
2023-09-04 21:34:23 +02:00
|
|
|
@bp.route("/ScoDoc/config_roles", methods=["GET", "POST"])
|
|
|
|
@admin_required
|
|
|
|
def config_roles():
|
|
|
|
"""Form associations rôles / permissions"""
|
|
|
|
permissions_names = sorted(Permission.permission_by_value.values())
|
|
|
|
roles = Role.query.order_by(Role.name).all()
|
|
|
|
return render_template(
|
2024-01-06 14:32:06 +01:00
|
|
|
"scodoc/config_roles.j2",
|
2023-09-04 21:34:23 +02:00
|
|
|
Permission=Permission,
|
|
|
|
permissions_names=permissions_names,
|
|
|
|
roles=roles,
|
2023-09-29 21:17:31 +02:00
|
|
|
SCO_ROLES_DEFAULTS=SCO_ROLES_DEFAULTS,
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2024-01-20 19:29:32 +01:00
|
|
|
@bp.route("/ScoDoc/config_rgpd", methods=["GET", "POST"])
|
|
|
|
@admin_required
|
|
|
|
def config_rgpd():
|
|
|
|
"""Form configuration RGPD"""
|
|
|
|
form = ConfigRGPDForm()
|
|
|
|
if request.method == "POST" and form.cancel.data: # cancel button
|
|
|
|
return redirect(url_for("scodoc.configuration"))
|
|
|
|
if form.validate_on_submit():
|
|
|
|
if ScoDocSiteConfig.set(
|
|
|
|
"rgpd_coordonnees_dpo", form.data["rgpd_coordonnees_dpo"]
|
|
|
|
):
|
|
|
|
flash("coordonnées DPO enregistrées")
|
|
|
|
return redirect(url_for("scodoc.configuration"))
|
|
|
|
elif request.method == "GET":
|
|
|
|
form.rgpd_coordonnees_dpo.data = ScoDocSiteConfig.get(
|
|
|
|
"rgpd_coordonnees_dpo", ""
|
|
|
|
)
|
|
|
|
|
|
|
|
return render_template(
|
|
|
|
"config_rgpd.j2",
|
|
|
|
form=form,
|
|
|
|
title="Configuration des fonctions liées au RGPD",
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2023-09-29 21:17:31 +02:00
|
|
|
@bp.route("/ScoDoc/permission_info/<string:perm_name>")
|
|
|
|
@admin_required
|
|
|
|
def permission_info(perm_name: str):
|
|
|
|
"""Infos sur une permission"""
|
|
|
|
permission = Permission.get_by_name(perm_name)
|
|
|
|
if permission is None:
|
|
|
|
raise ScoValueError("permission_info: permission inconnue")
|
|
|
|
return render_template(
|
|
|
|
"scodoc/permission_info.j2",
|
|
|
|
permission=permission,
|
|
|
|
permission_name=perm_name,
|
|
|
|
Permission=Permission,
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
@bp.route("/ScoDoc/role_info/<string:role_name>")
|
|
|
|
@admin_required
|
|
|
|
def role_info(role_name: str):
|
|
|
|
"""Infos sur un rôle"""
|
|
|
|
role = Role.query.filter_by(name=role_name).first_or_404()
|
|
|
|
return render_template(
|
|
|
|
"scodoc/role_info.j2", role=role, SCO_ROLES_DEFAULTS=SCO_ROLES_DEFAULTS
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
@bp.route("/ScoDoc/role_create", methods=["GET", "POST"])
|
|
|
|
@admin_required
|
|
|
|
def role_create():
|
|
|
|
"""Création d'un nouveau rôle"""
|
|
|
|
form = CreateRoleForm()
|
|
|
|
dest_url = url_for("scodoc.config_roles")
|
|
|
|
if request.method == "POST" and form.cancel.data:
|
|
|
|
return redirect(dest_url)
|
|
|
|
if form.validate_on_submit():
|
|
|
|
role_name = form.name.data.strip()
|
|
|
|
role: Role = Role.query.filter_by(name=role_name).first()
|
|
|
|
if role:
|
|
|
|
raise ScoValueError("Un rôle du même nom existe déjà", dest_url=dest_url)
|
|
|
|
role = Role(name=role_name)
|
|
|
|
db.session.add(role)
|
|
|
|
db.session.commit()
|
|
|
|
flash(f"Rôle {role_name} créé")
|
|
|
|
return redirect(dest_url)
|
|
|
|
|
|
|
|
roles = Role.query.order_by(Role.name).all()
|
|
|
|
return render_template(
|
|
|
|
"scodoc/role_create.j2", form=form, roles_names=[role.name for role in roles]
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
@bp.route("/ScoDoc/role_delete/<string:role_name>", methods=["GET", "POST"])
|
|
|
|
@admin_required
|
|
|
|
def role_delete(role_name: str):
|
|
|
|
"""Suppression d'un rôle"""
|
|
|
|
|
|
|
|
role = Role.query.filter_by(name=role_name).first_or_404()
|
|
|
|
# Ne permet de supprimer les rôles standards (on peut le faire via la ligne de commande ou l'API)
|
|
|
|
if role.name in SCO_ROLES_DEFAULTS:
|
|
|
|
raise ScoValueError(
|
|
|
|
f"Le rôle {role_name} est standard et ne peux pas être supprimé ici."
|
|
|
|
)
|
|
|
|
form = SimpleConfirmationForm()
|
|
|
|
if request.method == "POST" and form.cancel.data:
|
|
|
|
return redirect(url_for("scodoc.config_roles"))
|
|
|
|
if form.validate_on_submit():
|
|
|
|
db.session.delete(role)
|
|
|
|
db.session.commit()
|
|
|
|
flash(f"Rôle {role_name} supprimé")
|
|
|
|
return redirect(url_for("scodoc.config_roles"))
|
|
|
|
return render_template(
|
|
|
|
"form_confirmation.j2",
|
|
|
|
title=f"Supprimer le rôle {role_name} ?",
|
|
|
|
form=form,
|
|
|
|
info_message="""<p>Cette suppression est irréversible.</p>""",
|
2023-09-04 21:34:23 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
2023-02-26 21:24:07 +01:00
|
|
|
@bp.route("/ScoDoc/config_cas", methods=["GET", "POST"])
|
|
|
|
@admin_required
|
|
|
|
def config_cas():
|
|
|
|
"""Form config CAS"""
|
|
|
|
form = ConfigCASForm()
|
|
|
|
if request.method == "POST" and form.cancel.data: # cancel button
|
2024-01-20 19:29:32 +01:00
|
|
|
return redirect(url_for("scodoc.configuration"))
|
2023-02-26 21:24:07 +01:00
|
|
|
if form.validate_on_submit():
|
2023-03-01 19:10:37 +01:00
|
|
|
if ScoDocSiteConfig.set("cas_enable", form.data["cas_enable"]):
|
2023-02-26 21:24:07 +01:00
|
|
|
flash("CAS " + ("activé" if form.data["cas_enable"] else "désactivé"))
|
2023-03-01 19:10:37 +01:00
|
|
|
if ScoDocSiteConfig.set("cas_force", form.data["cas_force"]):
|
|
|
|
flash("CAS " + ("forcé" if form.data["cas_force"] else "non forcé"))
|
2023-09-02 22:49:21 +02:00
|
|
|
if ScoDocSiteConfig.set(
|
|
|
|
"cas_allow_for_new_users", form.data["cas_allow_for_new_users"]
|
|
|
|
):
|
|
|
|
flash(
|
|
|
|
f"""CAS {'' if form.data['cas_allow_for_new_users'] else 'non'
|
|
|
|
} autorisé par défaut aux nouveaux"""
|
|
|
|
)
|
2023-02-26 21:24:07 +01:00
|
|
|
if ScoDocSiteConfig.set("cas_server", form.data["cas_server"]):
|
2023-03-09 11:59:58 +01:00
|
|
|
flash("URL du serveur CAS enregistrée")
|
2023-03-02 23:29:25 +01:00
|
|
|
if ScoDocSiteConfig.set("cas_login_route", form.data["cas_login_route"]):
|
2023-03-09 11:59:58 +01:00
|
|
|
flash("Route du login CAS enregistrée")
|
2023-03-02 23:29:25 +01:00
|
|
|
if ScoDocSiteConfig.set("cas_logout_route", form.data["cas_logout_route"]):
|
2023-03-09 11:59:58 +01:00
|
|
|
flash("Route du logout CAS enregistrée")
|
2023-03-02 23:29:25 +01:00
|
|
|
if ScoDocSiteConfig.set("cas_validate_route", form.data["cas_validate_route"]):
|
2023-03-09 11:59:58 +01:00
|
|
|
flash("Route de validation CAS enregistrée")
|
2023-02-26 21:24:07 +01:00
|
|
|
if ScoDocSiteConfig.set("cas_attribute_id", form.data["cas_attribute_id"]):
|
2023-03-09 11:59:58 +01:00
|
|
|
flash("Attribut CAS ID enregistré")
|
2023-09-23 09:48:05 +02:00
|
|
|
if ScoDocSiteConfig.set(
|
|
|
|
"cas_uid_from_mail_regexp", form.data["cas_uid_from_mail_regexp"]
|
|
|
|
):
|
|
|
|
flash("Expression extraction identifiant CAS enregistrée")
|
2023-11-08 17:58:11 +01:00
|
|
|
if ScoDocSiteConfig.set(
|
|
|
|
"cas_edt_id_from_xml_regexp", form.data["cas_edt_id_from_xml_regexp"]
|
|
|
|
):
|
|
|
|
flash("Expression extraction identifiant edt enregistrée")
|
2023-02-26 23:27:40 +01:00
|
|
|
if ScoDocSiteConfig.set("cas_ssl_verify", form.data["cas_ssl_verify"]):
|
|
|
|
flash("Vérification SSL modifiée")
|
2023-02-27 10:20:59 +01:00
|
|
|
if form.cas_ssl_certificate_file.data:
|
|
|
|
data = request.files[form.cas_ssl_certificate_file.name].read()
|
|
|
|
try:
|
|
|
|
data_str = data.decode("ascii")
|
|
|
|
except UnicodeDecodeError as exc:
|
|
|
|
raise ScoValueError("Fichier certificat invalide (non ASCII)") from exc
|
|
|
|
if ScoDocSiteConfig.set("cas_ssl_certificate", data_str):
|
|
|
|
flash("Certificat SSL enregistré")
|
2023-02-26 21:36:25 +01:00
|
|
|
set_cas_configuration()
|
2023-02-26 21:24:07 +01:00
|
|
|
return redirect(url_for("scodoc.configuration"))
|
2023-02-26 23:27:40 +01:00
|
|
|
|
2023-02-26 21:24:07 +01:00
|
|
|
elif request.method == "GET":
|
|
|
|
form.cas_enable.data = ScoDocSiteConfig.get("cas_enable")
|
2023-03-01 19:10:37 +01:00
|
|
|
form.cas_force.data = ScoDocSiteConfig.get("cas_force")
|
2023-09-02 22:49:21 +02:00
|
|
|
form.cas_allow_for_new_users.data = ScoDocSiteConfig.get(
|
|
|
|
"cas_allow_for_new_users"
|
|
|
|
)
|
2023-02-26 21:24:07 +01:00
|
|
|
form.cas_server.data = ScoDocSiteConfig.get("cas_server")
|
2023-03-09 11:59:58 +01:00
|
|
|
form.cas_login_route.data = ScoDocSiteConfig.get("cas_login_route")
|
|
|
|
form.cas_logout_route.data = ScoDocSiteConfig.get("cas_logout_route")
|
|
|
|
form.cas_validate_route.data = ScoDocSiteConfig.get("cas_validate_route")
|
2023-02-26 21:24:07 +01:00
|
|
|
form.cas_attribute_id.data = ScoDocSiteConfig.get("cas_attribute_id")
|
2023-09-23 09:48:05 +02:00
|
|
|
form.cas_uid_from_mail_regexp.data = ScoDocSiteConfig.get(
|
|
|
|
"cas_uid_from_mail_regexp"
|
2023-02-26 21:24:07 +01:00
|
|
|
)
|
2023-11-08 17:58:11 +01:00
|
|
|
form.cas_edt_id_from_xml_regexp.data = ScoDocSiteConfig.get(
|
|
|
|
"cas_edt_id_from_xml_regexp"
|
|
|
|
)
|
2023-09-23 09:48:05 +02:00
|
|
|
form.cas_ssl_verify.data = ScoDocSiteConfig.get("cas_ssl_verify")
|
|
|
|
return render_template(
|
|
|
|
"config_cas.j2",
|
|
|
|
form=form,
|
|
|
|
title="Configuration du Service d'Authentification Central (CAS)",
|
|
|
|
cas_ssl_certificate_loaded=ScoDocSiteConfig.get("cas_ssl_certificate"),
|
|
|
|
)
|
2023-02-26 21:24:07 +01:00
|
|
|
|
|
|
|
|
2023-04-25 22:59:06 +02:00
|
|
|
@bp.route("/ScoDoc/config_assiduites", methods=["GET", "POST"])
|
|
|
|
@admin_required
|
|
|
|
def config_assiduites():
|
|
|
|
"""Form config Assiduites"""
|
|
|
|
form = ConfigAssiduitesForm()
|
|
|
|
if request.method == "POST" and form.cancel.data: # cancel button
|
2024-01-20 19:29:32 +01:00
|
|
|
return redirect(url_for("scodoc.configuration"))
|
2023-11-08 23:19:58 +01:00
|
|
|
|
2023-11-13 15:08:09 +01:00
|
|
|
edt_options = (
|
|
|
|
("edt_ics_path", "Chemin vers les calendriers ics"),
|
|
|
|
("edt_ics_title_field", "Champ contenant titre"),
|
|
|
|
("edt_ics_title_regexp", "Expression extraction titre"),
|
|
|
|
("edt_ics_group_field", "Champ contenant groupe"),
|
|
|
|
("edt_ics_group_regexp", "Expression extraction groupe"),
|
|
|
|
("edt_ics_mod_field", "Champ contenant module"),
|
|
|
|
("edt_ics_mod_regexp", "Expression extraction module"),
|
2023-12-28 23:05:19 +01:00
|
|
|
("edt_ics_uid_field", "Champ contenant l'enseignant"),
|
|
|
|
("edt_ics_uid_regexp", "Expression extraction de l'enseignant"),
|
2024-01-02 23:05:08 +01:00
|
|
|
("edt_ics_user_path", "Chemin vers les ics des enseignants"),
|
2023-11-13 15:08:09 +01:00
|
|
|
)
|
|
|
|
|
2024-01-05 10:06:16 +01:00
|
|
|
assi_options = (
|
|
|
|
("assi_morning_time", "Heure du début de la journée"),
|
|
|
|
("assi_lunch_time", "Heure du midi"),
|
|
|
|
("assi_afternoon_time", "Heure du fin de la journée"),
|
|
|
|
("assi_tick_time", "Granularité de la timeline"),
|
|
|
|
)
|
|
|
|
|
2023-04-25 22:59:06 +02:00
|
|
|
if form.validate_on_submit():
|
2024-01-05 10:06:16 +01:00
|
|
|
# --- Options assiduités
|
|
|
|
for opt_name, message in assi_options:
|
|
|
|
if ScoDocSiteConfig.set(opt_name, form.data[opt_name]):
|
|
|
|
flash(f"{message} enregistrée")
|
|
|
|
|
2023-11-13 15:08:09 +01:00
|
|
|
# --- Calendriers emploi du temps
|
|
|
|
for opt_name, message in edt_options:
|
|
|
|
if ScoDocSiteConfig.set(opt_name, form.data[opt_name]):
|
|
|
|
flash(f"{message} enregistré")
|
|
|
|
|
2023-04-25 22:59:06 +02:00
|
|
|
return redirect(url_for("scodoc.configuration"))
|
|
|
|
|
2023-11-08 23:19:58 +01:00
|
|
|
if request.method == "GET":
|
2024-01-18 17:05:43 +01:00
|
|
|
form.assi_morning_time.data = ScoDocSiteConfig.get("assi_morning_time", "08:00")
|
|
|
|
form.assi_lunch_time.data = ScoDocSiteConfig.get("assi_lunch_time", "13:00")
|
2024-01-05 10:06:16 +01:00
|
|
|
form.assi_afternoon_time.data = ScoDocSiteConfig.get(
|
2024-01-18 17:05:43 +01:00
|
|
|
"assi_afternoon_time", "18:00"
|
2023-04-25 22:59:06 +02:00
|
|
|
)
|
2023-06-02 17:40:46 +02:00
|
|
|
try:
|
2024-01-05 10:06:16 +01:00
|
|
|
form.assi_tick_time.data = float(
|
|
|
|
ScoDocSiteConfig.get("assi_tick_time", 15.0)
|
|
|
|
)
|
2023-06-02 17:40:46 +02:00
|
|
|
except ValueError:
|
2024-01-05 10:06:16 +01:00
|
|
|
form.assi_tick_time.data = 15.0
|
2023-06-02 17:40:46 +02:00
|
|
|
ScoDocSiteConfig.set("assi_tick_time", 15.0)
|
2023-11-13 15:08:09 +01:00
|
|
|
# --- Emplois du temps
|
|
|
|
for opt_name, _ in edt_options:
|
|
|
|
getattr(form, opt_name).data = ScoDocSiteConfig.get(opt_name)
|
2023-06-02 17:40:46 +02:00
|
|
|
|
2023-11-08 23:19:58 +01:00
|
|
|
return render_template(
|
|
|
|
"assiduites/pages/config_assiduites.j2",
|
|
|
|
form=form,
|
|
|
|
title="Configuration du module Assiduité",
|
|
|
|
)
|
2023-04-25 22:59:06 +02:00
|
|
|
|
|
|
|
|
2023-11-14 15:55:52 +01:00
|
|
|
@bp.route("/ScoDoc/ics_raw_sample/<string:edt_id>")
|
|
|
|
@admin_required
|
|
|
|
def ics_raw_sample(edt_id: str):
|
|
|
|
"Renvoie un extrait de l'ics brut, pour aider à configurer les extractions"
|
2023-12-28 23:05:19 +01:00
|
|
|
log(f"ics_raw_sample/{edt_id}")
|
2023-11-14 15:55:52 +01:00
|
|
|
try:
|
|
|
|
raw_ics, _ = sco_edt_cal.formsemestre_load_calendar(edt_id=edt_id)
|
|
|
|
except ScoValueError as exc:
|
2023-12-28 23:05:19 +01:00
|
|
|
log(f"ics_raw_sample: formsemestre_load_calendar({edt_id}) failed")
|
2023-11-14 15:55:52 +01:00
|
|
|
return exc.args[0]
|
|
|
|
try:
|
|
|
|
ics = raw_ics.decode(scu.SCO_ENCODING)
|
|
|
|
except SyntaxError:
|
2023-12-29 02:48:23 +01:00
|
|
|
log("ics_raw_sample: raw_ics.decode failed")
|
2023-11-14 15:55:52 +01:00
|
|
|
return f"Erreur lors de la conversion vers {scu.SCO_ENCODING}"
|
|
|
|
evs = ics.split("BEGIN:VEVENT")
|
|
|
|
if len(evs) < 1:
|
2023-12-29 02:48:23 +01:00
|
|
|
log("ics_raw_sample: empty calendar")
|
2023-11-14 15:55:52 +01:00
|
|
|
return "pas d'évènements VEVENT détectés dans ce fichier"
|
|
|
|
return "BEGIN:VEVENT" + evs[len(evs) // 2]
|
|
|
|
|
|
|
|
|
2022-01-21 00:46:45 +01:00
|
|
|
@bp.route("/ScoDoc/config_codes_decisions", methods=["GET", "POST"])
|
|
|
|
@admin_required
|
|
|
|
def config_codes_decisions():
|
|
|
|
"""Form config codes decisions"""
|
|
|
|
form = CodesDecisionsForm()
|
|
|
|
if request.method == "POST" and form.cancel.data: # cancel button
|
2024-01-20 19:29:32 +01:00
|
|
|
return redirect(url_for("scodoc.configuration"))
|
2022-01-21 00:46:45 +01:00
|
|
|
if form.validate_on_submit():
|
|
|
|
for code in models.config.CODES_SCODOC_TO_APO:
|
|
|
|
ScoDocSiteConfig.set_code_apo(code, getattr(form, code).data)
|
2023-06-25 21:05:19 +02:00
|
|
|
flash("Codes décisions enregistrés")
|
2024-01-20 19:29:32 +01:00
|
|
|
return redirect(url_for("scodoc.configuration"))
|
2022-01-21 00:46:45 +01:00
|
|
|
elif request.method == "GET":
|
|
|
|
for code in models.config.CODES_SCODOC_TO_APO:
|
|
|
|
getattr(form, code).data = ScoDocSiteConfig.get_code_apo(code)
|
2022-04-05 11:44:08 +02:00
|
|
|
|
2022-01-21 00:46:45 +01:00
|
|
|
return render_template(
|
2023-01-30 22:25:17 +01:00
|
|
|
"config_codes_decisions.j2",
|
2022-01-21 00:46:45 +01:00
|
|
|
form=form,
|
|
|
|
title="Configuration des codes de décisions",
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2023-07-31 16:14:16 +02:00
|
|
|
@bp.route("/ScoDoc/config_personalized_links", methods=["GET", "POST"])
|
|
|
|
@admin_required
|
|
|
|
def config_personalized_links():
|
|
|
|
"""Form config liens perso"""
|
|
|
|
form = PersonalizedLinksForm()
|
|
|
|
if request.method == "POST" and form.cancel.data: # cancel button
|
2024-01-20 19:29:32 +01:00
|
|
|
return redirect(url_for("scodoc.configuration"))
|
2023-07-31 16:14:16 +02:00
|
|
|
if form.validate_on_submit():
|
|
|
|
links = []
|
|
|
|
for idx in list(form.links_by_id) + ["new"]:
|
|
|
|
title = form.data.get(f"link_{idx}")
|
|
|
|
url = form.data.get(f"link_url_{idx}")
|
|
|
|
with_args = form.data.get(f"link_with_args_{idx}")
|
|
|
|
if title and url:
|
|
|
|
links.append(
|
|
|
|
PersonalizedLink(title=title, url=url, with_args=with_args)
|
|
|
|
)
|
|
|
|
ScoDocSiteConfig.set_perso_links(links)
|
|
|
|
flash("Liens enregistrés")
|
|
|
|
return redirect(url_for("scodoc.configuration"))
|
|
|
|
|
|
|
|
for idx, link in form.links_by_id.items():
|
|
|
|
getattr(form, f"link_{idx}").data = link.title
|
|
|
|
getattr(form, f"link_url_{idx}").data = link.url
|
|
|
|
getattr(form, f"link_with_args_{idx}").data = link.with_args
|
|
|
|
return render_template(
|
|
|
|
"config_personalized_links.j2",
|
|
|
|
form=form,
|
|
|
|
title="Configuration des liens personnalisés",
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2024-04-09 00:36:46 +02:00
|
|
|
@bp.route("/ScoDoc/activate_entreprises", methods=["GET", "POST"])
|
|
|
|
@admin_required
|
|
|
|
def activate_entreprises():
|
|
|
|
"""Form activation module entreprises"""
|
|
|
|
is_enabled = ScoDocSiteConfig.is_entreprises_enabled()
|
|
|
|
form = ActivateEntreprisesForm(
|
|
|
|
data={
|
|
|
|
"set_default_roles_permission": True,
|
|
|
|
}
|
|
|
|
)
|
|
|
|
if request.method == "POST" and form.cancel.data: # cancel button
|
|
|
|
return redirect(url_for("scodoc.configuration"))
|
|
|
|
if form.validate_on_submit():
|
|
|
|
if entreprises.activate_module(
|
|
|
|
enable=not is_enabled,
|
|
|
|
set_default_roles_permission=form.data["set_default_roles_permission"],
|
|
|
|
):
|
|
|
|
flash("Module entreprise " + ("activé" if not is_enabled else "désactivé"))
|
|
|
|
return redirect(url_for("scodoc.configuration"))
|
|
|
|
|
|
|
|
if is_enabled:
|
|
|
|
form.submit.label.text = "Désactiver le module relations entreprises"
|
|
|
|
else:
|
|
|
|
form.submit.label.text = "Activer le module relations entreprises"
|
|
|
|
return render_template(
|
|
|
|
"activate_entreprises.j2",
|
|
|
|
form=form,
|
|
|
|
is_enabled=is_enabled,
|
|
|
|
title="Activation module Relations Entreprises",
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2021-07-28 09:51:18 +02:00
|
|
|
@bp.route("/ScoDoc/table_etud_in_accessible_depts", methods=["POST"])
|
|
|
|
@login_required
|
|
|
|
def table_etud_in_accessible_depts():
|
|
|
|
"""recherche étudiants sur plusieurs départements"""
|
|
|
|
return sco_find_etud.table_etud_in_accessible_depts(expnom=request.form["expnom"])
|
2021-08-29 19:57:32 +02:00
|
|
|
|
|
|
|
|
2021-09-09 16:11:05 +02:00
|
|
|
# Fonction d'API accessible sans aucun authentification
|
2021-09-08 23:00:01 +02:00
|
|
|
@bp.route("/ScoDoc/get_etud_dept")
|
|
|
|
def get_etud_dept():
|
|
|
|
"""Returns the dept acronym (eg "GEII") of an etud (identified by etudid,
|
|
|
|
code_nip ou code_ine in the request).
|
2021-09-09 16:11:05 +02:00
|
|
|
Ancienne API: ramène la chaine brute, texte sans JSON ou XML.
|
2021-09-08 23:00:01 +02:00
|
|
|
"""
|
|
|
|
if "etudid" in request.args:
|
|
|
|
# zero ou une réponse:
|
2023-03-20 11:17:38 +01:00
|
|
|
etuds = [Identite.get_etud(request.args["etudid"])]
|
2021-09-08 23:00:01 +02:00
|
|
|
elif "code_nip" in request.args:
|
|
|
|
# il peut y avoir plusieurs réponses si l'étudiant est passé par plusieurs départements
|
|
|
|
etuds = Identite.query.filter_by(code_nip=request.args["code_nip"]).all()
|
|
|
|
elif "code_ine" in request.args:
|
2021-10-25 15:51:11 +02:00
|
|
|
etuds = Identite.query.filter_by(code_ine=request.args["code_ine"]).all()
|
2021-09-08 23:00:01 +02:00
|
|
|
else:
|
|
|
|
raise BadRequest(
|
|
|
|
"missing argument (expected one among: etudid, code_nip or code_ine)"
|
|
|
|
)
|
|
|
|
if not etuds:
|
|
|
|
raise NotFound("student not found")
|
|
|
|
elif len(etuds) == 1:
|
|
|
|
last_etud = etuds[0]
|
|
|
|
else:
|
|
|
|
# inscriptions dans plusieurs departements: cherche la plus recente
|
|
|
|
last_etud = None
|
|
|
|
last_date = None
|
|
|
|
for etud in etuds:
|
2021-12-22 14:31:44 +01:00
|
|
|
inscriptions = FormSemestreInscription.query.filter_by(etudid=etud.id).all()
|
2021-09-08 23:00:01 +02:00
|
|
|
for ins in inscriptions:
|
2023-07-11 06:57:38 +02:00
|
|
|
date_fin = db.session.get(FormSemestre, ins.formsemestre_id).date_fin
|
2021-09-08 23:00:01 +02:00
|
|
|
if (last_date is None) or date_fin > last_date:
|
|
|
|
last_date = date_fin
|
|
|
|
last_etud = etud
|
|
|
|
if not last_etud:
|
|
|
|
# est présent dans plusieurs semestres mais inscrit dans aucun !
|
|
|
|
# le choix a peu d'importance...
|
|
|
|
last_etud = etuds[-1]
|
|
|
|
|
2022-01-31 22:41:34 +01:00
|
|
|
return Departement.query.get_or_404(last_etud.dept_id).acronym
|
2021-09-08 23:00:01 +02:00
|
|
|
|
|
|
|
|
2021-09-11 15:59:06 +02:00
|
|
|
@bp.route("/ScoDoc/about")
|
|
|
|
@bp.route("/ScoDoc/Scolarite/<scodoc_dept>/about")
|
2022-01-06 23:37:57 +01:00
|
|
|
@login_required
|
2021-09-11 15:59:06 +02:00
|
|
|
def about(scodoc_dept=None):
|
|
|
|
"version info"
|
|
|
|
return render_template(
|
2023-01-30 22:25:17 +01:00
|
|
|
"about.j2",
|
2021-09-11 15:59:06 +02:00
|
|
|
logo=scu.icontag("borgne_img"),
|
2024-01-20 19:29:32 +01:00
|
|
|
news=sco_version.SCONEWS,
|
|
|
|
ScoDocSiteConfig=ScoDocSiteConfig,
|
|
|
|
version=scu.get_scodoc_version(),
|
2021-09-11 15:59:06 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
2021-09-05 12:30:11 +02:00
|
|
|
# ---- CONFIGURATION
|
|
|
|
|
2021-09-08 23:00:01 +02:00
|
|
|
# Notes pour variables config: (valeurs par défaut des paramètres de département)
|
|
|
|
# Chaines simples
|
|
|
|
# SCOLAR_FONT = "Helvetica"
|
|
|
|
# SCOLAR_FONT_SIZE = 10
|
|
|
|
# SCOLAR_FONT_SIZE_FOOT = 6
|
|
|
|
# INSTITUTION_NAME = "<b>Institut Universitaire de Technologie - Université Georges Perec</b>"
|
|
|
|
# INSTITUTION_ADDRESS = "Web <b>www.sor.bonne.top</b> - 11, rue Simon Crubelier - 75017 Paris"
|
|
|
|
# INSTITUTION_CITY = "Paris"
|
|
|
|
# Textareas:
|
2022-03-13 23:00:50 +01:00
|
|
|
# DEFAULT_PDF_FOOTER_TEMPLATE = "Edité par %(scodoc_name)s le %(day)s/%(month)s/%(year)s à %(hour)sh%(minute)s"
|
2021-09-08 23:00:01 +02:00
|
|
|
|
|
|
|
# Booléens
|
|
|
|
# always_require_ine
|
|
|
|
|
|
|
|
# Logos:
|
|
|
|
# LOGO_FOOTER*, LOGO_HEADER*
|
|
|
|
|
|
|
|
|
2021-09-05 12:30:11 +02:00
|
|
|
@bp.route("/ScoDoc/configuration", methods=["GET", "POST"])
|
|
|
|
@admin_required
|
|
|
|
def configuration():
|
2022-01-25 23:48:39 +01:00
|
|
|
"Page de configuration globale"
|
2021-11-19 11:51:05 +01:00
|
|
|
if not current_user.is_administrator():
|
2022-01-25 23:48:39 +01:00
|
|
|
raise AccessDenied("invalid user (%s) must be SuperAdmin" % current_user)
|
|
|
|
return config_main.configuration()
|
|
|
|
|
|
|
|
|
|
|
|
@bp.route("/ScoDoc/get_bonus_description/<bonus_name>", methods=["GET"])
|
|
|
|
def get_bonus_description(bonus_name: str):
|
|
|
|
"description text/html du bonus"
|
2022-01-27 18:12:40 +01:00
|
|
|
if bonus_name == "default":
|
|
|
|
bonus_name = ""
|
2022-01-25 23:48:39 +01:00
|
|
|
bonus_class = ScoDocSiteConfig.get_bonus_sport_class_from_name(bonus_name)
|
2022-01-27 18:12:40 +01:00
|
|
|
text = bonus_class.__doc__
|
2022-02-11 09:58:27 +01:00
|
|
|
if text:
|
|
|
|
fields = re.split(r"\n\n", text, maxsplit=1)
|
|
|
|
if len(fields) > 1:
|
|
|
|
first_line, text = fields
|
|
|
|
else:
|
|
|
|
first_line, text = "", fields[0]
|
2022-01-27 18:12:40 +01:00
|
|
|
else:
|
2022-02-11 09:58:27 +01:00
|
|
|
text = ""
|
|
|
|
first_line = "pas de fonction bonus configurée."
|
2022-01-27 18:12:40 +01:00
|
|
|
|
2024-06-24 16:48:13 +02:00
|
|
|
return f"""<div class="scobox-title">{first_line}</div>
|
2022-01-27 18:12:40 +01:00
|
|
|
<div>{text}</div>
|
|
|
|
"""
|
2022-01-25 23:48:39 +01:00
|
|
|
|
|
|
|
|
|
|
|
@bp.route("/ScoDoc/configure_logos", methods=["GET", "POST"])
|
|
|
|
@admin_required
|
|
|
|
def configure_logos():
|
|
|
|
"Page de configuration des logos (globale)"
|
|
|
|
if not current_user.is_administrator():
|
|
|
|
raise AccessDenied("invalid user (%s) must be SuperAdmin" % current_user)
|
|
|
|
return config_logos.config_logos()
|
2021-09-05 12:30:11 +02:00
|
|
|
|
|
|
|
|
2021-11-19 11:51:05 +01:00
|
|
|
SMALL_SIZE = (200, 200)
|
2021-11-07 09:19:27 +01:00
|
|
|
|
|
|
|
|
|
|
|
def _return_logo(name="header", dept_id="", small=False, strict: bool = True):
|
2021-09-08 23:00:01 +02:00
|
|
|
# stockée dans /opt/scodoc-data/config/logos donc servie manuellement ici
|
2021-12-11 17:55:08 +01:00
|
|
|
# from app.scodoc.sco_photos import _http_jpeg_file
|
|
|
|
|
2022-02-22 19:25:49 +01:00
|
|
|
logo = sco_logos.find_logo(name, dept_id, strict)
|
2021-11-07 09:19:27 +01:00
|
|
|
if logo is not None:
|
2022-02-22 19:25:49 +01:00
|
|
|
logo.select()
|
2021-11-07 09:19:27 +01:00
|
|
|
suffix = logo.suffix
|
|
|
|
if small:
|
|
|
|
with PILImage.open(logo.filepath) as im:
|
|
|
|
# on garde le même format (on pourrait plus simplement générer systématiquement du JPEG)
|
|
|
|
fmt = { # adapt suffix to be compliant with PIL save format
|
|
|
|
"PNG": "PNG",
|
|
|
|
"JPG": "JPEG",
|
|
|
|
"JPEG": "JPEG",
|
|
|
|
}[suffix.upper()]
|
2022-01-21 23:25:02 +01:00
|
|
|
if fmt == "JPEG":
|
|
|
|
im = im.convert("RGB")
|
|
|
|
im.thumbnail(SMALL_SIZE)
|
|
|
|
stream = io.BytesIO()
|
2021-11-07 09:19:27 +01:00
|
|
|
im.save(stream, fmt)
|
|
|
|
stream.seek(0)
|
|
|
|
return send_file(stream, mimetype=f"image/{fmt}")
|
|
|
|
else:
|
2021-12-11 17:55:08 +01:00
|
|
|
# return _http_jpeg_file(logo.filepath)
|
|
|
|
# ... replaces ...
|
2021-12-11 17:20:34 +01:00
|
|
|
return send_file(
|
|
|
|
logo.filepath,
|
|
|
|
mimetype=f"image/{suffix}",
|
|
|
|
last_modified=datetime.datetime.now(),
|
|
|
|
)
|
2021-09-08 23:00:01 +02:00
|
|
|
else:
|
2021-11-07 09:19:27 +01:00
|
|
|
abort(404)
|
|
|
|
|
|
|
|
|
|
|
|
# small version (copy/paste from get_logo
|
|
|
|
@bp.route("/ScoDoc/logos/<name>/small", defaults={"dept_id": None})
|
|
|
|
@bp.route("/ScoDoc/<int:dept_id>/logos/<name>/small")
|
|
|
|
@admin_required
|
|
|
|
def get_logo_small(name: str, dept_id: int):
|
|
|
|
strict = request.args.get("strict", "False")
|
|
|
|
return _return_logo(
|
|
|
|
name,
|
|
|
|
dept_id=dept_id,
|
|
|
|
small=True,
|
|
|
|
strict=strict.upper() not in ["0", "FALSE"],
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
@bp.route(
|
|
|
|
"/ScoDoc/logos/<name>", defaults={"dept_id": None}
|
|
|
|
) # if dept not specified, take global logo
|
|
|
|
@bp.route("/ScoDoc/<int:dept_id>/logos/<name>")
|
|
|
|
@admin_required
|
|
|
|
def get_logo(name: str, dept_id: int):
|
|
|
|
strict = request.args.get("strict", "False")
|
|
|
|
return _return_logo(
|
|
|
|
name,
|
|
|
|
dept_id=dept_id,
|
|
|
|
small=False,
|
|
|
|
strict=strict.upper() not in ["0", "FALSE"],
|
|
|
|
)
|
2021-09-08 23:00:01 +02:00
|
|
|
|
|
|
|
|
2022-02-12 14:59:18 +01:00
|
|
|
# ---
|
|
|
|
@bp.route("/ScoDoc/ue_colors_css/<int:formation_id>/<int:semestre_idx>")
|
|
|
|
def ue_colors_css(formation_id: int, semestre_idx: int):
|
|
|
|
"""Feuille de style pour les couleurs d'UE"""
|
2022-02-12 15:04:01 +01:00
|
|
|
ues = UniteEns.query.filter_by(
|
|
|
|
formation_id=formation_id, semestre_idx=semestre_idx
|
|
|
|
).order_by(UniteEns.numero)
|
2022-02-12 14:59:18 +01:00
|
|
|
txt = (
|
|
|
|
":root{\n"
|
|
|
|
+ "\n".join(
|
|
|
|
[
|
2022-02-13 22:03:46 +01:00
|
|
|
f"--color-UE{semestre_idx}-{ue_idx+1}: {ue.color};"
|
2022-02-12 14:59:18 +01:00
|
|
|
for ue_idx, ue in enumerate(ues)
|
|
|
|
if ue.color
|
|
|
|
]
|
|
|
|
)
|
|
|
|
+ "\n}\n"
|
|
|
|
)
|
|
|
|
response = make_response(txt)
|
|
|
|
response.headers["Content-Type"] = "text/css"
|
|
|
|
return response
|
|
|
|
|
|
|
|
|
2021-08-29 19:57:32 +02:00
|
|
|
# essais
|
2021-08-29 22:42:38 +02:00
|
|
|
# @bp.route("/testlog")
|
|
|
|
# def testlog():
|
|
|
|
# import time
|
|
|
|
# from flask import current_app
|
|
|
|
# from app import log
|
2021-08-29 19:57:32 +02:00
|
|
|
|
2021-08-29 22:42:38 +02:00
|
|
|
# log(f"testlog called: handlers={current_app.logger.handlers}")
|
|
|
|
# current_app.logger.debug(f"testlog message DEBUG")
|
|
|
|
# current_app.logger.info(f"testlog message INFO")
|
|
|
|
# current_app.logger.warning(f"testlog message WARNING")
|
|
|
|
# current_app.logger.error(f"testlog message ERROR")
|
|
|
|
# current_app.logger.critical(f"testlog message CRITICAL")
|
|
|
|
# raise SyntaxError("une erreur de syntaxe")
|
|
|
|
# return "testlog completed at " + str(time.time())
|