forked from ScoDoc/ScoDoc
reorganized logging.
This commit is contained in:
parent
3948dc2140
commit
aee02d911e
@ -2,10 +2,13 @@
|
|||||||
# pylint: disable=invalid-name
|
# pylint: disable=invalid-name
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import socket
|
||||||
import sys
|
import sys
|
||||||
|
import time
|
||||||
|
import traceback
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
from logging.handlers import SMTPHandler, TimedRotatingFileHandler
|
from logging.handlers import SMTPHandler, WatchedFileHandler
|
||||||
|
|
||||||
from flask import request
|
from flask import request
|
||||||
from flask import Flask
|
from flask import Flask
|
||||||
@ -51,9 +54,6 @@ def create_app(config_class=DevConfig):
|
|||||||
app.logger.setLevel(logging.DEBUG)
|
app.logger.setLevel(logging.DEBUG)
|
||||||
app.config.from_object(config_class)
|
app.config.from_object(config_class)
|
||||||
|
|
||||||
app.logger.info(
|
|
||||||
f"create_app({config_class.__name__}, {config_class.SQLALCHEMY_DATABASE_URI})"
|
|
||||||
)
|
|
||||||
db.init_app(app)
|
db.init_app(app)
|
||||||
migrate.init_app(app, db)
|
migrate.init_app(app, db)
|
||||||
login.init_app(app)
|
login.init_app(app)
|
||||||
@ -88,7 +88,11 @@ def create_app(config_class=DevConfig):
|
|||||||
absences_bp, url_prefix="/ScoDoc/<scodoc_dept>/Scolarite/Absences"
|
absences_bp, url_prefix="/ScoDoc/<scodoc_dept>/Scolarite/Absences"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Config logs pour PRODUCTION
|
||||||
if not app.debug and not app.testing:
|
if not app.debug and not app.testing:
|
||||||
|
# On supprime le logguer par défaut qui va vers stderr et pollue le slogs systemes
|
||||||
|
# nb: pas trouvé plus élégant
|
||||||
|
app.logger.handlers.pop()
|
||||||
if app.config["MAIL_SERVER"]:
|
if app.config["MAIL_SERVER"]:
|
||||||
auth = None
|
auth = None
|
||||||
if app.config["MAIL_USERNAME"] or app.config["MAIL_PASSWORD"]:
|
if app.config["MAIL_USERNAME"] or app.config["MAIL_PASSWORD"]:
|
||||||
@ -96,24 +100,25 @@ def create_app(config_class=DevConfig):
|
|||||||
secure = None
|
secure = None
|
||||||
if app.config["MAIL_USE_TLS"]:
|
if app.config["MAIL_USE_TLS"]:
|
||||||
secure = ()
|
secure = ()
|
||||||
|
host_name = socket.gethostname()
|
||||||
mail_handler = SMTPHandler(
|
mail_handler = SMTPHandler(
|
||||||
mailhost=(app.config["MAIL_SERVER"], app.config["MAIL_PORT"]),
|
mailhost=(app.config["MAIL_SERVER"], app.config["MAIL_PORT"]),
|
||||||
fromaddr="no-reply@" + app.config["MAIL_SERVER"],
|
fromaddr="no-reply@" + app.config["MAIL_SERVER"],
|
||||||
toaddrs=[app.config["ADMINS"]],
|
toaddrs=["exception@scodoc.org"],
|
||||||
subject="ScoDoc Failure",
|
subject="ScoDoc Exception from " + host_name,
|
||||||
credentials=auth,
|
credentials=auth,
|
||||||
secure=secure,
|
secure=secure,
|
||||||
)
|
)
|
||||||
mail_handler.setLevel(logging.ERROR)
|
mail_handler.setLevel(logging.ERROR)
|
||||||
app.logger.addHandler(mail_handler)
|
app.logger.addHandler(mail_handler)
|
||||||
|
|
||||||
|
# Config logs pour DEV et PRODUCTION
|
||||||
if not app.testing:
|
if not app.testing:
|
||||||
# Configuration des logs (actifs aussi en mode development)
|
# Configuration des logs (actifs aussi en mode development)
|
||||||
if not os.path.exists("logs"):
|
# usually /opt/scodoc-data/log/scodoc.log:
|
||||||
os.mkdir("logs")
|
# rotated by logrotate
|
||||||
file_handler = TimedRotatingFileHandler(
|
file_handler = WatchedFileHandler(
|
||||||
"/opt/scodoc-data/log/scodoc.log",
|
app.config["SCODOC_LOG_FILE"], encoding="utf-8"
|
||||||
when="W6", # Sunday
|
|
||||||
backupCount=53, # 1 an de logs
|
|
||||||
)
|
)
|
||||||
file_handler.setFormatter(
|
file_handler.setFormatter(
|
||||||
logging.Formatter(
|
logging.Formatter(
|
||||||
@ -123,9 +128,25 @@ def create_app(config_class=DevConfig):
|
|||||||
file_handler.setLevel(logging.INFO)
|
file_handler.setLevel(logging.INFO)
|
||||||
app.logger.addHandler(file_handler)
|
app.logger.addHandler(file_handler)
|
||||||
|
|
||||||
app.logger.setLevel(logging.INFO)
|
# app.logger.setLevel(logging.INFO)
|
||||||
app.logger.info(f"{sco_version.SCONAME} {sco_version.SCOVERSION} startup")
|
app.logger.info(f"{sco_version.SCONAME} {sco_version.SCOVERSION} startup")
|
||||||
|
app.logger.info(
|
||||||
|
f"create_app({config_class.__name__}, {config_class.SQLALCHEMY_DATABASE_URI})"
|
||||||
|
)
|
||||||
|
# ---- INITIALISATION SPECIFIQUES A SCODOC
|
||||||
|
from app.scodoc import sco_bulletins_generator
|
||||||
|
from app.scodoc.sco_bulletins_example import BulletinGeneratorExample
|
||||||
|
from app.scodoc.sco_bulletins_legacy import BulletinGeneratorLegacy
|
||||||
|
from app.scodoc.sco_bulletins_standard import BulletinGeneratorStandard
|
||||||
|
from app.scodoc.sco_bulletins_ucac import BulletinGeneratorUCAC
|
||||||
|
|
||||||
|
sco_bulletins_generator.register_bulletin_class(BulletinGeneratorExample)
|
||||||
|
sco_bulletins_generator.register_bulletin_class(BulletinGeneratorLegacy)
|
||||||
|
sco_bulletins_generator.register_bulletin_class(BulletinGeneratorStandard)
|
||||||
|
sco_bulletins_generator.register_bulletin_class(BulletinGeneratorUCAC)
|
||||||
|
app.logger.info(
|
||||||
|
f"registered bulletin classes {[ k for k in sco_bulletins_generator.BULLETIN_CLASSES ]}"
|
||||||
|
)
|
||||||
return app
|
return app
|
||||||
|
|
||||||
|
|
||||||
@ -230,6 +251,41 @@ def clear_scodoc_cache():
|
|||||||
sco_preferences.clear_base_preferences()
|
sco_preferences.clear_base_preferences()
|
||||||
|
|
||||||
|
|
||||||
|
# --------- Logging
|
||||||
|
def log(msg: str):
|
||||||
|
"""log a message.
|
||||||
|
If Flask app, use configured logger, else stderr."""
|
||||||
|
try:
|
||||||
|
dept = getattr(g, "scodoc_dept", "")
|
||||||
|
msg = f" ({dept}) {msg}"
|
||||||
|
except RuntimeError:
|
||||||
|
# Flask Working outside of application context.
|
||||||
|
pass
|
||||||
|
|
||||||
|
if current_app:
|
||||||
|
current_app.logger.info(msg)
|
||||||
|
else:
|
||||||
|
sys.stdout.flush()
|
||||||
|
sys.stderr.write(
|
||||||
|
"[%s] scodoc: %s\n" % (time.strftime("%a %b %d %H:%M:%S %Y"), msg)
|
||||||
|
)
|
||||||
|
sys.stderr.flush()
|
||||||
|
|
||||||
|
|
||||||
|
# Debug: log call stack
|
||||||
|
def log_call_stack():
|
||||||
|
log("Call stack:\n" + "\n".join(x.strip() for x in traceback.format_stack()[:-1]))
|
||||||
|
|
||||||
|
|
||||||
|
# Alarms by email:
|
||||||
|
def send_scodoc_alarm(subject, txt):
|
||||||
|
from app.scodoc import sco_preferences
|
||||||
|
from app import email
|
||||||
|
|
||||||
|
sender = sco_preferences.get_preference("email_from_addr")
|
||||||
|
email.send_email(subject, sender, ["exception@scodoc.org"], txt)
|
||||||
|
|
||||||
|
|
||||||
from app.models import Departement
|
from app.models import Departement
|
||||||
from app.scodoc import notesdb as ndb, sco_preferences
|
from app.scodoc import notesdb as ndb, sco_preferences
|
||||||
from app.scodoc import sco_cache
|
from app.scodoc import sco_cache
|
||||||
|
@ -487,7 +487,7 @@ class TF(object):
|
|||||||
lem.append("<table>")
|
lem.append("<table>")
|
||||||
for i in range(len(labels)):
|
for i in range(len(labels)):
|
||||||
if input_type == "checkbox":
|
if input_type == "checkbox":
|
||||||
# from app.scodoc.notes_log import log # debug only
|
# from app.scodoc.sco_utils import log # debug only
|
||||||
# log('checkbox: values[%s] = "%s"' % (field,repr(values[field]) ))
|
# log('checkbox: values[%s] = "%s"' % (field,repr(values[field]) ))
|
||||||
# log("descr['allowed_values'][%s] = '%s'" % (i, repr(descr['allowed_values'][i])))
|
# log("descr['allowed_values'][%s] = '%s'" % (i, repr(descr['allowed_values'][i])))
|
||||||
if (
|
if (
|
||||||
|
@ -59,7 +59,7 @@ from app.scodoc import sco_excel
|
|||||||
from app.scodoc import sco_pdf
|
from app.scodoc import sco_pdf
|
||||||
from app.scodoc import sco_xml
|
from app.scodoc import sco_xml
|
||||||
from app.scodoc.sco_pdf import SU
|
from app.scodoc.sco_pdf import SU
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
|
|
||||||
|
|
||||||
def mark_paras(L, tags):
|
def mark_paras(L, tags):
|
||||||
|
@ -35,7 +35,7 @@ from flask import request
|
|||||||
from flask_login import current_user
|
from flask_login import current_user
|
||||||
|
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
from app.scodoc import html_sidebar
|
from app.scodoc import html_sidebar
|
||||||
import sco_version
|
import sco_version
|
||||||
|
|
||||||
|
@ -1,77 +0,0 @@
|
|||||||
# -*- mode: python -*-
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
import os
|
|
||||||
import time
|
|
||||||
import traceback
|
|
||||||
|
|
||||||
from flask import g, current_app
|
|
||||||
|
|
||||||
from app import email
|
|
||||||
|
|
||||||
"""Simple & stupid file logguer, used only to debug
|
|
||||||
(logging to SQL is done in scolog)
|
|
||||||
"""
|
|
||||||
|
|
||||||
LOG_FILENAME = "notes.log" # empty to disable logging
|
|
||||||
DEFAULT_LOG_DIR = (
|
|
||||||
"/opt/scodoc-data/log" # clients should call set_log_directory to change this
|
|
||||||
)
|
|
||||||
|
|
||||||
ALARM_DESTINATION = "emmanuel@scodoc.org"
|
|
||||||
|
|
||||||
|
|
||||||
class _logguer(object):
|
|
||||||
def __init__(self):
|
|
||||||
self.file = None
|
|
||||||
self.directory = None
|
|
||||||
self.set_log_directory(DEFAULT_LOG_DIR)
|
|
||||||
|
|
||||||
def set_log_directory(self, directory):
|
|
||||||
if self.directory != directory and self.file:
|
|
||||||
# changing directory when a log is already open: close it
|
|
||||||
self.file.close()
|
|
||||||
self.file = None
|
|
||||||
self.directory = directory
|
|
||||||
|
|
||||||
def _open(self):
|
|
||||||
if LOG_FILENAME:
|
|
||||||
path = os.path.join(self.directory, LOG_FILENAME)
|
|
||||||
self.file = open(path, "a")
|
|
||||||
self("new _logguer (%s)" % path)
|
|
||||||
else:
|
|
||||||
self.file = None # logging disabled
|
|
||||||
|
|
||||||
def __call__(self, msg):
|
|
||||||
if not self.file:
|
|
||||||
self._open()
|
|
||||||
if self.file:
|
|
||||||
try:
|
|
||||||
dept = getattr(g, "scodoc_dept", "")
|
|
||||||
except RuntimeError:
|
|
||||||
# Flask Working outside of application context.
|
|
||||||
dept = ""
|
|
||||||
if dept:
|
|
||||||
dept = " (%s)" % dept
|
|
||||||
msg = dept + " " + msg
|
|
||||||
self.file.write("[%s]%s\n" % (time.strftime("%a %b %d %H:%M:%S %Y"), msg))
|
|
||||||
if current_app:
|
|
||||||
current_app.logger.info(msg)
|
|
||||||
|
|
||||||
self.file.flush()
|
|
||||||
|
|
||||||
|
|
||||||
log = _logguer()
|
|
||||||
|
|
||||||
|
|
||||||
# Alarms by email:
|
|
||||||
def sendAlarm(subject, txt):
|
|
||||||
from app.scodoc import sco_preferences
|
|
||||||
|
|
||||||
sender = sco_preferences.get_preference("email_from_addr")
|
|
||||||
email.send_email(subject, sender, [ALARM_DESTINATION], txt)
|
|
||||||
|
|
||||||
|
|
||||||
# Debug: log call stack
|
|
||||||
def logCallStack():
|
|
||||||
log("Call stack:\n" + "\n".join(x.strip() for x in traceback.format_stack()[:-1]))
|
|
@ -37,7 +37,7 @@ from flask import g, url_for
|
|||||||
|
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
import app.scodoc.notesdb as ndb
|
import app.scodoc.notesdb as ndb
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
from app.scodoc.sco_formulas import NoteVector
|
from app.scodoc.sco_formulas import NoteVector
|
||||||
from app.scodoc.sco_exceptions import (
|
from app.scodoc.sco_exceptions import (
|
||||||
AccessDenied,
|
AccessDenied,
|
||||||
|
@ -11,7 +11,7 @@ from flask import g, current_app
|
|||||||
|
|
||||||
import app
|
import app
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
from app.scodoc.sco_exceptions import ScoException, ScoValueError, NoteProcessError
|
from app.scodoc.sco_exceptions import ScoException, ScoValueError, NoteProcessError
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ from app.scodoc import pe_tools
|
|||||||
|
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
import app.scodoc.notesdb as ndb
|
import app.scodoc.notesdb as ndb
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
from app.scodoc.gen_tables import GenTable, SeqGenTable
|
from app.scodoc.gen_tables import GenTable, SeqGenTable
|
||||||
from app.scodoc import sco_preferences
|
from app.scodoc import sco_preferences
|
||||||
from app.scodoc import sco_etud
|
from app.scodoc import sco_etud
|
||||||
|
@ -36,7 +36,7 @@ Created on Fri Sep 9 09:15:05 2016
|
|||||||
@author: barasc
|
@author: barasc
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
from app.scodoc import sco_codes_parcours
|
from app.scodoc import sco_codes_parcours
|
||||||
from app.scodoc import sco_cache
|
from app.scodoc import sco_cache
|
||||||
from app.scodoc import sco_tag_module
|
from app.scodoc import sco_tag_module
|
||||||
|
@ -43,7 +43,7 @@ import re
|
|||||||
import unicodedata
|
import unicodedata
|
||||||
|
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
import six
|
import six
|
||||||
|
|
||||||
PE_DEBUG = 0
|
PE_DEBUG = 0
|
||||||
|
@ -36,7 +36,7 @@ import time
|
|||||||
import types
|
import types
|
||||||
|
|
||||||
from app.scodoc import notesdb as ndb
|
from app.scodoc import notesdb as ndb
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
from app.scodoc.scolog import logdb
|
from app.scodoc.scolog import logdb
|
||||||
from app.scodoc.sco_exceptions import ScoValueError, ScoInvalidDateError
|
from app.scodoc.sco_exceptions import ScoValueError, ScoInvalidDateError
|
||||||
from app.scodoc import sco_abs_notification
|
from app.scodoc import sco_abs_notification
|
||||||
|
@ -38,7 +38,7 @@ from flask_mail import Message
|
|||||||
|
|
||||||
import app.scodoc.notesdb as ndb
|
import app.scodoc.notesdb as ndb
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
from app.scodoc.scolog import logdb
|
from app.scodoc.scolog import logdb
|
||||||
from app.scodoc import sco_etud
|
from app.scodoc import sco_etud
|
||||||
from app.scodoc import sco_formsemestre
|
from app.scodoc import sco_formsemestre
|
||||||
|
@ -46,7 +46,7 @@ from app.scodoc import sco_groups
|
|||||||
from app.scodoc import sco_moduleimpl
|
from app.scodoc import sco_moduleimpl
|
||||||
from app.scodoc import sco_photos
|
from app.scodoc import sco_photos
|
||||||
from app.scodoc import sco_preferences
|
from app.scodoc import sco_preferences
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
from app.scodoc.sco_exceptions import ScoValueError
|
from app.scodoc.sco_exceptions import ScoValueError
|
||||||
|
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ Pour chaque étudiant commun:
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
from app.scodoc import sco_apogee_csv
|
from app.scodoc import sco_apogee_csv
|
||||||
from app.scodoc.gen_tables import GenTable
|
from app.scodoc.gen_tables import GenTable
|
||||||
from app.scodoc.sco_exceptions import ScoValueError
|
from app.scodoc.sco_exceptions import ScoValueError
|
||||||
|
@ -96,7 +96,7 @@ from chardet import detect as chardet_detect
|
|||||||
|
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
import app.scodoc.notesdb as ndb
|
import app.scodoc.notesdb as ndb
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
from app.scodoc.sco_exceptions import ScoValueError, FormatError
|
from app.scodoc.sco_exceptions import ScoValueError, FormatError
|
||||||
from app.scodoc.gen_tables import GenTable
|
from app.scodoc.gen_tables import GenTable
|
||||||
from app.scodoc.sco_vdi import ApoEtapeVDI
|
from app.scodoc.sco_vdi import ApoEtapeVDI
|
||||||
|
@ -59,7 +59,7 @@ from flask import g
|
|||||||
|
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
from config import Config
|
from config import Config
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
from app.scodoc.TrivialFormulator import TrivialFormulator
|
from app.scodoc.TrivialFormulator import TrivialFormulator
|
||||||
from app.scodoc.sco_exceptions import (
|
from app.scodoc.sco_exceptions import (
|
||||||
AccessDenied,
|
AccessDenied,
|
||||||
@ -77,9 +77,17 @@ from app.scodoc import sco_pvpdf
|
|||||||
|
|
||||||
class BaseArchiver(object):
|
class BaseArchiver(object):
|
||||||
def __init__(self, archive_type=""):
|
def __init__(self, archive_type=""):
|
||||||
|
self.archive_type = archive_type
|
||||||
|
self.initialized = False
|
||||||
|
self.root = None
|
||||||
|
|
||||||
|
def initialize(self):
|
||||||
|
if self.initialized:
|
||||||
|
return
|
||||||
dirs = [Config.SCODOC_VAR_DIR, "archives"]
|
dirs = [Config.SCODOC_VAR_DIR, "archives"]
|
||||||
if archive_type:
|
if self.archive_type:
|
||||||
dirs.append(archive_type)
|
dirs.append(self.archive_type)
|
||||||
|
|
||||||
self.root = os.path.join(*dirs)
|
self.root = os.path.join(*dirs)
|
||||||
log("initialized archiver, path=" + self.root)
|
log("initialized archiver, path=" + self.root)
|
||||||
path = dirs[0]
|
path = dirs[0]
|
||||||
@ -92,12 +100,14 @@ class BaseArchiver(object):
|
|||||||
os.mkdir(path)
|
os.mkdir(path)
|
||||||
finally:
|
finally:
|
||||||
scu.GSL.release()
|
scu.GSL.release()
|
||||||
|
self.initialized = True
|
||||||
|
|
||||||
def get_obj_dir(self, oid):
|
def get_obj_dir(self, oid):
|
||||||
"""
|
"""
|
||||||
:return: path to directory of archives for this object (eg formsemestre_id or etudid).
|
:return: path to directory of archives for this object (eg formsemestre_id or etudid).
|
||||||
If directory does not yet exist, create it.
|
If directory does not yet exist, create it.
|
||||||
"""
|
"""
|
||||||
|
self.initialize()
|
||||||
dept_dir = os.path.join(self.root, g.scodoc_dept)
|
dept_dir = os.path.join(self.root, g.scodoc_dept)
|
||||||
try:
|
try:
|
||||||
scu.GSL.acquire()
|
scu.GSL.acquire()
|
||||||
@ -116,6 +126,7 @@ class BaseArchiver(object):
|
|||||||
"""
|
"""
|
||||||
:return: list of archive oids
|
:return: list of archive oids
|
||||||
"""
|
"""
|
||||||
|
self.initialize()
|
||||||
base = os.path.join(self.root, g.scodoc_dept) + os.path.sep
|
base = os.path.join(self.root, g.scodoc_dept) + os.path.sep
|
||||||
dirs = glob.glob(base + "*")
|
dirs = glob.glob(base + "*")
|
||||||
return [os.path.split(x)[1] for x in dirs]
|
return [os.path.split(x)[1] for x in dirs]
|
||||||
@ -124,6 +135,7 @@ class BaseArchiver(object):
|
|||||||
"""Returns
|
"""Returns
|
||||||
:return: list of archive identifiers for this object (paths to non empty dirs)
|
:return: list of archive identifiers for this object (paths to non empty dirs)
|
||||||
"""
|
"""
|
||||||
|
self.initialize()
|
||||||
base = self.get_obj_dir(oid) + os.path.sep
|
base = self.get_obj_dir(oid) + os.path.sep
|
||||||
dirs = glob.glob(
|
dirs = glob.glob(
|
||||||
base
|
base
|
||||||
@ -136,6 +148,7 @@ class BaseArchiver(object):
|
|||||||
|
|
||||||
def delete_archive(self, archive_id):
|
def delete_archive(self, archive_id):
|
||||||
"""Delete (forever) this archive"""
|
"""Delete (forever) this archive"""
|
||||||
|
self.initialize()
|
||||||
try:
|
try:
|
||||||
scu.GSL.acquire()
|
scu.GSL.acquire()
|
||||||
shutil.rmtree(archive_id, ignore_errors=True)
|
shutil.rmtree(archive_id, ignore_errors=True)
|
||||||
@ -149,6 +162,7 @@ class BaseArchiver(object):
|
|||||||
|
|
||||||
def list_archive(self, archive_id: str) -> str:
|
def list_archive(self, archive_id: str) -> str:
|
||||||
"""Return list of filenames (without path) in archive"""
|
"""Return list of filenames (without path) in archive"""
|
||||||
|
self.initialize()
|
||||||
try:
|
try:
|
||||||
scu.GSL.acquire()
|
scu.GSL.acquire()
|
||||||
files = os.listdir(archive_id)
|
files = os.listdir(archive_id)
|
||||||
@ -169,6 +183,7 @@ class BaseArchiver(object):
|
|||||||
|
|
||||||
def get_id_from_name(self, oid, archive_name):
|
def get_id_from_name(self, oid, archive_name):
|
||||||
"""returns archive id (check that name is valid)"""
|
"""returns archive id (check that name is valid)"""
|
||||||
|
self.initialize()
|
||||||
if not self.is_valid_archive_name(archive_name):
|
if not self.is_valid_archive_name(archive_name):
|
||||||
raise ValueError("invalid archive name")
|
raise ValueError("invalid archive name")
|
||||||
archive_id = os.path.join(self.get_obj_dir(oid), archive_name)
|
archive_id = os.path.join(self.get_obj_dir(oid), archive_name)
|
||||||
@ -182,6 +197,7 @@ class BaseArchiver(object):
|
|||||||
|
|
||||||
def get_archive_description(self, archive_id):
|
def get_archive_description(self, archive_id):
|
||||||
"""Return description of archive"""
|
"""Return description of archive"""
|
||||||
|
self.initialize()
|
||||||
return open(os.path.join(archive_id, "_description.txt")).read()
|
return open(os.path.join(archive_id, "_description.txt")).read()
|
||||||
|
|
||||||
def create_obj_archive(self, oid: int, description: str):
|
def create_obj_archive(self, oid: int, description: str):
|
||||||
@ -205,6 +221,7 @@ class BaseArchiver(object):
|
|||||||
Filename may be modified (sanitized): return used filename
|
Filename may be modified (sanitized): return used filename
|
||||||
The file is created or replaced.
|
The file is created or replaced.
|
||||||
"""
|
"""
|
||||||
|
self.initialize()
|
||||||
filename = scu.sanitize_filename(filename)
|
filename = scu.sanitize_filename(filename)
|
||||||
log("storing %s (%d bytes) in %s" % (filename, len(data), archive_id))
|
log("storing %s (%d bytes) in %s" % (filename, len(data), archive_id))
|
||||||
try:
|
try:
|
||||||
@ -219,6 +236,7 @@ class BaseArchiver(object):
|
|||||||
|
|
||||||
def get(self, archive_id: str, filename: str):
|
def get(self, archive_id: str, filename: str):
|
||||||
"""Retreive data"""
|
"""Retreive data"""
|
||||||
|
self.initialize()
|
||||||
if not scu.is_valid_filename(filename):
|
if not scu.is_valid_filename(filename):
|
||||||
log('Archiver.get: invalid filename "%s"' % filename)
|
log('Archiver.get: invalid filename "%s"' % filename)
|
||||||
raise ValueError("invalid filename")
|
raise ValueError("invalid filename")
|
||||||
|
@ -46,7 +46,7 @@ from flask_mail import Message
|
|||||||
|
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
import app.scodoc.notesdb as ndb
|
import app.scodoc.notesdb as ndb
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
from app.scodoc.sco_permissions import Permission
|
from app.scodoc.sco_permissions import Permission
|
||||||
from app.scodoc.sco_exceptions import AccessDenied
|
from app.scodoc.sco_exceptions import AccessDenied
|
||||||
from app.scodoc import html_sco_header
|
from app.scodoc import html_sco_header
|
||||||
|
@ -67,4 +67,4 @@ class BulletinGeneratorExample(sco_bulletins_standard.BulletinGeneratorStandard)
|
|||||||
|
|
||||||
|
|
||||||
# Déclarer votre classe à ScoDoc:
|
# Déclarer votre classe à ScoDoc:
|
||||||
sco_bulletins_generator.register_bulletin_class(BulletinGeneratorExample)
|
# sco_bulletins_generator.register_bulletin_class(BulletinGeneratorExample)
|
||||||
|
@ -54,7 +54,7 @@ from reportlab.platypus import Table, TableStyle, Image, KeepInFrame
|
|||||||
|
|
||||||
from app.scodoc import sco_utils as scu
|
from app.scodoc import sco_utils as scu
|
||||||
from app.scodoc.sco_exceptions import NoteProcessError
|
from app.scodoc.sco_exceptions import NoteProcessError
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
from app.scodoc import sco_formsemestre
|
from app.scodoc import sco_formsemestre
|
||||||
from app.scodoc import sco_pdf
|
from app.scodoc import sco_pdf
|
||||||
from app.scodoc.sco_pdf import PDFLOCK
|
from app.scodoc.sco_pdf import PDFLOCK
|
||||||
@ -65,7 +65,6 @@ BULLETIN_CLASSES = collections.OrderedDict()
|
|||||||
|
|
||||||
|
|
||||||
def register_bulletin_class(klass):
|
def register_bulletin_class(klass):
|
||||||
log("registering bulletin class '%s'" % klass.__name__)
|
|
||||||
BULLETIN_CLASSES[klass.__name__] = klass
|
BULLETIN_CLASSES[klass.__name__] = klass
|
||||||
|
|
||||||
|
|
||||||
|
@ -378,7 +378,7 @@ class BulletinGeneratorLegacy(sco_bulletins_generator.BulletinGenerator):
|
|||||||
return []
|
return []
|
||||||
|
|
||||||
|
|
||||||
sco_bulletins_generator.register_bulletin_class(BulletinGeneratorLegacy)
|
# sco_bulletins_generator.register_bulletin_class(BulletinGeneratorLegacy)
|
||||||
|
|
||||||
|
|
||||||
class BulTableStyle(object):
|
class BulTableStyle(object):
|
||||||
|
@ -61,7 +61,7 @@ from reportlab.platypus.doctemplate import PageTemplate, BaseDocTemplate
|
|||||||
from flask import g, url_for
|
from flask import g, url_for
|
||||||
|
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
from app.scodoc import sco_cache
|
from app.scodoc import sco_cache
|
||||||
from app.scodoc import sco_formsemestre
|
from app.scodoc import sco_formsemestre
|
||||||
from app.scodoc import sco_pdf
|
from app.scodoc import sco_pdf
|
||||||
|
@ -673,4 +673,4 @@ class BulletinGeneratorStandard(sco_bulletins_generator.BulletinGenerator):
|
|||||||
return nbeval
|
return nbeval
|
||||||
|
|
||||||
|
|
||||||
sco_bulletins_generator.register_bulletin_class(BulletinGeneratorStandard)
|
# sco_bulletins_generator.register_bulletin_class(BulletinGeneratorStandard)
|
||||||
|
@ -300,8 +300,4 @@ class BulletinGeneratorUCAC(sco_bulletins_standard.BulletinGeneratorStandard):
|
|||||||
return colkeys, P, pdf_style, colWidths
|
return colkeys, P, pdf_style, colWidths
|
||||||
|
|
||||||
|
|
||||||
sco_bulletins_generator.register_bulletin_class(BulletinGeneratorUCAC)
|
# sco_bulletins_generator.register_bulletin_class(BulletinGeneratorUCAC)
|
||||||
|
|
||||||
|
|
||||||
def bulletin_table_ucac(I, version=None):
|
|
||||||
""""""
|
|
||||||
|
@ -46,7 +46,7 @@ from xml.etree.ElementTree import Element
|
|||||||
|
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
import app.scodoc.notesdb as ndb
|
import app.scodoc.notesdb as ndb
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
from app.scodoc import sco_abs
|
from app.scodoc import sco_abs
|
||||||
from app.scodoc import sco_codes_parcours
|
from app.scodoc import sco_codes_parcours
|
||||||
from app.scodoc import sco_cache
|
from app.scodoc import sco_cache
|
||||||
|
@ -61,7 +61,7 @@ from flask import g
|
|||||||
|
|
||||||
from app.scodoc import notesdb as ndb
|
from app.scodoc import notesdb as ndb
|
||||||
from app.scodoc import sco_utils as scu
|
from app.scodoc import sco_utils as scu
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
|
|
||||||
CACHE = None # set in app.__init__.py
|
CACHE = None # set in app.__init__.py
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ from app.scodoc.sco_utils import (
|
|||||||
EVALUATION_SESSION2,
|
EVALUATION_SESSION2,
|
||||||
)
|
)
|
||||||
from app.scodoc.sco_exceptions import ScoException
|
from app.scodoc.sco_exceptions import ScoException
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
from app.scodoc import sco_abs
|
from app.scodoc import sco_abs
|
||||||
from app.scodoc import sco_edit_module
|
from app.scodoc import sco_edit_module
|
||||||
from app.scodoc import sco_evaluations
|
from app.scodoc import sco_evaluations
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
from app.scodoc import sco_config
|
from app.scodoc import sco_config
|
||||||
|
|
||||||
# scodoc_local defines a CONFIG object
|
# scodoc_local defines a CONFIG object
|
||||||
|
@ -33,7 +33,7 @@ from flask import url_for, g
|
|||||||
|
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
import app.scodoc.notesdb as ndb
|
import app.scodoc.notesdb as ndb
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
from app.scodoc.sco_exceptions import AccessDenied
|
from app.scodoc.sco_exceptions import AccessDenied
|
||||||
from app.scodoc.scolog import logdb
|
from app.scodoc.scolog import logdb
|
||||||
from app.scodoc.gen_tables import GenTable
|
from app.scodoc.gen_tables import GenTable
|
||||||
|
@ -54,7 +54,7 @@ import requests
|
|||||||
|
|
||||||
import app.scodoc.notesdb as ndb
|
import app.scodoc.notesdb as ndb
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
from app.scodoc import html_sco_header
|
from app.scodoc import html_sco_header
|
||||||
from app.scodoc import sco_preferences
|
from app.scodoc import sco_preferences
|
||||||
from app.scodoc import sco_users
|
from app.scodoc import sco_users
|
||||||
|
@ -33,7 +33,7 @@ from flask import g, url_for
|
|||||||
|
|
||||||
import app.scodoc.notesdb as ndb
|
import app.scodoc.notesdb as ndb
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
from app.scodoc.TrivialFormulator import TrivialFormulator, tf_error_message
|
from app.scodoc.TrivialFormulator import TrivialFormulator, tf_error_message
|
||||||
from app.scodoc.sco_exceptions import ScoValueError, ScoLockedFormError
|
from app.scodoc.sco_exceptions import ScoValueError, ScoLockedFormError
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ from flask import g, url_for
|
|||||||
|
|
||||||
import app.scodoc.notesdb as ndb
|
import app.scodoc.notesdb as ndb
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
from app.scodoc.TrivialFormulator import TrivialFormulator, tf_error_message
|
from app.scodoc.TrivialFormulator import TrivialFormulator, tf_error_message
|
||||||
from app.scodoc.sco_exceptions import ScoValueError, ScoLockedFormError
|
from app.scodoc.sco_exceptions import ScoValueError, ScoLockedFormError
|
||||||
from app.scodoc import html_sco_header
|
from app.scodoc import html_sco_header
|
||||||
|
@ -33,7 +33,7 @@ from flask import url_for, g
|
|||||||
|
|
||||||
import app.scodoc.notesdb as ndb
|
import app.scodoc.notesdb as ndb
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
from app.scodoc.TrivialFormulator import TrivialFormulator
|
from app.scodoc.TrivialFormulator import TrivialFormulator
|
||||||
from app.scodoc.sco_permissions import Permission
|
from app.scodoc.sco_permissions import Permission
|
||||||
from app.scodoc.sco_exceptions import ScoValueError, ScoLockedFormError, ScoGenError
|
from app.scodoc.sco_exceptions import ScoValueError, ScoLockedFormError, ScoGenError
|
||||||
|
@ -34,7 +34,7 @@ from flask_login import current_user
|
|||||||
|
|
||||||
import app.scodoc.notesdb as ndb
|
import app.scodoc.notesdb as ndb
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
from app.scodoc.TrivialFormulator import TrivialFormulator, TF
|
from app.scodoc.TrivialFormulator import TrivialFormulator, TF
|
||||||
from app.scodoc.gen_tables import GenTable
|
from app.scodoc.gen_tables import GenTable
|
||||||
from app.scodoc.sco_permissions import Permission
|
from app.scodoc.sco_permissions import Permission
|
||||||
|
@ -39,7 +39,7 @@ import icalendar
|
|||||||
import pprint
|
import pprint
|
||||||
|
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
from app.scodoc import html_sco_header
|
from app.scodoc import html_sco_header
|
||||||
from app.scodoc import sco_formsemestre
|
from app.scodoc import sco_formsemestre
|
||||||
from app.scodoc import sco_groups
|
from app.scodoc import sco_groups
|
||||||
|
@ -35,7 +35,7 @@ import flask
|
|||||||
from flask import url_for, g
|
from flask import url_for, g
|
||||||
|
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
from app.scodoc import html_sco_header
|
from app.scodoc import html_sco_header
|
||||||
from app.scodoc import notes_table
|
from app.scodoc import notes_table
|
||||||
from app.scodoc import sco_apogee_csv
|
from app.scodoc import sco_apogee_csv
|
||||||
|
@ -95,7 +95,7 @@ import json
|
|||||||
from flask import url_for, g
|
from flask import url_for, g
|
||||||
|
|
||||||
from app.scodoc.sco_portal_apogee import get_inscrits_etape
|
from app.scodoc.sco_portal_apogee import get_inscrits_etape
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
from app.scodoc.sco_utils import annee_scolaire_debut
|
from app.scodoc.sco_utils import annee_scolaire_debut
|
||||||
from app.scodoc.gen_tables import GenTable
|
from app.scodoc.gen_tables import GenTable
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ from app.scodoc.sco_utils import SCO_ENCODING
|
|||||||
import app.scodoc.notesdb as ndb
|
import app.scodoc.notesdb as ndb
|
||||||
from app.scodoc.sco_exceptions import ScoGenError, ScoValueError
|
from app.scodoc.sco_exceptions import ScoGenError, ScoValueError
|
||||||
|
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
from app.scodoc.TrivialFormulator import TrivialFormulator
|
from app.scodoc.TrivialFormulator import TrivialFormulator
|
||||||
from app.scodoc import safehtml
|
from app.scodoc import safehtml
|
||||||
from app.scodoc import sco_preferences
|
from app.scodoc import sco_preferences
|
||||||
|
@ -39,7 +39,6 @@ from flask import g
|
|||||||
from flask_login import current_user
|
from flask_login import current_user
|
||||||
from flask import request
|
from flask import request
|
||||||
|
|
||||||
from app.scodoc.notes_log import log, logCallStack
|
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
import app.scodoc.notesdb as ndb
|
import app.scodoc.notesdb as ndb
|
||||||
from app.scodoc.sco_exceptions import AccessDenied, ScoValueError
|
from app.scodoc.sco_exceptions import AccessDenied, ScoValueError
|
||||||
|
@ -44,7 +44,7 @@ from openpyxl.comments import Comment
|
|||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
from app.scodoc import notesdb
|
from app.scodoc import notesdb
|
||||||
from app.scodoc import sco_preferences
|
from app.scodoc import sco_preferences
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
from app.scodoc.sco_exceptions import ScoValueError
|
from app.scodoc.sco_exceptions import ScoValueError
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ from flask import url_for, g
|
|||||||
|
|
||||||
import app.scodoc.notesdb as ndb
|
import app.scodoc.notesdb as ndb
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
from app.scodoc import html_sco_header
|
from app.scodoc import html_sco_header
|
||||||
from app.scodoc import sco_bac
|
from app.scodoc import sco_bac
|
||||||
from app.scodoc import sco_codes_parcours
|
from app.scodoc import sco_codes_parcours
|
||||||
|
@ -36,7 +36,7 @@ from flask import g, url_for
|
|||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
|
|
||||||
import app.scodoc.notesdb as ndb
|
import app.scodoc.notesdb as ndb
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
from app.scodoc import sco_codes_parcours
|
from app.scodoc import sco_codes_parcours
|
||||||
from app.scodoc import sco_edit_matiere
|
from app.scodoc import sco_edit_matiere
|
||||||
from app.scodoc import sco_edit_module
|
from app.scodoc import sco_edit_module
|
||||||
|
@ -40,7 +40,7 @@ from app.scodoc import sco_formations
|
|||||||
from app.scodoc import sco_preferences
|
from app.scodoc import sco_preferences
|
||||||
from app.scodoc import sco_users
|
from app.scodoc import sco_users
|
||||||
from app.scodoc.gen_tables import GenTable
|
from app.scodoc.gen_tables import GenTable
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
from app.scodoc.sco_codes_parcours import NO_SEMESTRE_ID
|
from app.scodoc.sco_codes_parcours import NO_SEMESTRE_ID
|
||||||
from app.scodoc.sco_vdi import ApoEtapeVDI
|
from app.scodoc.sco_vdi import ApoEtapeVDI
|
||||||
import app.scodoc.notesdb as ndb
|
import app.scodoc.notesdb as ndb
|
||||||
|
@ -36,7 +36,7 @@ import app.scodoc.notesdb as ndb
|
|||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
from app.scodoc import sco_cache
|
from app.scodoc import sco_cache
|
||||||
from app.scodoc import sco_groups
|
from app.scodoc import sco_groups
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
from app.scodoc.TrivialFormulator import TrivialFormulator, TF
|
from app.scodoc.TrivialFormulator import TrivialFormulator, TF
|
||||||
from app.scodoc.sco_exceptions import AccessDenied, ScoValueError
|
from app.scodoc.sco_exceptions import AccessDenied, ScoValueError
|
||||||
from app.scodoc.sco_permissions import Permission
|
from app.scodoc.sco_permissions import Permission
|
||||||
@ -78,7 +78,7 @@ def formsemestre_createwithmodules(REQUEST=None):
|
|||||||
"""<h2>Mise en place d'un semestre de formation</h2>""",
|
"""<h2>Mise en place d'un semestre de formation</h2>""",
|
||||||
]
|
]
|
||||||
r = do_formsemestre_createwithmodules(REQUEST=REQUEST)
|
r = do_formsemestre_createwithmodules(REQUEST=REQUEST)
|
||||||
if isinstance(r, six.string_types):
|
if isinstance(r, str):
|
||||||
H.append(r)
|
H.append(r)
|
||||||
else:
|
else:
|
||||||
return r # response redirect
|
return r # response redirect
|
||||||
@ -106,7 +106,7 @@ def formsemestre_editwithmodules(REQUEST, formsemestre_id):
|
|||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
r = do_formsemestre_createwithmodules(REQUEST=REQUEST, edit=1)
|
r = do_formsemestre_createwithmodules(REQUEST=REQUEST, edit=1)
|
||||||
if isinstance(r, six.string_types):
|
if isinstance(r, str):
|
||||||
H.append(r)
|
H.append(r)
|
||||||
else:
|
else:
|
||||||
return r # response redirect
|
return r # response redirect
|
||||||
|
@ -39,7 +39,7 @@ from flask_login import current_user
|
|||||||
|
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
import app.scodoc.notesdb as ndb
|
import app.scodoc.notesdb as ndb
|
||||||
from app.scodoc.sco_utils import log
|
from app import log
|
||||||
from app.scodoc.TrivialFormulator import TrivialFormulator, tf_error_message
|
from app.scodoc.TrivialFormulator import TrivialFormulator, tf_error_message
|
||||||
from app.scodoc import html_sco_header
|
from app.scodoc import html_sco_header
|
||||||
from app.scodoc import sco_cache
|
from app.scodoc import sco_cache
|
||||||
|
@ -33,7 +33,7 @@ import flask
|
|||||||
from flask import url_for, g
|
from flask import url_for, g
|
||||||
|
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
from app.scodoc.scolog import logdb
|
from app.scodoc.scolog import logdb
|
||||||
from app.scodoc.sco_exceptions import ScoValueError
|
from app.scodoc.sco_exceptions import ScoValueError
|
||||||
from app.scodoc.sco_permissions import Permission
|
from app.scodoc.sco_permissions import Permission
|
||||||
|
@ -34,7 +34,7 @@ from flask import request
|
|||||||
from flask import url_for
|
from flask import url_for
|
||||||
from flask_login import current_user
|
from flask_login import current_user
|
||||||
|
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
import app.scodoc.notesdb as ndb
|
import app.scodoc.notesdb as ndb
|
||||||
from app.scodoc.sco_permissions import Permission
|
from app.scodoc.sco_permissions import Permission
|
||||||
|
@ -34,7 +34,7 @@ from flask import url_for, g
|
|||||||
|
|
||||||
import app.scodoc.notesdb as ndb
|
import app.scodoc.notesdb as ndb
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
from app.scodoc.scolog import logdb
|
from app.scodoc.scolog import logdb
|
||||||
from app.scodoc.TrivialFormulator import TrivialFormulator, tf_error_message
|
from app.scodoc.TrivialFormulator import TrivialFormulator, tf_error_message
|
||||||
from app.scodoc.sco_exceptions import ScoValueError
|
from app.scodoc.sco_exceptions import ScoValueError
|
||||||
|
@ -47,7 +47,7 @@ from flask import url_for
|
|||||||
|
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
import app.scodoc.notesdb as ndb
|
import app.scodoc.notesdb as ndb
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
from app.scodoc.scolog import logdb
|
from app.scodoc.scolog import logdb
|
||||||
from app.scodoc import html_sco_header
|
from app.scodoc import html_sco_header
|
||||||
from app.scodoc import sco_codes_parcours
|
from app.scodoc import sco_codes_parcours
|
||||||
|
@ -39,7 +39,7 @@ from flask import g, url_for
|
|||||||
|
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
import app.scodoc.notesdb as ndb
|
import app.scodoc.notesdb as ndb
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
from app.scodoc.sco_excel import COLORS
|
from app.scodoc.sco_excel import COLORS
|
||||||
from app.scodoc.sco_formsemestre_inscriptions import (
|
from app.scodoc.sco_formsemestre_inscriptions import (
|
||||||
do_formsemestre_inscription_with_modules,
|
do_formsemestre_inscription_with_modules,
|
||||||
|
@ -36,7 +36,7 @@ from email.header import Header
|
|||||||
|
|
||||||
from app import db, Departement
|
from app import db, Departement
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
from app.scodoc.sco_exceptions import AccessDenied, ScoValueError, ScoException
|
from app.scodoc.sco_exceptions import AccessDenied, ScoValueError, ScoException
|
||||||
from app.scodoc import sco_excel
|
from app.scodoc import sco_excel
|
||||||
from app.scodoc import sco_preferences
|
from app.scodoc import sco_preferences
|
||||||
|
@ -35,7 +35,7 @@ from flask import url_for, g
|
|||||||
|
|
||||||
import app.scodoc.notesdb as ndb
|
import app.scodoc.notesdb as ndb
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
from app.scodoc.gen_tables import GenTable
|
from app.scodoc.gen_tables import GenTable
|
||||||
from app.scodoc import html_sco_header
|
from app.scodoc import html_sco_header
|
||||||
from app.scodoc import sco_codes_parcours
|
from app.scodoc import sco_codes_parcours
|
||||||
|
@ -35,7 +35,7 @@ from flask import url_for, g
|
|||||||
|
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
import app.scodoc.notesdb as ndb
|
import app.scodoc.notesdb as ndb
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
from app.scodoc.TrivialFormulator import TrivialFormulator
|
from app.scodoc.TrivialFormulator import TrivialFormulator
|
||||||
from app.scodoc import htmlutils
|
from app.scodoc import htmlutils
|
||||||
from app.scodoc import html_sco_header
|
from app.scodoc import html_sco_header
|
||||||
|
@ -35,7 +35,7 @@ Elle n'est pas utilisée pour les parcours, ni pour rien d'autre
|
|||||||
"""
|
"""
|
||||||
import app.scodoc.notesdb as ndb
|
import app.scodoc.notesdb as ndb
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
|
|
||||||
|
|
||||||
def list_formsemestres_modalites(sems):
|
def list_formsemestres_modalites(sems):
|
||||||
|
@ -34,7 +34,7 @@ import app.scodoc.sco_utils as scu
|
|||||||
import app.scodoc.notesdb as ndb
|
import app.scodoc.notesdb as ndb
|
||||||
from app.scodoc.sco_permissions import Permission
|
from app.scodoc.sco_permissions import Permission
|
||||||
from app.scodoc.sco_exceptions import ScoValueError, AccessDenied
|
from app.scodoc.sco_exceptions import ScoValueError, AccessDenied
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
from app.scodoc import scolog
|
from app.scodoc import scolog
|
||||||
from app.scodoc import sco_formsemestre
|
from app.scodoc import sco_formsemestre
|
||||||
from app.scodoc import sco_cache
|
from app.scodoc import sco_cache
|
||||||
|
@ -34,7 +34,7 @@ from flask import url_for, g
|
|||||||
|
|
||||||
import app.scodoc.notesdb as ndb
|
import app.scodoc.notesdb as ndb
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
from app.scodoc.scolog import logdb
|
from app.scodoc.scolog import logdb
|
||||||
from app.scodoc import html_sco_header
|
from app.scodoc import html_sco_header
|
||||||
from app.scodoc import htmlutils
|
from app.scodoc import htmlutils
|
||||||
|
@ -38,7 +38,7 @@ from flask_login import current_user
|
|||||||
|
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
import app.scodoc.notesdb as ndb
|
import app.scodoc.notesdb as ndb
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
from app.scodoc import sco_formsemestre
|
from app.scodoc import sco_formsemestre
|
||||||
from app.scodoc import sco_moduleimpl
|
from app.scodoc import sco_moduleimpl
|
||||||
from app.scodoc import sco_preferences
|
from app.scodoc import sco_preferences
|
||||||
|
@ -34,7 +34,7 @@ from flask import url_for, g
|
|||||||
|
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
import app.scodoc.notesdb as ndb
|
import app.scodoc.notesdb as ndb
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
from app.scodoc import html_sco_header
|
from app.scodoc import html_sco_header
|
||||||
from app.scodoc import htmlutils
|
from app.scodoc import htmlutils
|
||||||
from app.scodoc import sco_archives_etud
|
from app.scodoc import sco_archives_etud
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
import app.scodoc.notesdb as ndb
|
import app.scodoc.notesdb as ndb
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
from app.scodoc.scolog import logdb
|
from app.scodoc.scolog import logdb
|
||||||
from app.scodoc import sco_cache
|
from app.scodoc import sco_cache
|
||||||
from app.scodoc import sco_formsemestre
|
from app.scodoc import sco_formsemestre
|
||||||
|
@ -64,7 +64,7 @@ from app.scodoc.sco_utils import (
|
|||||||
SCODOC_LOGOS_DIR,
|
SCODOC_LOGOS_DIR,
|
||||||
LOGOS_IMAGES_ALLOWED_TYPES,
|
LOGOS_IMAGES_ALLOWED_TYPES,
|
||||||
)
|
)
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
from app.scodoc.sco_exceptions import ScoGenError
|
from app.scodoc.sco_exceptions import ScoGenError
|
||||||
import sco_version
|
import sco_version
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ from config import Config
|
|||||||
from app.scodoc import sco_etud
|
from app.scodoc import sco_etud
|
||||||
from app.scodoc import sco_portal_apogee
|
from app.scodoc import sco_portal_apogee
|
||||||
from app.scodoc import sco_preferences
|
from app.scodoc import sco_preferences
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
from app.scodoc.scolog import logdb
|
from app.scodoc.scolog import logdb
|
||||||
import app.scodoc.notesdb as ndb
|
import app.scodoc.notesdb as ndb
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
|
@ -39,7 +39,7 @@ import flask
|
|||||||
from app.scodoc.sco_exceptions import ScoValueError
|
from app.scodoc.sco_exceptions import ScoValueError
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
import app.scodoc.notesdb as ndb
|
import app.scodoc.notesdb as ndb
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
from app.scodoc import html_sco_header
|
from app.scodoc import html_sco_header
|
||||||
from app.scodoc import sco_edit_module
|
from app.scodoc import sco_edit_module
|
||||||
from app.scodoc import sco_evaluations
|
from app.scodoc import sco_evaluations
|
||||||
|
@ -36,7 +36,7 @@ import xml.sax.saxutils
|
|||||||
import xml.dom.minidom
|
import xml.dom.minidom
|
||||||
|
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
from app.scodoc.sco_exceptions import ScoValueError
|
from app.scodoc.sco_exceptions import ScoValueError
|
||||||
from app.scodoc import sco_preferences
|
from app.scodoc import sco_preferences
|
||||||
import six
|
import six
|
||||||
|
@ -115,7 +115,7 @@ from flask import g
|
|||||||
|
|
||||||
from app.models import Departement
|
from app.models import Departement
|
||||||
from app.scodoc import sco_cache
|
from app.scodoc import sco_cache
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
from app.scodoc.sco_exceptions import ScoValueError, ScoException
|
from app.scodoc.sco_exceptions import ScoValueError, ScoException
|
||||||
from app.scodoc.TrivialFormulator import TrivialFormulator
|
from app.scodoc.TrivialFormulator import TrivialFormulator
|
||||||
import app.scodoc.notesdb as ndb
|
import app.scodoc.notesdb as ndb
|
||||||
|
@ -56,7 +56,7 @@ from flask import url_for, g
|
|||||||
|
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
import app.scodoc.notesdb as ndb
|
import app.scodoc.notesdb as ndb
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
from app.scodoc import html_sco_header
|
from app.scodoc import html_sco_header
|
||||||
from app.scodoc import sco_codes_parcours
|
from app.scodoc import sco_codes_parcours
|
||||||
from app.scodoc import sco_cache
|
from app.scodoc import sco_cache
|
||||||
|
@ -32,7 +32,7 @@ import datetime
|
|||||||
from xml.etree import ElementTree
|
from xml.etree import ElementTree
|
||||||
|
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
from app.scodoc import html_sco_header
|
from app.scodoc import html_sco_header
|
||||||
from app.scodoc import sco_bac
|
from app.scodoc import sco_bac
|
||||||
from app.scodoc import sco_bulletins_json
|
from app.scodoc import sco_bulletins_json
|
||||||
|
@ -56,7 +56,7 @@ from app.scodoc import sco_pdf
|
|||||||
from app.scodoc import sco_preferences
|
from app.scodoc import sco_preferences
|
||||||
import sco_version
|
import sco_version
|
||||||
from app.scodoc.gen_tables import GenTable
|
from app.scodoc.gen_tables import GenTable
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
from app.scodoc.sco_codes_parcours import code_semestre_validant
|
from app.scodoc.sco_codes_parcours import code_semestre_validant
|
||||||
from app.scodoc.sco_exceptions import ScoValueError
|
from app.scodoc.sco_exceptions import ScoValueError
|
||||||
from app.scodoc.sco_pdf import SU
|
from app.scodoc.sco_pdf import SU
|
||||||
|
@ -40,7 +40,7 @@ from flask_login import current_user
|
|||||||
|
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
import app.scodoc.notesdb as ndb
|
import app.scodoc.notesdb as ndb
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
from app.scodoc.sco_exceptions import (
|
from app.scodoc.sco_exceptions import (
|
||||||
AccessDenied,
|
AccessDenied,
|
||||||
InvalidNoteValue,
|
InvalidNoteValue,
|
||||||
|
@ -50,7 +50,7 @@ from app.scodoc import sco_formsemestre_status
|
|||||||
from app.scodoc import sco_portal_apogee
|
from app.scodoc import sco_portal_apogee
|
||||||
from app.scodoc import sco_preferences
|
from app.scodoc import sco_preferences
|
||||||
from app.scodoc.gen_tables import GenTable
|
from app.scodoc.gen_tables import GenTable
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
from app.scodoc.sco_etape_bilan import EtapeBilan
|
from app.scodoc.sco_etape_bilan import EtapeBilan
|
||||||
from app.scodoc.sco_exceptions import ScoValueError
|
from app.scodoc.sco_exceptions import ScoValueError
|
||||||
from app.scodoc.sco_vdi import ApoEtapeVDI
|
from app.scodoc.sco_vdi import ApoEtapeVDI
|
||||||
|
@ -46,7 +46,7 @@ from app.scodoc import sco_news
|
|||||||
from app.scodoc import sco_excel
|
from app.scodoc import sco_excel
|
||||||
from app.scodoc import sco_portal_apogee
|
from app.scodoc import sco_portal_apogee
|
||||||
from app.scodoc import sco_etud
|
from app.scodoc import sco_etud
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
from app.scodoc.sco_exceptions import ScoValueError
|
from app.scodoc.sco_exceptions import ScoValueError
|
||||||
from app.scodoc.sco_permissions import Permission
|
from app.scodoc.sco_permissions import Permission
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ from flask import g, url_for
|
|||||||
|
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
import app.scodoc.notesdb as ndb
|
import app.scodoc.notesdb as ndb
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
from app.scodoc import sco_cache
|
from app.scodoc import sco_cache
|
||||||
from app.scodoc import sco_edit_module
|
from app.scodoc import sco_edit_module
|
||||||
from app.scodoc import sco_etud
|
from app.scodoc import sco_etud
|
||||||
|
@ -46,7 +46,7 @@ from PIL import Image as PILImage
|
|||||||
import flask
|
import flask
|
||||||
from flask import url_for, g
|
from flask import url_for, g
|
||||||
|
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
from app.scodoc.TrivialFormulator import TrivialFormulator
|
from app.scodoc.TrivialFormulator import TrivialFormulator
|
||||||
from app.scodoc.sco_exceptions import ScoValueError
|
from app.scodoc.sco_exceptions import ScoValueError
|
||||||
|
@ -37,7 +37,7 @@ from reportlab.lib import pagesizes
|
|||||||
from reportlab.lib.pagesizes import A4, A3
|
from reportlab.lib.pagesizes import A4, A3
|
||||||
|
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
from app.scodoc import sco_abs
|
from app.scodoc import sco_abs
|
||||||
from app.scodoc import sco_groups
|
from app.scodoc import sco_groups
|
||||||
from app.scodoc import sco_groups_view
|
from app.scodoc import sco_groups_view
|
||||||
|
@ -58,7 +58,7 @@ from flask_login import current_user
|
|||||||
|
|
||||||
import app.scodoc.notesdb as ndb
|
import app.scodoc.notesdb as ndb
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
from app.scodoc import html_sco_header
|
from app.scodoc import html_sco_header
|
||||||
from app.scodoc import sco_codes_parcours
|
from app.scodoc import sco_codes_parcours
|
||||||
from app.scodoc import sco_edit_matiere
|
from app.scodoc import sco_edit_matiere
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
|
|
||||||
# Appel renvoyant la subversion "stable"
|
# Appel renvoyant la subversion "stable"
|
||||||
# La notion de "stable" est juste là pour éviter d'afficher trop frequemment
|
# La notion de "stable" est juste là pour éviter d'afficher trop frequemment
|
||||||
|
@ -45,7 +45,7 @@ from app.scodoc import sco_etud
|
|||||||
from app.scodoc import sco_excel
|
from app.scodoc import sco_excel
|
||||||
from app.scodoc import sco_preferences
|
from app.scodoc import sco_preferences
|
||||||
from app.scodoc.gen_tables import GenTable
|
from app.scodoc.gen_tables import GenTable
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
from app.scodoc.scolog import logdb
|
from app.scodoc.scolog import logdb
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
|
|
||||||
|
@ -43,13 +43,14 @@ import six
|
|||||||
import six.moves._thread
|
import six.moves._thread
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
import traceback
|
||||||
import types
|
import types
|
||||||
import unicodedata
|
import unicodedata
|
||||||
import six.moves.urllib.parse, six.moves.urllib.error
|
import six.moves.urllib.parse, six.moves.urllib.error
|
||||||
import six.moves.urllib.error, six.moves.urllib.parse
|
import six.moves.urllib.error, six.moves.urllib.parse
|
||||||
from xml.etree import ElementTree
|
from xml.etree import ElementTree
|
||||||
|
|
||||||
STRING_TYPES = six.string_types
|
from flask import g, current_app
|
||||||
|
|
||||||
from PIL import Image as PILImage
|
from PIL import Image as PILImage
|
||||||
|
|
||||||
@ -57,7 +58,6 @@ from flask import g, url_for, request
|
|||||||
|
|
||||||
from config import Config
|
from config import Config
|
||||||
|
|
||||||
from app.scodoc.notes_log import log
|
|
||||||
from app.scodoc.sco_vdi import ApoEtapeVDI
|
from app.scodoc.sco_vdi import ApoEtapeVDI
|
||||||
from app.scodoc.sco_xml import quote_xml_attr
|
from app.scodoc.sco_xml import quote_xml_attr
|
||||||
from app.scodoc.sco_codes_parcours import NOTES_TOLERANCE, CODES_EXPL
|
from app.scodoc.sco_codes_parcours import NOTES_TOLERANCE, CODES_EXPL
|
||||||
@ -794,7 +794,7 @@ def return_text_if_published(val, REQUEST):
|
|||||||
sauf quand elles sont appellées depuis python.
|
sauf quand elles sont appellées depuis python.
|
||||||
La présence de l'argument REQUEST indique la publication.
|
La présence de l'argument REQUEST indique la publication.
|
||||||
"""
|
"""
|
||||||
if REQUEST and not isinstance(val, STRING_TYPES):
|
if REQUEST and not isinstance(val, str):
|
||||||
return sendJSON(REQUEST, val)
|
return sendJSON(REQUEST, val)
|
||||||
return val
|
return val
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ from app.views import absences_bp as bp
|
|||||||
# ---------------
|
# ---------------
|
||||||
from app.scodoc import sco_utils as scu
|
from app.scodoc import sco_utils as scu
|
||||||
from app.scodoc import notesdb as ndb
|
from app.scodoc import notesdb as ndb
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
from app.scodoc.scolog import logdb
|
from app.scodoc.scolog import logdb
|
||||||
from app.scodoc.sco_permissions import Permission
|
from app.scodoc.sco_permissions import Permission
|
||||||
from app.scodoc.sco_exceptions import ScoValueError, ScoInvalidDateError
|
from app.scodoc.sco_exceptions import ScoValueError, ScoInvalidDateError
|
||||||
|
@ -42,7 +42,7 @@ import calendar
|
|||||||
|
|
||||||
# A REVOIR
|
# A REVOIR
|
||||||
# from sco_permissions import ScoEntrepriseView, ScoEntrepriseChange
|
# from sco_permissions import ScoEntrepriseView, ScoEntrepriseChange
|
||||||
# from app.scodoc.notes_log import log
|
# from app import log
|
||||||
# from scolog import logdb
|
# from scolog import logdb
|
||||||
# from sco_utils import SCO_ENCODING
|
# from sco_utils import SCO_ENCODING
|
||||||
# import app.scodoc.sco_utils as scu
|
# import app.scodoc.sco_utils as scu
|
||||||
|
@ -60,7 +60,7 @@ from app.views import notes_bp as bp
|
|||||||
|
|
||||||
from app.scodoc import sco_utils as scu
|
from app.scodoc import sco_utils as scu
|
||||||
from app.scodoc import notesdb as ndb
|
from app.scodoc import notesdb as ndb
|
||||||
from app.scodoc.notes_log import log, sendAlarm
|
from app import log, send_scodoc_alarm
|
||||||
|
|
||||||
from app.scodoc import scolog
|
from app.scodoc import scolog
|
||||||
from app.scodoc.scolog import logdb
|
from app.scodoc.scolog import logdb
|
||||||
@ -2514,7 +2514,7 @@ def check_formsemestre_integrity(formsemestre_id, REQUEST=None):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
if diag:
|
if diag:
|
||||||
sendAlarm(
|
send_scodoc_alarm(
|
||||||
"Notes: formation incoherente dans semestre %s !" % formsemestre_id,
|
"Notes: formation incoherente dans semestre %s !" % formsemestre_id,
|
||||||
"\n".join(diag),
|
"\n".join(diag),
|
||||||
)
|
)
|
||||||
|
@ -62,3 +62,19 @@ def index():
|
|||||||
def table_etud_in_accessible_depts():
|
def table_etud_in_accessible_depts():
|
||||||
"""recherche étudiants sur plusieurs départements"""
|
"""recherche étudiants sur plusieurs départements"""
|
||||||
return sco_find_etud.table_etud_in_accessible_depts(expnom=request.form["expnom"])
|
return sco_find_etud.table_etud_in_accessible_depts(expnom=request.form["expnom"])
|
||||||
|
|
||||||
|
|
||||||
|
# essais
|
||||||
|
@bp.route("/testlog")
|
||||||
|
def testlog():
|
||||||
|
import time
|
||||||
|
from flask import current_app
|
||||||
|
from app import log
|
||||||
|
|
||||||
|
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")
|
||||||
|
return "testlog completed at " + str(time.time())
|
||||||
|
@ -57,7 +57,7 @@ from app.views import scolar_bp as bp
|
|||||||
|
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
import app.scodoc.notesdb as ndb
|
import app.scodoc.notesdb as ndb
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
from app.scodoc.scolog import logdb
|
from app.scodoc.scolog import logdb
|
||||||
from app.scodoc.sco_permissions import Permission
|
from app.scodoc.sco_permissions import Permission
|
||||||
from app.scodoc.sco_exceptions import (
|
from app.scodoc.sco_exceptions import (
|
||||||
@ -119,9 +119,6 @@ def sco_publish(route, function, permission, methods=["GET"]):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
log.set_log_directory(Config.SCODOC_VAR_DIR + "/log")
|
|
||||||
log("ScoDoc restarting...")
|
|
||||||
|
|
||||||
# --------------------------------------------------------------------
|
# --------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# SCOLARITE (/ScoDoc/<dept>/Scolarite/...)
|
# SCOLARITE (/ScoDoc/<dept>/Scolarite/...)
|
||||||
|
@ -61,7 +61,7 @@ from app.scodoc import html_sco_header, sco_import_users, sco_excel
|
|||||||
from app.scodoc import sco_users
|
from app.scodoc import sco_users
|
||||||
from app.scodoc import sco_utils as scu
|
from app.scodoc import sco_utils as scu
|
||||||
from app.scodoc import sco_xml
|
from app.scodoc import sco_xml
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
from app.scodoc.sco_exceptions import AccessDenied, ScoValueError
|
from app.scodoc.sco_exceptions import AccessDenied, ScoValueError
|
||||||
from app.scodoc.sco_permissions_check import can_handle_passwd
|
from app.scodoc.sco_permissions_check import can_handle_passwd
|
||||||
from app.scodoc.TrivialFormulator import TrivialFormulator, tf_error_message
|
from app.scodoc.TrivialFormulator import TrivialFormulator, tf_error_message
|
||||||
|
@ -29,7 +29,7 @@ class Config:
|
|||||||
BOOTSTRAP_SERVE_LOCAL = os.environ.get("BOOTSTRAP_SERVE_LOCAL")
|
BOOTSTRAP_SERVE_LOCAL = os.environ.get("BOOTSTRAP_SERVE_LOCAL")
|
||||||
SCODOC_DIR = os.environ.get("SCODOC_DIR", "/opt/scodoc")
|
SCODOC_DIR = os.environ.get("SCODOC_DIR", "/opt/scodoc")
|
||||||
SCODOC_VAR_DIR = os.environ.get("SCODOC_VAR_DIR", "/opt/scodoc-data")
|
SCODOC_VAR_DIR = os.environ.get("SCODOC_VAR_DIR", "/opt/scodoc-data")
|
||||||
|
SCODOC_LOG_FILE = os.path.join(SCODOC_VAR_DIR, "log", "scodoc.log")
|
||||||
# For legacy ScoDoc7 installs: postgresql user
|
# For legacy ScoDoc7 installs: postgresql user
|
||||||
SCODOC7_SQL_USER = os.environ.get("SCODOC7_SQL_USER", "www-data")
|
SCODOC7_SQL_USER = os.environ.get("SCODOC7_SQL_USER", "www-data")
|
||||||
DEFAULT_SQL_PORT = os.environ.get("DEFAULT_SQL_PORT", "5432")
|
DEFAULT_SQL_PORT = os.environ.get("DEFAULT_SQL_PORT", "5432")
|
||||||
|
@ -34,7 +34,7 @@ from app.scodoc import sco_moduleimpl
|
|||||||
from app.scodoc import sco_saisie_notes
|
from app.scodoc import sco_saisie_notes
|
||||||
from app.scodoc import sco_synchro_etuds
|
from app.scodoc import sco_synchro_etuds
|
||||||
from app.scodoc import sco_utils as scu
|
from app.scodoc import sco_utils as scu
|
||||||
from app.scodoc.notes_log import log
|
from app import log
|
||||||
from app.scodoc.sco_exceptions import ScoValueError
|
from app.scodoc.sco_exceptions import ScoValueError
|
||||||
|
|
||||||
random.seed(12345) # tests reproductibles
|
random.seed(12345) # tests reproductibles
|
||||||
|
@ -103,6 +103,10 @@ then
|
|||||||
su -c "(cd $SCODOC_DIR && source venv/bin/activate && flask db upgrade)" "$SCODOC_USER"
|
su -c "(cd $SCODOC_DIR && source venv/bin/activate && flask db upgrade)" "$SCODOC_USER"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# ------------ LOGROTATE
|
||||||
|
cp "$SCODOC_DIR"/tools/etc/scodoc-logrotate /etc/logrotate.d/scodoc
|
||||||
|
chmod 644 /etc/logrotate.d/scodoc
|
||||||
|
|
||||||
# ------------ CONFIG SERVICE SCODOC
|
# ------------ CONFIG SERVICE SCODOC
|
||||||
echo
|
echo
|
||||||
echo "Installation du service systemd scodoc9..."
|
echo "Installation du service systemd scodoc9..."
|
||||||
|
9
tools/etc/scodoc-logrotate
Normal file
9
tools/etc/scodoc-logrotate
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
/opt/scodoc-datalog/scodoc.log {
|
||||||
|
weekly
|
||||||
|
missingok
|
||||||
|
rotate 64
|
||||||
|
compress
|
||||||
|
notifempty
|
||||||
|
dateext
|
||||||
|
create 0644 scodoc scodoc
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user