handle invalid lecture file format with invalid title

This commit is contained in:
Maximilian Keßler 2021-09-17 09:48:16 +02:00
parent 12b1632f8e
commit 4e71f12254

View file

@ -30,12 +30,17 @@ class Lecture:
break break
# number = int(lecture_match.group(1)) # number = int(lecture_match.group(1))
if lecture_match:
date_str = lecture_match.group(2) date_str = lecture_match.group(2)
date = datetime.strptime(date_str, DATE_FORMAT) date = datetime.strptime(date_str, DATE_FORMAT)
week = get_week(date) week = get_week(date)
title = lecture_match.group(3) title = lecture_match.group(3)
else:
date = datetime.min
week = get_week(date)
title = 'Error while parsing lecture file'
self.file_path = file_path self.file_path = file_path
self.date = date self.date = date