aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzsloan2019-07-18 17:58:33 -0500
committerzsloan2019-07-18 17:58:33 -0500
commit4ef78a90b4b232300a7806afdc5503fcf6fc7c4b (patch)
tree99c9bab4be841fd2386f1c5515abef9d3804216d
parent6dab4e5935b87ad818129e3b4bfab4cfa465addf (diff)
downloadgenenetwork2-4ef78a90b4b232300a7806afdc5503fcf6fc7c4b.tar.gz
Made change that should fix encoding issue, fingers crossed
-rw-r--r--wqflask/base/trait.py6
-rw-r--r--wqflask/wqflask/database.py2
-rw-r--r--wqflask/wqflask/search_results.py2
-rw-r--r--wqflask/wqflask/views.py2
4 files changed, 7 insertions, 5 deletions
diff --git a/wqflask/base/trait.py b/wqflask/base/trait.py
index 6fecf725..0527449b 100644
--- a/wqflask/base/trait.py
+++ b/wqflask/base/trait.py
@@ -396,8 +396,10 @@ def retrieve_trait_info(trait, dataset, get_qtl_info=False):
#XZ: assign SQL query result to trait attributes.
for i, field in enumerate(dataset.display_fields):
holder = trait_info[i]
- if isinstance(trait_info[i], basestring):
- holder = unicode(trait_info[i], "utf-8", "ignore")
+ # if isinstance(trait_info[i], basestring):
+ # logger.debug("HOLDER:", holder)
+ # logger.debug("HOLDER2:", holder.decode(encoding='latin1'))
+ # holder = unicode(trait_info[i], "utf-8", "ignore")
setattr(trait, field, holder)
if dataset.type == 'Publish':
diff --git a/wqflask/wqflask/database.py b/wqflask/wqflask/database.py
index 96c2c301..adeed6ad 100644
--- a/wqflask/wqflask/database.py
+++ b/wqflask/wqflask/database.py
@@ -9,7 +9,7 @@ import utility.logger
logger = utility.logger.getLogger(__name__ )
-engine = create_engine(SQL_URI, convert_unicode=True)
+engine = create_engine(SQL_URI, encoding="latin1")
db_session = scoped_session(sessionmaker(autocommit=False,
autoflush=False,
diff --git a/wqflask/wqflask/search_results.py b/wqflask/wqflask/search_results.py
index 2ce76c37..444e1f40 100644
--- a/wqflask/wqflask/search_results.py
+++ b/wqflask/wqflask/search_results.py
@@ -125,7 +125,7 @@ views.py).
elif this_trait.dataset.type == "Geno":
trait_dict['location'] = this_trait.location_repr
elif this_trait.dataset.type == "Publish":
- trait_dict['description'] = this_trait.description_display.decode('utf-8', 'replace')
+ trait_dict['description'] = this_trait.description_display
trait_dict['authors'] = this_trait.authors
trait_dict['pubmed_id'] = "N/A"
if this_trait.pubmed_id:
diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py
index 109e30cc..2ff6d4d7 100644
--- a/wqflask/wqflask/views.py
+++ b/wqflask/wqflask/views.py
@@ -80,7 +80,7 @@ def connect_db():
db = getattr(g, '_database', None)
if db is None:
logger.debug("Get new database connector")
- g.db = g._database = sqlalchemy.create_engine(SQL_URI)
+ g.db = g._database = sqlalchemy.create_engine(SQL_URI, encoding="latin1")
logger.debug(g.db)
@app.teardown_appcontext