fix timezone of dates

This commit is contained in:
Romain Bignon 2011-02-25 10:53:27 +01:00
commit 5b4a917787
2 changed files with 4 additions and 1 deletions

View file

@ -102,7 +102,7 @@ class DLFPBackend(BaseBackend, ICapMessages, ICapMessagesPost):
title=content.title, title=content.title,
sender=content.author or u'', sender=content.author or u'',
receivers=None, receivers=None,
date=thread.date, #TODO XXX WTF this is None date=thread.date,
parent=None, parent=None,
content=content.body, content=content.body,
signature='URL: %s' % self.browser.absurl(id2url(content.id)), signature='URL: %s' % self.browser.absurl(id2url(content.id)),

View file

@ -19,6 +19,7 @@
from datetime import datetime from datetime import datetime
from weboob.tools.parsers.lxmlparser import select, SelectElementException from weboob.tools.parsers.lxmlparser import select, SelectElementException
from weboob.tools.misc import local2utc
from weboob.backends.dlfp.tools import url2id from weboob.backends.dlfp.tools import url2id
from .index import DLFPPage from .index import DLFPPage
@ -44,6 +45,7 @@ class Comment(object):
self.author = 'Anonyme' self.author = 'Anonyme'
self.date = datetime.strptime(select(div.find('p'), 'time', 1).attrib['datetime'].split('+')[0], self.date = datetime.strptime(select(div.find('p'), 'time', 1).attrib['datetime'].split('+')[0],
'%Y-%m-%dT%H:%M:%S') '%Y-%m-%dT%H:%M:%S')
self.date = local2utc(self.date)
self.body = self.browser.parser.tostring(div.find('div')) self.body = self.browser.parser.tostring(div.find('div'))
self.score = int(select(div.find('p'), 'span.score', 1).text) self.score = int(select(div.find('p'), 'span.score', 1).text)
self.url = select(div.find('h2'), 'a.title', 1).attrib['href'] self.url = select(div.find('h2'), 'a.title', 1).attrib['href']
@ -78,6 +80,7 @@ class Article(object):
self.body = self.browser.parser.tostring(select(tree, 'div.content', 1)) self.body = self.browser.parser.tostring(select(tree, 'div.content', 1))
self.date = datetime.strptime(select(header, 'time', 1).attrib['datetime'].split('+')[0], self.date = datetime.strptime(select(header, 'time', 1).attrib['datetime'].split('+')[0],
'%Y-%m-%dT%H:%M:%S') '%Y-%m-%dT%H:%M:%S')
self.date = local2utc(self.date)
self.comments = [] self.comments = []