aboutsummaryrefslogtreecommitdiff
path: root/wqflask/utility
diff options
context:
space:
mode:
authorPjotr Prins2016-02-24 11:01:29 +0000
committerPjotr Prins2016-04-20 09:13:26 +0000
commit5fffa1aa4260af6663c1f9b4cf7494d3ebc6995d (patch)
treea68c6d32ab7db60db2350c5a0ba8c0d4abc7eaf2 /wqflask/utility
parent92fda7557645199276bf4f8a65c40252c4d83c21 (diff)
downloadgenenetwork2-5fffa1aa4260af6663c1f9b4cf7494d3ebc6995d.tar.gz
[PATCH 037/100] WebQtlConfig: sanitizing naming and used vars
Diffstat (limited to 'wqflask/utility')
-rw-r--r--wqflask/utility/tools.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/wqflask/utility/tools.py b/wqflask/utility/tools.py
index 0f2e4d88..c0f6a49a 100644
--- a/wqflask/utility/tools.py
+++ b/wqflask/utility/tools.py
@@ -79,6 +79,15 @@ def flat_files(subdir=None):
return valid_path(base+"/"+subdir)
return valid_path(base)
+def assert_dir(dir):
+ if not valid_path(dir):
+ raise Exception("ERROR: can not find directory "+dir)
+ return dir
+
+def mk_dir(dir):
+ os.makedirs(dir)
+ return assert_dir(dir)
+
def locate(name, subdir=None):
"""
Locate a static flat file in the GENENETWORK_FILES environment.
@@ -98,7 +107,7 @@ def locate(name, subdir=None):
if subdir: sys.stderr.write(subdir)
raise IOError("Can not locate "+name+" in "+base)
-def locate_without_error(name, subdir=None):
+def locate_ignore_error(name, subdir=None):
"""
Locate a static flat file in the GENENETWORK_FILES environment.