don't fail when we get a wrong time format when requesting contact time

This commit is contained in:
Yann Leboulanger 2009-03-18 11:04:25 +00:00
parent 9d307570df
commit c7c5d0f66d
1 changed files with 6 additions and 3 deletions

View File

@ -1682,10 +1682,13 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco,
def dst(self, dt):
return ZERO
t = datetime.datetime.strptime(utc_time, '%Y-%m-%dT%H:%M:%SZ')
t = t.replace(tzinfo=UTC())
try:
t = datetime.datetime.strptime(utc_time, '%Y-%m-%dT%H:%M:%SZ')
t = t.replace(tzinfo=UTC())
time_info = t.astimezone(contact_tz()).strftime('%c')
except ValueError, e:
log.info('Wrong time format: %s' % str(e))
time_info = t.astimezone(contact_tz()).strftime('%c')
id_ = iq_obj.getID()
if id_ in self.groupchat_jids:
who = self.groupchat_jids[id_]