diff options
-rw-r--r-- | wqflask/base/data_set.py | 24 | ||||
-rw-r--r-- | wqflask/wqflask/search_results.py | 6 | ||||
-rw-r--r-- | wqflask/wqflask/views.py | 4 |
3 files changed, 16 insertions, 18 deletions
diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py index 41c94078..b877f176 100644 --- a/wqflask/base/data_set.py +++ b/wqflask/base/data_set.py @@ -316,16 +316,20 @@ class DatasetGroup: def __init__(self, dataset, name=None): """This sets self.group and self.group_id""" - query = """SELECT InbredSet.Name, InbredSet.Id, InbredSet.GeneticType, - InbredSet.InbredSetCode FROM InbredSet where Name=%s - """ - if not name: - query, name = dataset.query_for_group, dataset.name with database_connection() as conn, conn.cursor() as cursor: - cursor.execute(query, (name,)) - results = cursor.fetchone() - if results: - self.name, self.id, self.genetic_type, self.code = results + if not name: + cursor.execute(dataset.query_for_group, + (dataset.name,)) + else: + cursor.execute( + "SELECT InbredSet.Name, " + "InbredSet.Id, " + "InbredSet.GeneticType, " + "InbredSet.InbredSetCode " + "FROM InbredSet WHERE Name = %s", + (dataset.name,)) + (self.name, self.id, + self.genetic_type, self.code) = cursor.fetchone() if self.name == 'BXD300': self.name = "BXD" @@ -672,7 +676,7 @@ class DataSet: "WHERE ProbeSetFreeze.Name = %s AND " "ProbeSetXRef.ProbeSetFreezeId = ProbeSetFreeze.Id " "AND ProbeSetXRef.ProbeSetId = ProbeSet.Id", - (self.name,)) + (self.name,)) # should cache this traits_name_dict = dict(cursor.fetchall()) diff --git a/wqflask/wqflask/search_results.py b/wqflask/wqflask/search_results.py index 061fe5b3..bd6d1f79 100644 --- a/wqflask/wqflask/search_results.py +++ b/wqflask/wqflask/search_results.py @@ -388,11 +388,7 @@ def get_GO_symbols(a_search): new_terms = [] for gene in gene_list: - this_term = dict(key=None, - separator=None, - search_term=[gene]) - - new_terms.append(this_term) + new_terms.append(dict(key=None, separator=None, search_term=[gene])) return new_terms diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py index 02c534a2..174913e4 100644 --- a/wqflask/wqflask/views.py +++ b/wqflask/wqflask/views.py @@ -179,10 +179,8 @@ def search_page(): result = Redis.get(key) if result: result = pickle.loads(result) - the_search = SearchResultPage(request.args) - result = the_search.__dict__ + result = SearchResultPage(request.args).__dict__ valid_search = result['search_term_exists'] - if USE_REDIS and valid_search: Redis.set(key, pickle.dumps(result, pickle.HIGHEST_PROTOCOL)) Redis.expire(key, 60 * 60) |