News download: Fix the check for empty feeds when generating man ToC page

Fixes #1834684 [TOC missing in news download (Python 3)](https://bugs.launchpad.net/calibre/+bug/1834684)
This commit is contained in:
Kovid Goyal 2019-06-30 07:07:10 +05:30
parent 07f80229e9
commit 465ca0573b
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 2 additions and 8 deletions

View File

@ -243,12 +243,6 @@ class Feed(object):
def __str__(self):
return repr(self)
def __bool__(self):
for article in self:
if getattr(article, 'downloaded', False):
return True
return False
def has_embedded_content(self):
length = 0
for a in self:

View File

@ -102,7 +102,7 @@ class IndexTemplate(Template):
head.append(STYLE(extra_css, type='text/css'))
ul = UL(attrs('calibre_feed_list'))
for i, feed in enumerate(feeds):
if feed:
if len(feed):
li = LI(A(feed.title, attrs('feed', rescale=120,
href='feed_%d/index.html'%i)), id='feed_%d'%i)
ul.append(li)
@ -265,7 +265,7 @@ class TouchscreenIndexTemplate(Template):
toc = TABLE(attrs('toc'),width="100%",border="0",cellpadding="3px")
for i, feed in enumerate(feeds):
if feed:
if len(feed):
tr = TR()
tr.append(TD(attrs(rescale=120), A(feed.title, href='feed_%d/index.html'%i)))
tr.append(TD('%s' % len(feed.articles), style="text-align:right"))