datetime.fromtimestamp() already converts utc timestamp to local date

This commit is contained in:
Romain Bignon 2014-10-11 22:32:08 +02:00
commit 3a4d8ec8dd

View file

@ -24,7 +24,6 @@ from weboob.capabilities.messages import CapMessages, CapMessagesPost, Thread, M
from weboob.capabilities.dating import CapDating from weboob.capabilities.dating import CapDating
from weboob.tools.backend import Module, BackendConfig from weboob.tools.backend import Module, BackendConfig
from weboob.tools.value import Value, ValueBackendPassword from weboob.tools.value import Value, ValueBackendPassword
from weboob.tools.date import utc2local
from .browser import PlayMeBrowser, FacebookBrowser from .browser import PlayMeBrowser, FacebookBrowser
@ -62,7 +61,7 @@ class PlayMeModule(Module, CapMessages, CapMessagesPost, CapDating):
t = Thread(thread['id']) t = Thread(thread['id'])
t.flags = Thread.IS_DISCUSSION t.flags = Thread.IS_DISCUSSION
t.title = u'Discussion with %s' % thread['name'] t.title = u'Discussion with %s' % thread['name']
t.date = utc2local(datetime.datetime.fromtimestamp(thread['last_message']['utc_timestamp'])) t.date = datetime.datetime.fromtimestamp(thread['last_message']['utc_timestamp'])
yield t yield t
def get_thread(self, thread): def get_thread(self, thread):
@ -102,7 +101,7 @@ class PlayMeModule(Module, CapMessages, CapMessagesPost, CapDating):
title=thread.title, title=thread.title,
sender=unicode(self.browser.my_name if msg['from'] == self.browser.my_id else user['name']), sender=unicode(self.browser.my_name if msg['from'] == self.browser.my_id else user['name']),
receivers=[unicode(self.browser.my_name if msg['from'] != self.browser.my_id else user['name'])], receivers=[unicode(self.browser.my_name if msg['from'] != self.browser.my_id else user['name'])],
date=utc2local(datetime.datetime.fromtimestamp(msg['utc_timestamp'])), date=datetime.datetime.fromtimestamp(msg['utc_timestamp']),
content=content, content=content,
children=[], children=[],
parent=None, parent=None,