From de869eb21629547d36977f760c43015ea1e63c94 Mon Sep 17 00:00:00 2001 From: teddy Date: Tue, 10 Sep 2024 16:20:10 +0100 Subject: [PATCH] Bug fix for f-strings containing unintended closing quotes --- __pycache__/app.cpython-312.pyc | Bin 5250 -> 5250 bytes app.py | 48 ++++++++++++++++---------------- routing/user.py | 4 +-- 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/__pycache__/app.cpython-312.pyc b/__pycache__/app.cpython-312.pyc index 8097bb1e5c1938c49d63ca6812719099728d48b9..0f411028263d669b6441c36b46232154a1329256 100644 GIT binary patch delta 19 ZcmZqDY|`X9&CAQh00b{gHgZ*n001wF1hW7D delta 19 YcmZqDY|`X9&CAQh00gWC8@Vb(04gK{%m4rY diff --git a/app.py b/app.py index 3b25b115..7794704e 100644 --- a/app.py +++ b/app.py @@ -69,6 +69,26 @@ app = Flask(__name__) app.config.from_object(app_config) # for db init with required keys # app.config["config"] = app_config() + +# logging +handler = RotatingFileHandler('app.log', maxBytes=10000, backupCount=3) +handler.setLevel(logging.ERROR) +app.logger.addHandler(handler) + +@app.errorhandler(500) +def internal_server_error(error): + app.logger.error('Server Error: %s', (error)) + app.logger.error('Request: %s %s %s %s %s', + request.remote_addr, + request.method, + request.scheme, + request.full_path, + request.headers) + app.logger.error('Request data: %s', request.get_data()) + app.logger.error('Traceback: %s', traceback.format_exc()) + return "500 Internal Server Error", 500 + + """ csrf = CSRFProtect() cors = CORS() @@ -95,33 +115,13 @@ with app.app_context(): client_kwargs={ "scope": "openid profile email", }, - server_metadata_url=f'https://{app.config['DOMAIN_AUTH0']}/.well-known/openid-configuration', - api_base_url = f'https://{app.config['DOMAIN_AUTH0']}', - authorize_url = f'https://{app.config['DOMAIN_AUTH0']}/authorize', - access_token_url = f'https://{app.config['DOMAIN_AUTH0']}/oauth/token', + server_metadata_url=f'https://{app.config["DOMAIN_AUTH0"]}/.well-known/openid-configuration', + api_base_url = f'https://{app.config["DOMAIN_AUTH0"]}', + authorize_url = f'https://{app.config["DOMAIN_AUTH0"]}/authorize', + access_token_url = f'https://{app.config["DOMAIN_AUTH0"]}/oauth/token', ) -# logging -handler = RotatingFileHandler('app.log', maxBytes=10000, backupCount=3) -handler.setLevel(logging.ERROR) -app.logger.addHandler(handler) - -@app.errorhandler(500) -def internal_server_error(error): - app.logger.error('Server Error: %s', (error)) - app.logger.error('Request: %s %s %s %s %s', - request.remote_addr, - request.method, - request.scheme, - request.full_path, - request.headers) - app.logger.error('Request data: %s', request.get_data()) - app.logger.error('Traceback: %s', traceback.format_exc()) - return "500 Internal Server Error", 500 - - - app.register_blueprint(routes_core) app.register_blueprint(routes_legal) app.register_blueprint(routes_store) diff --git a/routing/user.py b/routing/user.py index 72a24b60..4a9f6584 100644 --- a/routing/user.py +++ b/routing/user.py @@ -115,14 +115,14 @@ def login_callback(): # DataStore_Store().add_new_user(id_user) # this is part of get basket - should occur on page load print(f'user session: {session[Model_View_Base.KEY_USER]}') - return redirect(f'{current_app.config['URL_HOST']}{hash_callback}') + return redirect(f"{current_app.config['URL_HOST']}{hash_callback}") except Exception as e: return jsonify({Model_View_Base.FLAG_STATUS: Model_View_Base.STATUS_FAILURE, Model_View_Base.FLAG_MESSAGE: f'Controller error.\n{e}'}) @routes_user.route("/logout") def logout(): session.clear() - url_logout = "https://" + current_app.config['DOMAIN_AUTH0'] + "/v2/logout?" + urlencode( + url_logout = f"https://{current_app.config['DOMAIN_AUTH0']}/v2/logout?" + urlencode( { "returnTo": url_for("routes_user.logout_callback", _external=True), "client_id": current_app.config['ID_AUTH0_CLIENT'],