From d74445922ed9b507d3c8b87f7d99701de367c79e Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 17 Oct 2009 14:48:23 -0600 Subject: [PATCH] IGN:Fix regression that prevented error being raised when no username and password are specified in the GUI for a recipe that needs them --- resources/recipes/economist.recipe | 1 - src/calibre/web/feeds/news.py | 6 ++++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/resources/recipes/economist.recipe b/resources/recipes/economist.recipe index 30bb2688c8..0f70a1e025 100644 --- a/resources/recipes/economist.recipe +++ b/resources/recipes/economist.recipe @@ -18,7 +18,6 @@ class Economist(BasicNewsRecipe): __author__ = "Kovid Goyal" description = 'Global news and current affairs from a European perspective' oldest_article = 7.0 - needs_subscription = False # Strange but true INDEX = 'http://www.economist.com/printedition' cover_url = 'http://www.economist.com/images/covers/currentcovereu_large.jpg' remove_tags = [dict(name=['script', 'noscript', 'title'])] diff --git a/src/calibre/web/feeds/news.py b/src/calibre/web/feeds/news.py index f2c921bd82..43c1dfd5f2 100644 --- a/src/calibre/web/feeds/news.py +++ b/src/calibre/web/feeds/news.py @@ -501,8 +501,10 @@ class BasicNewsRecipe(Recipe): if isinstance(self.feeds, basestring): self.feeds = [self.feeds] - if self.needs_subscription and (self.username is None or self.password is None): - raise ValueError('The %s recipe needs a username and password.'%self.title) + if self.needs_subscription and (\ + self.username is None or self.password is None or \ + (not self.username and not self.password)): + raise ValueError(_('The "%s" recipe needs a username and password.')%self.title) self.browser = self.get_browser() self.image_map, self.image_counter = {}, 1