Skip to content

Commit

Permalink
[IMP] Moved log_exception_and_error out of util.py into blueprints na…
Browse files Browse the repository at this point in the history
…mespace
  • Loading branch information
c8y3 committed Oct 8, 2024
1 parent 1ca0d36 commit b0688c8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
9 changes: 7 additions & 2 deletions source/app/blueprints/access_controls.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import json
import logging as log
import traceback
import uuid
from functools import wraps

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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


Expand Down
6 changes: 0 additions & 6 deletions source/app/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import random
import shutil
import string
import traceback
import uuid
import weakref
from cryptography.exceptions import InvalidSignature
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit b0688c8

Please sign in to comment.