From 2acd8aa41580aaccc4119a6f504bdfb5e986e0c2 Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Mon, 3 Oct 2016 08:29:30 +0000 Subject: Debug: sanitize some output --- wqflask/base/webqtlCaseData.py | 2 -- wqflask/runserver.py | 1 - wqflask/utility/tools.py | 9 ++++----- wqflask/wqflask/__init__.py | 8 ++------ 4 files changed, 6 insertions(+), 14 deletions(-) (limited to 'wqflask') diff --git a/wqflask/base/webqtlCaseData.py b/wqflask/base/webqtlCaseData.py index 8df9939e..2f88f778 100644 --- a/wqflask/base/webqtlCaseData.py +++ b/wqflask/base/webqtlCaseData.py @@ -16,8 +16,6 @@ # Contact Drs. Robert W. Williams and Xiaodong Zhou (2010) # at rwilliams@uthsc.edu and xzhou15@uthsc.edu # -# -# # This module is used by GeneNetwork project (www.genenetwork.org) # # Created by GeneNetwork Core Team 2010/08/10 diff --git a/wqflask/runserver.py b/wqflask/runserver.py index 5a8766b0..0342b7ad 100644 --- a/wqflask/runserver.py +++ b/wqflask/runserver.py @@ -16,7 +16,6 @@ GREEN = '\033[92m' BOLD = '\033[1m' ENDC = '\033[0m' - import os app.config['SECRET_KEY'] = os.urandom(24) diff --git a/wqflask/utility/tools.py b/wqflask/utility/tools.py index 22779739..545c0427 100644 --- a/wqflask/utility/tools.py +++ b/wqflask/utility/tools.py @@ -50,7 +50,7 @@ def get_setting(command_id,guess=None): if command is None: command = value(guess) if command is None or command == "": - print command + # print command raise Exception(command_id+' setting unknown or faulty (update default_settings.py?).') logger.debug("Set "+command_id+"="+str(command)) return command @@ -170,15 +170,14 @@ def show_settings(): logging.basicConfig(level=log_level) logger.info(BLUE+"Mr. Mojo Risin 2"+ENDC) - print "runserver.py: ****** The webserver has the following configuration ******" + print "runserver.py: ****** Webserver configuration ******" keylist = app.config.keys() keylist.sort() for k in keylist: try: - print("%s %s%s%s%s" % (k,BLUE,BOLD,get_setting(k),ENDC)) + print("%s: %s%s%s%s" % (k,BLUE,BOLD,get_setting(k),ENDC)) except: - print("%s %s%s%s%s" % (k,GREEN,BOLD,app.config[k],ENDC)) - + print("%s: %s%s%s%s" % (k,GREEN,BOLD,app.config[k],ENDC)) # Cached values WEBSERVER_MODE = get_setting('WEBSERVER_MODE') diff --git a/wqflask/wqflask/__init__.py b/wqflask/wqflask/__init__.py index af271d02..602246d9 100644 --- a/wqflask/wqflask/__init__.py +++ b/wqflask/wqflask/__init__.py @@ -8,17 +8,13 @@ from utility import formatting import logging logger = logging.getLogger(__name__ ) -logging.basicConfig(level=logging.INFO) +logging.basicConfig(level=logging.WARN) app = Flask(__name__) app.config.from_object('cfg.default_settings') # Get the defaults from cfg.default_settings app.config.from_envvar('WQFLASK_SETTINGS') # See http://flask.pocoo.org/docs/config/#configuring-from-files - -logger.debug("System path is") -logger.debug(sys.path) -logger.debug("App.config is") -logger.debug(app.config) +# Note we also use WQFLASK_OVERRIDES app.jinja_env.globals.update( undefined = jinja2.StrictUndefined, -- cgit v1.2.3