diff options
author | Munyoki Kilyungi | 2022-09-02 17:22:11 +0300 |
---|---|---|
committer | BonfaceKilz | 2022-09-08 14:26:19 +0300 |
commit | ef84210728e798d66027408bd8695051e22a1510 (patch) | |
tree | 142f37aa950c4547d9b18426db7d6c9717be5320 | |
parent | 211c7ebee84cadbb565fca54b331c97a9f03724b (diff) | |
download | genenetwork2-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.
-rw-r--r-- | wqflask/wqflask/db_info.py | 4 |
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) |