Fail to parse datetime containing timezone info
Sometimes I get the following error when launching gajim.
NameError: name 't' is not defined
I cannot provide a full stacktrace because I'm unable to reproduce the problem for now (maybe because I upgraded ejabberd recently). I can only remember that it had something to do with MAM.
The problem comes from datetime_tuple(), when parsing a datetime containing timezone information, which doesn't seem to happen very often.
Can you tell me if the patch attached is good? I've tested the function with many datetime formats, even if some of them are unlikely to be needed.
# This should print the same line 12 times. candidates = ( '2015-02-28T23:59:59.042Z', '2015-03-01T01:59:59.042+0200', '2015-03-01T01:59:59.042+02:00', '2015-02-28T12:59:59.042-11:00', '2015-02-28T12:59:59.042-11', '2015-02-28T12:59:59.042-1100', '2015-02-28T23:59:59Z', '2015-03-01T01:59:59+0200', '2015-03-01T01:59:59+02:00', '2015-02-28T12:59:59-11:00', '2015-02-28T12:59:59-11', '2015-02-28T12:59:59-1100', ) for c in candidates: print(time.strftime('%Y-%m-%d %H:%M:%S', datetime_tuple(c)))