From 07f925dfa55bde943d2a2348391aa24ce5dff285 Mon Sep 17 00:00:00 2001
From: Andreas <andreasv@fsmpi.rwth-aachen.de>
Date: Sun, 3 Dec 2017 15:09:40 +0100
Subject: [PATCH] added error handling to chapters if the wrong time format is
 used and no referrer is sent

---
 chapters.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/chapters.py b/chapters.py
index 5eb22d3..24d04d4 100644
--- a/chapters.py
+++ b/chapters.py
@@ -11,7 +11,10 @@ def suggest_chapter(lectureid):
 		time= timedelta(hours=x.hour,minutes=x.minute,seconds=x.second).total_seconds()
 		time = int(time)
 	except ValueError:
-		flash('Falsches Zeitformat, "%H:%M:%S" wird erwartet. Z.B. "01:39:42" für eine Kapitel bei Stunde 1, Minute 39, Sekunde 42')
+		if 'ref' in request.values:
+			flash('Falsches Zeitformat, "%H:%M:%S" wird erwartet. Z.B. "01:39:42" für eine Kapitel bei Stunde 1, Minute 39, Sekunde 42')
+			return redirect(request.values['ref'])
+		return 'Wrong time format, "%H:%M:%S" is expected',  400
 		
 	submitter = None
 	if not ismod():
-- 
GitLab