From 567e9ec698d3807a6e779432adea297c98c08cd4 Mon Sep 17 00:00:00 2001 From: Elena ``of Valhalla'' Grandi Date: Mon, 7 Dec 2020 17:27:49 +0100 Subject: compatibility fix with dateutil before 2.8 --- lesana/types.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lesana/types.py b/lesana/types.py index 1d5322e..0b278d6 100644 --- a/lesana/types.py +++ b/lesana/types.py @@ -226,9 +226,11 @@ class LesanaDate(LesanaType): return data if isinstance(data, datetime.date): return data + # compatibility with dateutil before 2.8 + ParserError = getattr(dateutil.parser, 'ParserError', ValueError) try: return dateutil.parser.parse(data) - except dateutil.parser.ParserError: + except ParserError: raise LesanaValueError( "Invalid value for date field: {}".format(data) ) -- cgit v1.2.3