forked from ScoDoc/ScoDoc
petits bugs (abs) + exc messages
This commit is contained in:
parent
8f72e85e74
commit
c1b06b18b4
@ -90,6 +90,20 @@ class RequestFormatter(logging.Formatter):
|
|||||||
return super().format(record)
|
return super().format(record)
|
||||||
|
|
||||||
|
|
||||||
|
class ScoSMTPHandler(SMTPHandler):
|
||||||
|
def getSubject(self, record: logging.LogRecord) -> str:
|
||||||
|
stack_summary = traceback.extract_tb(record.exc_info[2])
|
||||||
|
frame_summary = stack_summary[-1]
|
||||||
|
subject = f"Sco Exc: {record.exc_info[0].__name__} in {frame_summary.name} {frame_summary.filename}"
|
||||||
|
# stack_summary.reverse()
|
||||||
|
# with open("/tmp/looooo", "wt") as f:
|
||||||
|
# for frame_summary in stack_summary:
|
||||||
|
# f.write(
|
||||||
|
# f"{record.exc_info[0].__name__} in {frame_summary.name} {frame_summary.filename}\n"
|
||||||
|
# )
|
||||||
|
return subject
|
||||||
|
|
||||||
|
|
||||||
def create_app(config_class=DevConfig):
|
def create_app(config_class=DevConfig):
|
||||||
app = Flask(__name__, static_url_path="/ScoDoc/static", static_folder="static")
|
app = Flask(__name__, static_url_path="/ScoDoc/static", static_folder="static")
|
||||||
app.logger.setLevel(logging.DEBUG)
|
app.logger.setLevel(logging.DEBUG)
|
||||||
@ -150,7 +164,7 @@ def create_app(config_class=DevConfig):
|
|||||||
if app.config["MAIL_USE_TLS"]:
|
if app.config["MAIL_USE_TLS"]:
|
||||||
secure = ()
|
secure = ()
|
||||||
host_name = socket.gethostname()
|
host_name = socket.gethostname()
|
||||||
mail_handler = SMTPHandler(
|
mail_handler = ScoSMTPHandler(
|
||||||
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=["exception@scodoc.org"],
|
toaddrs=["exception@scodoc.org"],
|
||||||
|
@ -639,7 +639,10 @@ def add_absence(
|
|||||||
cnx = ndb.GetDBConnexion()
|
cnx = ndb.GetDBConnexion()
|
||||||
cursor = cnx.cursor(cursor_factory=ndb.ScoDocCursor)
|
cursor = cnx.cursor(cursor_factory=ndb.ScoDocCursor)
|
||||||
cursor.execute(
|
cursor.execute(
|
||||||
"insert into absences (etudid,jour,estabs,estjust,matin,description, moduleimpl_id) values (%(etudid)s, %(jour)s, TRUE, %(estjust)s, %(matin)s, %(description)s, %(moduleimpl_id)s )",
|
"""
|
||||||
|
INSERT into absences (etudid,jour,estabs,estjust,matin,description, moduleimpl_id)
|
||||||
|
VALUES (%(etudid)s, %(jour)s, true, %(estjust)s, %(matin)s, %(description)s, %(moduleimpl_id)s )
|
||||||
|
""",
|
||||||
vars(),
|
vars(),
|
||||||
)
|
)
|
||||||
logdb(
|
logdb(
|
||||||
|
@ -277,6 +277,7 @@ def doSignaleAbsenceGrSemestre(
|
|||||||
Efface les absences aux dates indiquées par dates,
|
Efface les absences aux dates indiquées par dates,
|
||||||
ou bien ajoute celles de abslist.
|
ou bien ajoute celles de abslist.
|
||||||
"""
|
"""
|
||||||
|
moduleimpl_id = moduleimpl_id or None
|
||||||
if etudids:
|
if etudids:
|
||||||
etudids = etudids.split(",")
|
etudids = etudids.split(",")
|
||||||
else:
|
else:
|
||||||
@ -1486,13 +1487,13 @@ def XMLgetAbsEtud(beg_date="", end_date="", REQUEST=None):
|
|||||||
if not exp.match(end_date):
|
if not exp.match(end_date):
|
||||||
raise ScoValueError("invalid date: %s" % end_date)
|
raise ScoValueError("invalid date: %s" % end_date)
|
||||||
|
|
||||||
Abs = sco_abs.list_abs_date(etud["etudid"], beg_date, end_date)
|
abs_list = sco_abs.list_abs_date(etud["etudid"], beg_date, end_date)
|
||||||
|
|
||||||
REQUEST.RESPONSE.setHeader("content-type", scu.XML_MIMETYPE)
|
REQUEST.RESPONSE.setHeader("content-type", scu.XML_MIMETYPE)
|
||||||
doc = ElementTree.Element(
|
doc = ElementTree.Element(
|
||||||
"absences", etudid=str(etud["etudid"]), beg_date=beg_date, end_date=end_date
|
"absences", etudid=str(etud["etudid"]), beg_date=beg_date, end_date=end_date
|
||||||
)
|
)
|
||||||
for a in Abs:
|
for a in abs_list:
|
||||||
if a["estabs"]: # ne donne pas les justifications si pas d'absence
|
if a["estabs"]: # ne donne pas les justifications si pas d'absence
|
||||||
doc.append(
|
doc.append(
|
||||||
ElementTree.Element(
|
ElementTree.Element(
|
||||||
@ -1500,7 +1501,7 @@ def XMLgetAbsEtud(beg_date="", end_date="", REQUEST=None):
|
|||||||
begin=a["begin"],
|
begin=a["begin"],
|
||||||
end=a["end"],
|
end=a["end"],
|
||||||
description=a["description"],
|
description=a["description"],
|
||||||
justified=a["estjust"],
|
justified=int(a["estjust"]),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
log("XMLgetAbsEtud (%gs)" % (time.time() - t0))
|
log("XMLgetAbsEtud (%gs)" % (time.time() - t0))
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# -*- mode: python -*-
|
# -*- mode: python -*-
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
SCOVERSION = "9.0.16"
|
SCOVERSION = "9.0.18"
|
||||||
|
|
||||||
SCONAME = "ScoDoc"
|
SCONAME = "ScoDoc"
|
||||||
|
|
||||||
|
@ -15,9 +15,11 @@ source "$SCRIPT_DIR/utils.sh"
|
|||||||
SCODOC_RELEASE=$(grep SCOVERSION "$SCRIPT_DIR/../sco_version.py" | awk '{ print substr($3, 2, length($3)-2) }')
|
SCODOC_RELEASE=$(grep SCOVERSION "$SCRIPT_DIR/../sco_version.py" | awk '{ print substr($3, 2, length($3)-2) }')
|
||||||
|
|
||||||
# Dernière release
|
# Dernière release
|
||||||
GITEA_RELEASE_URL="https://scodoc.org/git/api/v1/repos/viennet/ScoDoc/releases?pre-release=true"
|
GITEA_RELEASE_URL="https://scodoc.org/git/api/v1/repos/viennet/ScoDoc/releases" # ?pre-release=true"
|
||||||
|
|
||||||
LAST_RELEASE_TAG=$(curl "$GITEA_RELEASE_URL" | jq ".[].tag_name" | sort | tail -1 | awk '{ print substr($1, 2, length($1)-2) }')
|
# suppose que les realse sont nommées 9.0.17, ne considère pas les caractères non numériques
|
||||||
|
LAST_RELEASE_TAG=$(curl "$GITEA_RELEASE_URL" | jq ".[].tag_name" | tr -d -c "0-9.\n" | sort --version-sort | tail -1)
|
||||||
|
# | awk '{ print substr($1, 2, length($1)-2) }')
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "Version détectée dans le source: $SCODOC_RELEASE"
|
echo "Version détectée dans le source: $SCODOC_RELEASE"
|
||||||
|
Loading…
Reference in New Issue
Block a user