Implement #2277 (Remove empty feeds when fetching news with recipes)

This commit is contained in:
Kovid Goyal 2009-04-15 17:14:04 -07:00
parent d8430be7c8
commit 0820e5d90a

View File

@ -127,6 +127,12 @@ class BasicNewsRecipe(object, LoggingInterface):
#:
extra_css = None
#: If True empty feeds are removed from the output.
#: This option has no effect if parse_index is overriden in
#: the sub class. It is meant only for recipes that return a list
#: of feeds using :member:`feeds` or :method:`get_feeds`.
remove_empty_feeds = False
#: List of regular expressions that determines which links to follow
#: If empty, it is ignored. For example::
#:
@ -994,6 +1000,11 @@ class BasicNewsRecipe(object, LoggingInterface):
self.log_exception(msg)
remove = [f for f in parsed_feeds if len(f) == 0 and
self.remove_empty_feeds]
for f in remove:
parsed_feeds.remove(f)
return parsed_feeds
@classmethod