From 8cbc3ea97350b34beaeb5deb0eae9f74af8b4d27 Mon Sep 17 00:00:00 2001 From: teddy Date: Tue, 29 Oct 2024 17:18:39 +0000 Subject: [PATCH] Fix: User login and server console logging functionality. --- app.py | 1 + config.py | 4 ++++ .../__pycache__/helper_app.cpython-312.pyc | Bin 1564 -> 1772 bytes helpers/helper_app.py | 6 ++++-- static/MySQL/7313_p_get_many_user.sql | 11 +++++------ 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/app.py b/app.py index e6dad41f..7ab66779 100644 --- a/app.py +++ b/app.py @@ -71,6 +71,7 @@ app = Flask(__name__) # AppConfig(app) app.config.from_object(app_config) # for db init with required keys +app.app_config = app_config # app.config["config"] = app_config() # logging diff --git a/config.py b/config.py index ba6b917f..dbb9213d 100644 --- a/config.py +++ b/config.py @@ -20,6 +20,8 @@ load_dotenv(find_dotenv()) # CLASSES class Config: + is_development = False + is_production = False # Miscellaneous DEBUG = False # av.input_bool(os.getenv('DEBUG'), 'DEBUG', 'Config') TESTING = False @@ -68,11 +70,13 @@ class Config: RECAPTCHA_PRIVATE_KEY = os.getenv('RECAPTCHA_PRIVATE_KEY') class DevelopmentConfig(Config): + is_development = True DEBUG = True MAIL_DEBUG = True # Add development-specific configuration variables class ProductionConfig(Config): + is_production = True # Add production-specific configuration variables pass diff --git a/helpers/__pycache__/helper_app.cpython-312.pyc b/helpers/__pycache__/helper_app.cpython-312.pyc index 9213c9d45cdc1780f4ba060362f70c51b84ce314..1900ccb8f63271a86183e1c08685e5e89377e307 100644 GIT binary patch delta 399 zcmbQk^M;r2G%qg~0}w2bP)rwR*~sU>!gyq|KZ|mG77Iui6%_H5u){=Z7*;bv*o+L7 z3?(pOhAbvH6VAxufHUEYA_XKpU?;$(Knz}nEMA1bSw#|) tXR=yJ$pWn?k^m8WK;jpNO)k(qIjMFQ0dS$^fLmiU1C3Q;q-t delta 190 zcmaFEJBNqwG%qg~0}vRmR!CpXyphj=h0$rUKZ`O~3Zo=YxQM5Ob@D$JNqHu}TdXdw zPND9a%tfp~iCb*R`FUxX>9<%5iZb&`CMU33D98ZC8yKE&i(TiIy~r&)BmEM$+8rLj z3F^ImAD9_<)F3S^%sh~NVfzc_4i d^HWN5QtgW5Chuia;1^?*o*?;^0Z4%r0RSPgFFF7K diff --git a/helpers/helper_app.py b/helpers/helper_app.py index ad0fd36e..ca78e365 100644 --- a/helpers/helper_app.py +++ b/helpers/helper_app.py @@ -36,5 +36,7 @@ class Helper_App(BaseModel): @staticmethod def console_log(message): - if current_app.config["DEBUG"]: - print(message) \ No newline at end of file + if current_app.app_config.is_development: + print(message) + elif current_app.app_config.is_production: + current_app.logger.info(message) \ No newline at end of file diff --git a/static/MySQL/7313_p_get_many_user.sql b/static/MySQL/7313_p_get_many_user.sql index 4bac0863..165f31d3 100644 --- a/static/MySQL/7313_p_get_many_user.sql +++ b/static/MySQL/7313_p_get_many_user.sql @@ -92,13 +92,11 @@ BEGIN IF ISNULL(a_id_user) THEN INSERT INTO tmp_Msg_Error ( - guid, id_type, code, msg ) VALUES ( - v_guid, v_id_type_error_bad_data, v_code_error_bad_data, CONCAT('User ID required for authorisation.') @@ -479,9 +477,9 @@ END // DELIMITER ;; -/* -CALL p_get_many_user ( +CALL p_get_many_user (NULL, 'google-oauth2|109567376920138999933', False, False, False, NULL, 'google-oauth2|109567376920138999933', 0); +/* NULL # a_id_user , 'auth0|6582b95c895d09a70ba10fef' # a_id_user_auth0 , 0 # a_get_all_user @@ -489,9 +487,10 @@ CALL p_get_many_user ( , 0 # a_get_first_user_only , NULL # a_ids_user , 'auth0|6582b95c895d09a70ba10fef' # a_ids_user_auth0 - , 1 -- a_debug -); + , 0 -- a_debug +);*/ +/* select * FROM partsltd_prod.Shop_Calc_User_Temp; delete FROM partsltd_prod.Shop_Calc_User_Temp;