Commit 12d1f1f0 authored by Jérome Perrin's avatar Jérome Perrin Committed by Kazuhiko Shiozaki

DateTimePatch: keep exceptions as class attributes

We have code depending on these attributes, they were used in pattern
like this:

```py
try:
  DateTime(user_input)
except DateTime.DateError:
  error("invalid date")
```

so it's safer to keep the attributes for now, since we are already
patching a lot
parent 05487aed
......@@ -278,3 +278,11 @@ def DateTime_parse(self, st, datefmt=getDefaultDateFormat()):
DateTimeKlass._parse = DateTime_parse
# DateTime 3 removed exceptions as class attributes (since
# zopefoundation/DateTime commit 8114618 ), but we have some code expecting
# these attributes, so undo this patch for convenience.
DateTimeKlass.DateTimeError = DateTimeError
DateTimeKlass.SyntaxError = SyntaxError
DateTimeKlass.DateError = DateError
DateTimeKlass.TimeError = TimeError
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment