From b0688c8232a26fc11387d1d8aa06ae33f0648cef Mon Sep 17 00:00:00 2001 From: c8y3 <25362953+c8y3@users.noreply.github.com> Date: Tue, 8 Oct 2024 17:13:59 +0200 Subject: [PATCH] [IMP] Moved log_exception_and_error out of util.py into blueprints namespace --- source/app/blueprints/access_controls.py | 9 +++++++-- source/app/util.py | 6 ------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/source/app/blueprints/access_controls.py b/source/app/blueprints/access_controls.py index 8b0cde2df..d88fce502 100644 --- a/source/app/blueprints/access_controls.py +++ b/source/app/blueprints/access_controls.py @@ -18,6 +18,7 @@ import json import logging as log +import traceback import uuid from functools import wraps @@ -49,7 +50,6 @@ from app.models.authorization import Permissions from app.models.authorization import CaseAccessLevel -from app.util import log_exception_and_error from app.util import response_error from app.util import not_authenticated_redirection_url @@ -78,6 +78,11 @@ def _set_caseid_from_current_user(): return redir, caseid +def _log_exception_and_error(e): + log.exception(e) + log.error(traceback.print_exc()) + + def _get_caseid_from_request_data(request_data, no_cid_required): caseid = request_data.args.get('cid', default=None, type=int) if caseid: @@ -112,7 +117,7 @@ def _get_caseid_from_request_data(request_data, no_cid_required): redir, caseid = _set_caseid_from_current_user() return redir, caseid, True - log_exception_and_error(e) + _log_exception_and_error(e) return True, 0, False diff --git a/source/app/util.py b/source/app/util.py index aa3285cfa..313a02965 100644 --- a/source/app/util.py +++ b/source/app/util.py @@ -28,7 +28,6 @@ import random import shutil import string -import traceback import uuid import weakref from cryptography.exceptions import InvalidSignature @@ -187,11 +186,6 @@ def _do_cleanup(self, wr): shutil.rmtree(filepath, ignore_errors=True) -def log_exception_and_error(e): - log.exception(e) - log.error(traceback.print_exc()) - - def get_urlcasename(): caseid = request.args.get('cid', default=None, type=int) if not caseid: