On 18.1.2016 08:06, Christian Heimes wrote:
> On 2016-01-15 13:44, Tomas Babej wrote:
>> For the dates older than 1900, Python is unable to convert the datetime
>> representation to string using strftime:
>> Work around the issue adding a custom method to convert the datetime
>> objects to LDAP generalized time strings.
Dates before 1900? Seriously? This is a bad idea.
I would rather catch ValueError and inform the user. We seriously do not need
more custom code!
> I noticed that all previous strftime() calls and the new code ignore any
> time zone information. This isn't an issue for tz-naive datetime object
> that don't have any time zone information attached. You can't fix them
> anyway and just hope they are always UTC. For tz-aware datetime object
> your approach returns the wrong value.
> You can use datetime.utctimetuple() instead. The method returns a time
> tuple in UTC.
> datetime.datetime(2016, 1, 18, 8, 2, 49, 646270)
Manage your subscription for the Freeipa-devel mailing list:
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code