make_aware throws AmbiguousTimeError exception
|Reported by:||Owned by:||nobody|
|Cc:||Triage Stage:||Ready for checkin|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
When using the pytz package, the make_aware() utility function occasionally throws an AmbiguousTimeError or NonExistentTimeError exception.
As the pytz maintainer explain, some dates time values may not be localizable (using the pytz.localize() function) when the optional is_dst Parameter is
I don't think, that Django should throw an exception in these cases, that results in a "show stopper" behavior.
Instead, I would prefer to just "guess" it the is_dst parameter when these Exceptions occur. That may result in a 50% chance to get a 1 hour
miscalculation – but until we don't know a better way, I just prefer that instead of having some values not saved at all...
Anyway, I attached a little patch to prevent this nasty Exceptions.
Change History (4)
comment:2 Changed 2 years ago by
|Status:||closed → new|
|Triage Stage:||Unreviewed → Ready for checkin|
|Type:||Bug → New feature|
|Version:||1.5 → master|