about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2025-01-28 12:33:57 -0600
committerFrederick Muriuki Muriithi2025-01-28 12:33:57 -0600
commitb7d42630366bccb754a9e179a3052fd0012ff284 (patch)
tree7355ee0718fc7c0d0d3e123d77f45b50a367520b
parentcb57ff0e1b2fe997687c27b5e0b79d0b60ce981a (diff)
downloadgn-uploader-b7d42630366bccb754a9e179a3052fd0012ff284.tar.gz
Use a more robust check for emptiness.
Some of the values could be integer values.
-rw-r--r--uploader/phenotypes/views.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/uploader/phenotypes/views.py b/uploader/phenotypes/views.py
index 04264c2..e958c7a 100644
--- a/uploader/phenotypes/views.py
+++ b/uploader/phenotypes/views.py
@@ -231,6 +231,11 @@ def view_phenotype(# pylint: disable=[unused-argument]
                                     population["Id"],
                                     dataset["Id"],
                                     xref_id)
+        def __non_empty__(value) -> bool:
+            if isinstance(value, str):
+                return value.strip() != ""
+            return bool(value)
+
         return render_template(
             "phenotypes/view-phenotype.html",
             species=species,
@@ -244,8 +249,7 @@ def view_phenotype(# pylint: disable=[unused-argument]
                 for key,val in
                 (phenotype_publication_data(conn, phenotype["Id"]) or {}).items()
                 if (key in ("PubMed_ID", "Authors", "Title", "Journal")
-                    and val is not None
-                    and val.strip() != "")
+                    and __non_empty__(val))
             },
             privileges=(privileges
                         ### For demo! Do not commit this part