mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-01-16 02:05:08 +01:00
Fix #5298 (Article Dates not set with custom parse_index)
This commit is contained in:
parent
6de89762ee
commit
09a21b8529
2 changed files with 14 additions and 1 deletions
|
|
@ -49,6 +49,17 @@ def __init__(self, id, title, url, author, summary, published, content):
|
|||
self.date = published
|
||||
self.utctime = dt_factory(self.date, assume_utc=True, as_utc=True)
|
||||
self.localtime = self.utctime.astimezone(local_tz)
|
||||
self._formatted_date = None
|
||||
|
||||
@dynamic_property
|
||||
def formatted_date(self):
|
||||
def fget(self):
|
||||
if self._formatted_date is None:
|
||||
self._formatted_date = self.localtime.strftime(" [%a, %d %b %H:%M]")
|
||||
return self._formatted_date
|
||||
def fset(self, val):
|
||||
self._formatted_date = val
|
||||
return property(fget=fget, fset=fset)
|
||||
|
||||
@dynamic_property
|
||||
def title(self):
|
||||
|
|
@ -150,6 +161,8 @@ def populate_from_preparsed_feed(self, title, articles, oldest_article=7,
|
|||
self.articles.append(article)
|
||||
else:
|
||||
self.logger.debug('Skipping article %s (%s) from feed %s as it is too old.'%(title, article.localtime.strftime('%a, %d %b, %Y %H:%M'), self.title))
|
||||
d = item.get('date', '')
|
||||
article.formatted_date = d
|
||||
|
||||
|
||||
def parse_article(self, item):
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ def __init__(self):
|
|||
<li id="${'article_%d'%i}" py:if="getattr(article, 'downloaded',
|
||||
False)" style="padding-bottom:0.5em" class="calibre_rescale_100">
|
||||
<a class="article calibre_rescale_120" href="${article.url}">${article.title}</a>
|
||||
<span class="article_date">${article.localtime.strftime(" [%a, %d %b %H:%M]")}</span>
|
||||
<span class="article_date">${article.formatted_date}</span>
|
||||
<div class="article_description calibre_rescale_70" py:if="article.summary">
|
||||
${Markup(cutoff(article.text_summary))}
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in a new issue