From 6b11eb84eaba80117d9e92f28342a44398745322 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Tue, 21 Feb 2017 11:36:36 -0600 Subject: [PATCH] Be less aggressive when validating schedule edit form POST Somehow deletions were requested for shifts which didn't exist...not sure how that happened but let's just ignore instead of raise error --- tailbone/views/shifts/schedule.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tailbone/views/shifts/schedule.py b/tailbone/views/shifts/schedule.py index 08db8150..26bb65cd 100644 --- a/tailbone/views/shifts/schedule.py +++ b/tailbone/views/shifts/schedule.py @@ -83,11 +83,11 @@ class ScheduleView(TimeSheetView): # apply delete operations deleted = [] for uuid, value in data['delete'].iteritems(): - assert value == 'delete' - shift = Session.query(model.ScheduledShift).get(uuid) - assert shift - Session.delete(shift) - deleted.append(uuid) + if value == 'delete': + shift = self.Session.query(model.ScheduledShift).get(uuid) + if shift: + self.Session.delete(shift) + deleted.append(uuid) # apply create / update operations created = {}