aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/gsearch.py18
-rw-r--r--wqflask/wqflask/templates/gsearch_gene.html5
-rw-r--r--wqflask/wqflask/templates/gsearch_pheno.html5
-rw-r--r--wqflask/wqflask/templates/search_result_page.html10
4 files changed, 28 insertions, 10 deletions
diff --git a/wqflask/wqflask/gsearch.py b/wqflask/wqflask/gsearch.py
index 7cd8e543..62398154 100644
--- a/wqflask/wqflask/gsearch.py
+++ b/wqflask/wqflask/gsearch.py
@@ -1,5 +1,7 @@
from __future__ import absolute_import, print_function, division
+import json
+
from flask import Flask, g
from base.data_set import create_dataset
from base.trait import GeneralTrait
@@ -59,7 +61,7 @@ class GSearch(object):
with Bench("Running query"):
logger.sql(sql)
re = g.db.execute(sql).fetchall()
- self.trait_list = []
+ trait_list = []
with Bench("Creating trait objects"):
for i, line in enumerate(re):
this_trait = {}
@@ -93,7 +95,9 @@ class GSearch(object):
max_lrs_text = "Chr" + str(trait_ob.locus_chr) + ": " + str(trait_ob.locus_mb)
this_trait['max_lrs_text'] = max_lrs_text
- self.trait_list.append(this_trait)
+ trait_list.append(this_trait)
+
+ self.trait_list = json.dumps(trait_list)
elif self.type == "phenotype":
sql = """
@@ -131,7 +135,7 @@ class GSearch(object):
""" % (self.terms, self.terms, self.terms, self.terms, self.terms, self.terms, self.terms, self.terms, self.terms, self.terms)
logger.sql(sql)
re = g.db.execute(sql).fetchall()
- self.trait_list = []
+ trait_list = []
with Bench("Creating trait objects"):
for i, line in enumerate(re):
this_trait = {}
@@ -143,9 +147,9 @@ class GSearch(object):
this_trait['species'] = line[0]
this_trait['group'] = line[1]
if line[9] != None and line[6] != None:
- this_trait['description'] = line[6]
+ this_trait['description'] = unicode(line[6], "utf-8", "ignore")
elif line[5] != None:
- this_trait['description'] = line[5]
+ this_trait['description'] = unicode(line[5], "utf-8", "ignore")
else:
this_trait['description'] = "N/A"
this_trait['authors'] = line[7]
@@ -177,4 +181,6 @@ class GSearch(object):
except:
this_trait['max_lrs_text'] = "N/A"
- self.trait_list.append(this_trait)
+ trait_list.append(this_trait)
+
+ self.trait_list = json.dumps(trait_list)
diff --git a/wqflask/wqflask/templates/gsearch_gene.html b/wqflask/wqflask/templates/gsearch_gene.html
index ede673cd..4672f161 100644
--- a/wqflask/wqflask/templates/gsearch_gene.html
+++ b/wqflask/wqflask/templates/gsearch_gene.html
@@ -156,7 +156,10 @@
{
'title': "Description",
'type': "natural",
- 'data': "description"
+ 'data': null,
+ 'render': function(data, type, row, meta) {
+ return decodeURIComponent(escape(data.description))
+ }
},
{
'title': "Location",
diff --git a/wqflask/wqflask/templates/gsearch_pheno.html b/wqflask/wqflask/templates/gsearch_pheno.html
index 581d0f7d..7dc22a88 100644
--- a/wqflask/wqflask/templates/gsearch_pheno.html
+++ b/wqflask/wqflask/templates/gsearch_pheno.html
@@ -132,7 +132,10 @@
'title': "Description",
'type': "natural",
'width': "25%",
- 'data': "description"
+ 'data': null,
+ 'render': function(data, type, row, meta) {
+ return decodeURIComponent(escape(data.description))
+ }
},
{
'title': "Authors",
diff --git a/wqflask/wqflask/templates/search_result_page.html b/wqflask/wqflask/templates/search_result_page.html
index 065b0c0f..cb43d989 100644
--- a/wqflask/wqflask/templates/search_result_page.html
+++ b/wqflask/wqflask/templates/search_result_page.html
@@ -279,7 +279,10 @@
'title': "Description",
'type': "natural",
'width': "300px",
- 'data': "description"
+ 'data': null,
+ 'render': function(data, type, row, meta) {
+ return decodeURIComponent(escape(data.description))
+ }
},
{
'title': "Location",
@@ -315,7 +318,10 @@
'title': "Description",
'type': "natural",
'width': "500px",
- 'data': "description"
+ 'data': null,
+ 'render': function(data, type, row, meta) {
+ return decodeURIComponent(escape(data.description))
+ }
},
{
'title': "Authors",