dateTime.aslocal does not work for non UTC datetimes
Brought to you by:
pabigot
Whenever a pyxb.binding.datatypes.dateTime instance contains a timezone different from UTC, aslocal return an incorrect date.
Consider the following (with local timezone = +02:00):
>>> import pyxb.binding
>>> pyxb.PreserveInputTimeZone(True)
True
>>> print pyxb.binding.datatypes.dateTime("2013-08-30T11:56:45+04:00").aslocal()
2013-08-30 13:56:45+02:00
Correct date should be 2013-08-30 09:56:45+02:00
A simple check in aslocal method before replacing tzinfo should do the trick.
Thanks for the report. Fixed in next branch per this commit: