aboutsummaryrefslogtreecommitdiffstats
path: root/pysite
diff options
context:
space:
mode:
authorGravatar Joseph <[email protected]>2018-07-11 21:15:49 +0100
committerGravatar Joseph <[email protected]>2018-07-11 21:17:34 +0100
commitfefa656f45c5b500f2e5b424fe5ff67a4ac1a23f (patch)
treee62c0a39178e5c679211ded6e79fef923bcd3de1 /pysite
parentFix robots.txt for main blueprint (diff)
Check that the page is not NoneType before checking that the page has no content to prevent trying to NoneType.get()
Diffstat (limited to 'pysite')
-rw-r--r--pysite/views/wiki/edit.py21
1 files changed, 11 insertions, 10 deletions
diff --git a/pysite/views/wiki/edit.py b/pysite/views/wiki/edit.py
index 407da62b..949c9942 100644
--- a/pysite/views/wiki/edit.py
+++ b/pysite/views/wiki/edit.py
@@ -43,16 +43,17 @@ class EditView(RouteView, DBMixin, RMQMixin):
# There are a couple of cases where we will not need to lock a page. One of these is if the application is
# current set to debug mode. The other of these cases is if the page is empty, because if the page is empty
# we will only have a partially filled out page if the user quits before saving.
- if not DEBUG_MODE and obj.get("rst"):
- self.db.insert(
- self.table_name,
- {
- "slug": page,
- "lock_expiry": lock_expiry.timestamp(),
- "lock_user": self.user_data.get("user_id")
- },
- conflict="update"
- )
+ if obj:
+ if not DEBUG_MODE and obj.get("rst"):
+ self.db.insert(
+ self.table_name,
+ {
+ "slug": page,
+ "lock_expiry": lock_expiry.timestamp(),
+ "lock_user": self.user_data.get("user_id")
+ },
+ conflict="update"
+ )
return self.render("wiki/page_edit.html", page=page, rst=rst, title=title, preview=preview, can_edit=True)