Commit fd737b5f authored by Jérome Perrin's avatar Jérome Perrin

Compatibility with DateTime >= 3

On the way to Zope 4, the biggest change was DateTime >= 3, which has these main differences:

 - `DateTime` instances are new style classes
 - `DateTime.__eq__` now take into the timezone into account
 - `DateTime` supports timezone naive ( ) - actually this is since DateTime 2.12 , but since we fully patched the method where the parsing happens, ERP5's patched DateTime never used timezone naive dates.
 - pickles are also different.

These are changes to prepare ERP5 code base to support DateTime >= 3, while keeping compatibility with the previous behavior, this means that we keep patching to keep the same behavior as DateTime 2, so that `DateTime.__eq__` ignores timezone difference and `DateTime` does not support timezone naive dates - these two different behavior seemed to introduce too much breakages, especially in project code, with no immediate benefit for our usages. For now, while ERP5 is still based on Zope 2 / DateTime 2 the fact that DateTime are new style classes has no impact, this will only impact once we switch to Zope 4.

This also change the code to adjust the part where we were depending on implementation details of DateTime and where the details changed on DateTime 3, sometimes exposing higher level API, like the new `timeZoneContext` to use in tests.

See merge request !1593
parents 0243d5c8 6083a15b
Pipeline #26099 failed with stage
in 0 seconds