diff options
author | Munyoki Kilyungi | 2022-10-09 19:57:33 +0300 |
---|---|---|
committer | BonfaceKilz | 2022-11-08 11:22:05 +0300 |
commit | 05a546d995284d11082623e1c4ec6cafe778760c (patch) | |
tree | c9e520ab2a1545cf37a1586e1e995e46d854e0d3 | |
parent | 0b6d7199145c9fcaf1200e4b18fe24154da3a555 (diff) | |
download | genenetwork2-05a546d995284d11082623e1c4ec6cafe778760c.tar.gz |
De-duplicate fetching results after a query
* wqflask/wqflask/db_info.py (InfoPage.get_info): run
cursor.fetchone() only once.
-rw-r--r-- | wqflask/wqflask/db_info.py | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/wqflask/wqflask/db_info.py b/wqflask/wqflask/db_info.py index 376ce14c..9fcd1421 100644 --- a/wqflask/wqflask/db_info.py +++ b/wqflask/wqflask/db_info.py @@ -44,13 +44,11 @@ class InfoPage: if self.gn_accession_id: cursor.execute(f"{query_base}GN_AccesionId = %s", (self.gn_accession_id,)) - results = cursor.fetchone() elif self.info_page_name: cursor.execute(f"{query_base}InfoPageName = %s", (self.info_page_name,)) - results = cursor.fetchone() - if results: - self.info = process_query_results(results) + if (results := cursor.fetchone()): + self.info = results if ((not results or len(results) < 1) and self.info_page_name and create): return self.get_info() |