aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorMunyoki Kilyungi2022-09-02 17:22:11 +0300
committerBonfaceKilz2022-09-08 14:26:19 +0300
commitef84210728e798d66027408bd8695051e22a1510 (patch)
tree142f37aa950c4547d9b18426db7d6c9717be5320 /wqflask
parent211c7ebee84cadbb565fca54b331c97a9f03724b (diff)
downloadgenenetwork2-ef84210728e798d66027408bd8695051e22a1510.tar.gz
Restructure "if ... else" to first check for a ValueError
* wqflask/wqflask/db_info.py (InfoPage.get_info): First check for a ValueError Exception.
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/db_info.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/wqflask/wqflask/db_info.py b/wqflask/wqflask/db_info.py
index 336fc7df..2ce71fb7 100644
--- a/wqflask/wqflask/db_info.py
+++ b/wqflask/wqflask/db_info.py
@@ -37,6 +37,8 @@ class InfoPage:
"LEFT JOIN Investigators USING (InvestigatorId) "
"LEFT JOIN Organizations USING (OrganizationId) "
"LEFT JOIN DatasetStatus USING (DatasetStatusId) WHERE ")
+ if not all([self.gn_accession_id, self.info_page_name]):
+ raise ValueError('No correct parameter found')
if self.gn_accession_id:
final_query = f"{query_base}GN_AccesionId = {self.gn_accession_id}"
@@ -46,8 +48,6 @@ class InfoPage:
elif self.info_page_name:
final_query = f"{query_base}InfoPageName = {self.info_page_name}"
results = g.db.execute(final_query).fetchone()
- else:
- raise ValueError('No correct parameter found')
if results:
self.info = process_query_results(results)