IGN:Fix regression that prevented error being raised when no username and password are specified in the GUI for a recipe that needs them

This commit is contained in:
Kovid Goyal 2009-10-17 14:48:23 -06:00
parent c1c3a6555f
commit d74445922e
2 changed files with 4 additions and 3 deletions

View File

@ -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'])]

View File

@ -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