forked from ScoDoc/ScoDoc
evite erreur dans log au lancement hors context requete
This commit is contained in:
parent
085ef05e01
commit
3e45762382
@ -101,7 +101,10 @@ class LogRequestFormatter(logging.Formatter):
|
|||||||
record.url = None
|
record.url = None
|
||||||
record.remote_addr = None
|
record.remote_addr = None
|
||||||
record.sco_user = current_user
|
record.sco_user = current_user
|
||||||
|
if has_request_context():
|
||||||
record.sco_admin_mail = current_app.config["SCODOC_ADMIN_MAIL"]
|
record.sco_admin_mail = current_app.config["SCODOC_ADMIN_MAIL"]
|
||||||
|
else:
|
||||||
|
record.sco_admin_mail = "(pas de requête)"
|
||||||
|
|
||||||
return super().format(record)
|
return super().format(record)
|
||||||
|
|
||||||
@ -129,7 +132,11 @@ class LogExceptionFormatter(logging.Formatter):
|
|||||||
record.http_method = None
|
record.http_method = None
|
||||||
record.http_params = None
|
record.http_params = None
|
||||||
record.sco_user = current_user
|
record.sco_user = current_user
|
||||||
|
|
||||||
|
if has_request_context():
|
||||||
record.sco_admin_mail = current_app.config["SCODOC_ADMIN_MAIL"]
|
record.sco_admin_mail = current_app.config["SCODOC_ADMIN_MAIL"]
|
||||||
|
else:
|
||||||
|
record.sco_admin_mail = "(pas de requête)"
|
||||||
return super().format(record)
|
return super().format(record)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# -*- mode: python -*-
|
# -*- mode: python -*-
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
SCOVERSION = "9.0.48"
|
SCOVERSION = "9.0.49"
|
||||||
|
|
||||||
SCONAME = "ScoDoc"
|
SCONAME = "ScoDoc"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user