From 7ff3b8116bcf9afaeb637efe606dc825bd23dbc0 Mon Sep 17 00:00:00 2001 From: Joseph Date: Tue, 10 Jul 2018 23:18:22 +0100 Subject: Do not add lock to page if there is no content on it --- pysite/views/wiki/edit.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'pysite') diff --git a/pysite/views/wiki/edit.py b/pysite/views/wiki/edit.py index 65378807..407da62b 100644 --- a/pysite/views/wiki/edit.py +++ b/pysite/views/wiki/edit.py @@ -40,7 +40,10 @@ class EditView(RouteView, DBMixin, RMQMixin): lock_expiry = datetime.datetime.utcnow() + datetime.timedelta(minutes=5) - if not DEBUG_MODE: # If we are in debug mode we have no user logged in, therefore we can skip locking + # 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, { -- cgit v1.2.3