From 9e4c8f01e1a0aa49d218f7909ed5b7979ffc6fb9 Mon Sep 17 00:00:00 2001
From: Pjotr Prins
Date: Fri, 7 Oct 2016 07:05:22 +0000
Subject: Saner handling of TMPDIR and TEMPDIR Throw error when TMPDIRs are not
writable
---
wqflask/utility/tools.py | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
(limited to 'wqflask/utility/tools.py')
diff --git a/wqflask/utility/tools.py b/wqflask/utility/tools.py
index 23d6fb62..5105ba42 100644
--- a/wqflask/utility/tools.py
+++ b/wqflask/utility/tools.py
@@ -113,6 +113,16 @@ def assert_dir(dir):
raise Exception("ERROR: can not find directory "+dir)
return dir
+def assert_writable_dir(dir):
+ try:
+ fn = dir + "/test.txt"
+ fh = open( fn, 'w' )
+ fh.write("I am writing this text to the file\n")
+ fh.close()
+ os.remove(fn)
+ except IOError:
+ raise Exception('Unable to write to directory ' + dir )
+ return dir
def mk_dir(dir):
if not valid_path(dir):
@@ -205,7 +215,7 @@ GENENETWORK_FILES = get_setting('GENENETWORK_FILES')
PYLMM_COMMAND = pylmm_command()
GEMMA_COMMAND = gemma_command()
PLINK_COMMAND = plink_command()
-TEMPDIR = tempdir()
+TEMPDIR = tempdir() # defaults to UNIX TMPDIR
from six import string_types
--
cgit v1.2.3
From d3d2354abc5597cff291b587312b1316bb42d4c0 Mon Sep 17 00:00:00 2001
From: Pjotr Prins
Date: Fri, 7 Oct 2016 09:03:56 +0000
Subject: Changed error output
---
wqflask/utility/tools.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'wqflask/utility/tools.py')
diff --git a/wqflask/utility/tools.py b/wqflask/utility/tools.py
index 5105ba42..c6d8f7d2 100644
--- a/wqflask/utility/tools.py
+++ b/wqflask/utility/tools.py
@@ -121,7 +121,7 @@ def assert_writable_dir(dir):
fh.close()
os.remove(fn)
except IOError:
- raise Exception('Unable to write to directory ' + dir )
+ raise Exception('Unable to write test.txt to directory ' + dir )
return dir
def mk_dir(dir):
--
cgit v1.2.3
From 03ba5bf1edcf4f7adec15b51d0d8e22274fd4a07 Mon Sep 17 00:00:00 2001
From: Pjotr Prins
Date: Sun, 9 Oct 2016 10:42:33 +0000
Subject: Add version information
---
bin/genenetwork2 | 4 ++++
etc/default_settings.py | 1 +
wqflask/utility/tools.py | 1 +
wqflask/wqflask/templates/base.html | 26 +++++++++++++-------------
wqflask/wqflask/views.py | 6 +++---
5 files changed, 22 insertions(+), 16 deletions(-)
(limited to 'wqflask/utility/tools.py')
diff --git a/bin/genenetwork2 b/bin/genenetwork2
index b2de4c95..52d3155c 100755
--- a/bin/genenetwork2
+++ b/bin/genenetwork2
@@ -26,6 +26,10 @@ GN2_BASE_DIR=$(dirname $(dirname "$SCRIPT"))
echo GN2_BASE_DIR=$GN2_BASE_DIR
+GIT_HASH=$(git rev-parse HEAD)
+GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
+export GN_VERSION=$(cat $GN2_BASE_DIR/VERSION)-$GIT_BRANCH-${GIT_HASH:0:9}
+echo GN_VERSION=$GN_VERSION
# Handle settings parameter (can be .py or .json)
settings=$1
diff --git a/etc/default_settings.py b/etc/default_settings.py
index d8e57f38..db645f8b 100644
--- a/etc/default_settings.py
+++ b/etc/default_settings.py
@@ -18,6 +18,7 @@
import os
import sys
+GN_VERSION = open("../VERSION","r").read()
SQL_URI = "mysql://gn2:mysql_password@localhost/db_webqtl_s"
SQLALCHEMY_DATABASE_URI = 'mysql://gn2:mysql_password@localhost/db_webqtl_s'
SQLALCHEMY_POOL_RECYCLE = 3600
diff --git a/wqflask/utility/tools.py b/wqflask/utility/tools.py
index c6d8f7d2..90144962 100644
--- a/wqflask/utility/tools.py
+++ b/wqflask/utility/tools.py
@@ -197,6 +197,7 @@ def show_settings():
# Cached values
+GN_VERSION = get_setting('GN_VERSION')
HOME = get_setting('HOME')
WEBSERVER_MODE = get_setting('WEBSERVER_MODE')
GN_SERVER_URL = get_setting('GN_SERVER_URL')
diff --git a/wqflask/wqflask/templates/base.html b/wqflask/wqflask/templates/base.html
index 946e6add..cf40fe3c 100644
--- a/wqflask/wqflask/templates/base.html
+++ b/wqflask/wqflask/templates/base.html
@@ -95,29 +95,27 @@
- {% block content %}{% endblock %}
+ {% block content %}
+ {% endblock %}
-
diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py
index 33fab84d..5528d375 100644
--- a/wqflask/wqflask/views.py
+++ b/wqflask/wqflask/views.py
@@ -51,7 +51,7 @@ from wqflask.wgcna import wgcna_analysis
from wqflask.ctl import ctl_analysis
from utility import temp_data
-from utility.tools import SQL_URI,TEMPDIR,USE_REDIS,USE_GN_SERVER,GN_SERVER_URL
+from utility.tools import SQL_URI,TEMPDIR,USE_REDIS,USE_GN_SERVER,GN_SERVER_URL,GN_VERSION
from base import webqtlFormData
from base.webqtlConfig import GENERATED_IMAGE_DIR
@@ -124,10 +124,10 @@ def index_page():
g.cookie_session.import_traits_to_user()
if USE_GN_SERVER:
# The menu is generated using GN_SERVER
- return render_template("index_page.html", gn_server_url = GN_SERVER_URL)
+ return render_template("index_page.html", gn_server_url = GN_SERVER_URL, version=GN_VERSION)
else:
# Old style static menu (OBSOLETE)
- return render_template("index_page_orig.html")
+ return render_template("index_page_orig.html", version=GN_VERSION)
@app.route("/tmp/")
--
cgit v1.2.3