From 4a941a654bfc796240cd23b8e907eccc60cf45f9 Mon Sep 17 00:00:00 2001 From: Martijn Vermaat <martijn@vermaat.name> Date: Fri, 19 Aug 2011 11:02:32 +0000 Subject: [PATCH] Add website debugging flag to config file. git-svn-id: https://humgenprojects.lumc.nl/svn/mutalyzer/branches/refactor-mutalyzer-branch@335 eb6bd6ab-9ccd-42b9-aceb-e2899b4a52f1 --- INSTALL | 4 ++++ README | 8 ++++---- extras/config.example | 3 +++ mutalyzer/config.py | 3 ++- mutalyzer/website.py | 7 ++++--- 5 files changed, 17 insertions(+), 8 deletions(-) diff --git a/INSTALL b/INSTALL index 72856076..3b799b4a 100644 --- a/INSTALL +++ b/INSTALL @@ -132,6 +132,10 @@ Now run the tests: MUTALYZER_ENV=test nosetests +Note: Currently it is not advised to run the tests on a production server +since they need write access to the main Mutalyzer cache and log. A separate +cache and log for local users and tests is planned functionality. + Upgrade Mutalyzer ----------------- diff --git a/README b/README index 0774f980..dc7d6ad1 100644 --- a/README +++ b/README @@ -32,6 +32,10 @@ Or, if you are in a hurry, skip the long-running tests with: MUTALYZER_ENV=test MUTALYZER_QUICK_TEST=1 nosetests -v +Note: Currently it is not advised to run the tests on a production server +since they need write access to the main Mutalyzer cache and log. A separate +cache and log for local users and tests is planned functionality. + Development notes ----------------- @@ -45,8 +49,6 @@ Todo list: - Test all uses of mkstemp(). - Use naming conventions for modules Crossmap, Db, File, GenRecord, Mapper, Retriever, Scheduler. -- Integrate fuzzy offsets from this branch: - https://www.mutalyzer.nl/projects/mutalyzer2/changeset?old_path=%2Ftrunk&old=228&new_path=%2Fbranches%2Fexon-deletions-branch&new=228#file5 - Use standard logging module, with rotating functionality. Race conditions on the log file are probably a problem in the current setup. Instead of that rotating, we could also use logrotate: @@ -71,8 +73,6 @@ Todo list: - In deployment, remove old versions of Mutalyzer package? - Use https protocol. - Check for os.path.join vulnerabilities. -- Use web.config.debug=False on production server and perhaps put this in - the configuration file. - Solution for database schema migration on version updates. Code style guide: diff --git a/extras/config.example b/extras/config.example index dfc8a135..05e01241 100644 --- a/extras/config.example +++ b/extras/config.example @@ -78,6 +78,9 @@ loglevel = 3 # Level of output messages. outputlevel = 1 +# Show debug info in the web interface. +debug = yes + # # These settings are used by the Mutator module. diff --git a/mutalyzer/config.py b/mutalyzer/config.py index 2d8837af..4f222c97 100644 --- a/mutalyzer/config.py +++ b/mutalyzer/config.py @@ -61,6 +61,7 @@ class Config(): overwrite the base configuration. For example, a normal user could use a different cache directory (writable by the user) than the system wide Mutalyzer config. + We could use the 'merge' method from configobj. """ if filename is None: base = os.environ.get('XDG_CONFIG_HOME', None) @@ -105,6 +106,7 @@ class Config(): self.Output.datestring = config["datestring"] self.Output.loglevel = int(config["loglevel"]) self.Output.outputlevel = int(config["outputlevel"]) + self.Output.debug = config.as_bool('debug') # Set the variables needed by the Mutator module. self.Mutator.flanksize = int(config["flanksize"]) @@ -133,7 +135,6 @@ class Config(): self.GenRecord.spliceAlarm = int(config["spliceAlarm"]) self.GenRecord.spliceWarn = int(config["spliceWarn"]) - # If we are in a testing environment, use a temporary file for # logging and a temporary directory for the cache. # We don't remove these after the tests, since they might be diff --git a/mutalyzer/website.py b/mutalyzer/website.py index be9c833b..faa35853 100644 --- a/mutalyzer/website.py +++ b/mutalyzer/website.py @@ -42,13 +42,14 @@ from mutalyzer import Retriever from mutalyzer import File -web.config.debug = True - - # Load configuration from configuration file config = Config() +# Show web.py debugging information. +web.config.debug = config.Output.debug + + # URL dispatch table urls = ( '', 'RedirectHome', -- GitLab