aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMunyoki Kilyungi2022-09-01 17:13:17 +0300
committerBonfaceKilz2022-09-08 14:26:19 +0300
commitb45caa10e7896cae614109c86a55c475c47de01a (patch)
tree2ac4308892ddf4c3d6192ab4bb333a35e08383aa
parent026ceff5ea71f07f32db88e01fadfe38dbc39c75 (diff)
downloadgenenetwork2-b45caa10e7896cae614109c86a55c475c47de01a.tar.gz
Refactor "if ... else" block to check the truthy case first
* wqflask/wqflask/docs.py (Docs.__init__): Check the truthy case first after fetching the results.
-rw-r--r--wqflask/wqflask/docs.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/wqflask/wqflask/docs.py b/wqflask/wqflask/docs.py
index 9661f768..06f83c7f 100644
--- a/wqflask/wqflask/docs.py
+++ b/wqflask/wqflask/docs.py
@@ -12,14 +12,12 @@ class Docs:
"FROM Docs WHERE Docs.entry LIKE %s", (str(entry),))
result = cursor.fetchone()
self.entry = entry
- if result == None:
- self.title = self.entry.capitalize()
- self.content = ""
- else:
-
+ if result:
self.title = result[0]
self.content = result[1].decode("utf-8")
-
+ else:
+ self.title = self.entry.capitalize()
+ self.content = ""
self.editable = "false"
# ZS: Removing option to edit to see if text still gets vandalized
try: