handle invalid lecture file format with invalid title
This commit is contained in:
parent
12b1632f8e
commit
4e71f12254
1 changed files with 9 additions and 4 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue