Bug fix for f-strings containing unintended closing quotes
This commit is contained in:
Binary file not shown.
48
app.py
48
app.py
@@ -69,6 +69,26 @@ app = Flask(__name__)
|
|||||||
app.config.from_object(app_config) # for db init with required keys
|
app.config.from_object(app_config) # for db init with required keys
|
||||||
# app.config["config"] = app_config()
|
# 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()
|
csrf = CSRFProtect()
|
||||||
cors = CORS()
|
cors = CORS()
|
||||||
@@ -95,33 +115,13 @@ with app.app_context():
|
|||||||
client_kwargs={
|
client_kwargs={
|
||||||
"scope": "openid profile email",
|
"scope": "openid profile email",
|
||||||
},
|
},
|
||||||
server_metadata_url=f'https://{app.config['DOMAIN_AUTH0']}/.well-known/openid-configuration',
|
server_metadata_url=f'https://{app.config["DOMAIN_AUTH0"]}/.well-known/openid-configuration',
|
||||||
api_base_url = f'https://{app.config['DOMAIN_AUTH0']}',
|
api_base_url = f'https://{app.config["DOMAIN_AUTH0"]}',
|
||||||
authorize_url = f'https://{app.config['DOMAIN_AUTH0']}/authorize',
|
authorize_url = f'https://{app.config["DOMAIN_AUTH0"]}/authorize',
|
||||||
access_token_url = f'https://{app.config['DOMAIN_AUTH0']}/oauth/token',
|
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_core)
|
||||||
app.register_blueprint(routes_legal)
|
app.register_blueprint(routes_legal)
|
||||||
app.register_blueprint(routes_store)
|
app.register_blueprint(routes_store)
|
||||||
|
|||||||
@@ -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
|
# 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]}')
|
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:
|
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}'})
|
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")
|
@routes_user.route("/logout")
|
||||||
def logout():
|
def logout():
|
||||||
session.clear()
|
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),
|
"returnTo": url_for("routes_user.logout_callback", _external=True),
|
||||||
"client_id": current_app.config['ID_AUTH0_CLIENT'],
|
"client_id": current_app.config['ID_AUTH0_CLIENT'],
|
||||||
|
|||||||
Reference in New Issue
Block a user