access config from current_app object

This commit is contained in:
Simon Pirkelmann 2022-01-27 23:57:06 +01:00
parent b3c585bd27
commit b64b0c7bb6

View File

@ -258,13 +258,13 @@ def list_tokens():
def token_log(): def token_log():
log = [] log = []
try: try:
with open(config.nfc_log) as f: with open(current_app.config['NFC_LOG']) as f:
log += f.readlines() log += f.readlines()
log.reverse() log.reverse()
log = [l.split(' - ') for l in log] log = [l.split(' - ') for l in log]
return render_template('token_log.html', log=log) return render_template('token_log.html', log=log)
except Exception as e: except Exception as e:
flash(f"NFC logfile {Path(config.nfc_log).absolute()} konnte nicht gelesen werden. Exception: {e}") flash(f"NFC logfile {Path(current_app.config['NFC_LOG']).absolute()} konnte nicht gelesen werden. Exception: {e}")
return redirect('/') return redirect('/')
# routes for registering, editing and deleting tokens # routes for registering, editing and deleting tokens