aboutsummaryrefslogtreecommitdiff
path: root/wqflask/utility/tools.py
diff options
context:
space:
mode:
authorPjotr Prins2016-06-18 09:06:00 +0000
committerPjotr Prins2016-06-18 09:06:00 +0000
commitaa5ca3053c9c866436c4d33b9165703f0f631083 (patch)
tree117fd79bab971df983ef4e26573aeb0b36290ee6 /wqflask/utility/tools.py
parent0a11c10237d899cfdddfcfcf4d17140da9421f7d (diff)
downloadgenenetwork2-aa5ca3053c9c866436c4d33b9165703f0f631083.tar.gz
Logger: more info
Diffstat (limited to 'wqflask/utility/tools.py')
-rw-r--r--wqflask/utility/tools.py24
1 files changed, 17 insertions, 7 deletions
diff --git a/wqflask/utility/tools.py b/wqflask/utility/tools.py
index 824ce330..1b31857e 100644
--- a/wqflask/utility/tools.py
+++ b/wqflask/utility/tools.py
@@ -43,16 +43,26 @@ def get_setting(command_id,guess=None):
# ---- Check whether environment exists
logger.debug("Looking for "+command_id+"\n")
command = value(os.environ.get(command_id))
- if not command:
+ if command == None or command == "":
# ---- Check whether setting exists in app
command = value(app.config.get(command_id))
- if not command:
+ if command == None:
command = value(guess)
- if not command:
- raise Exception(command_id+' setting unknown or faulty (update settings.py?).')
+ if command == None or command == "":
+ raise Exception(command_id+' setting unknown or faulty (update default_settings.py?).')
logger.info("Set "+command_id+"="+str(command))
return command
+def get_setting_bool(id):
+ v = get_setting(id)
+ if v not in [0,False,'False','FALSE',None]:
+ return True
+ return False
+
+def get_setting_int(id):
+ v = get_setting(id)
+ return int(v)
+
def valid_bin(bin):
if os.path.islink(bin) or valid_file(bin):
return bin
@@ -136,9 +146,9 @@ def tempdir():
# Cached values
WEBSERVER_MODE = get_setting('WEBSERVER_MODE')
LOG_LEVEL = get_setting('LOG_LEVEL')
-DEBUG_LOG_LEVEL = get_setting('DEBUG_LOG_LEVEL')
-LOG_SQL = get_setting('LOG_SQL') in [True,'TRUE','True','true']
-USE_REDIS = get_setting('USE_REDIS') in [True,'TRUE','True','true']
+DEBUG_LOG_LEVEL = get_setting_int('DEBUG_LOG_LEVEL')
+LOG_SQL = get_setting_bool('LOG_SQL')
+USE_REDIS = get_setting_bool('USE_REDIS')
PYLMM_COMMAND = pylmm_command()
GEMMA_COMMAND = gemma_command()