From 889fc123e18d09c1501f70d7a0c8cf33d763116f Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 18 Jun 2017 19:48:44 +0530 Subject: [PATCH] Fix error in a handful of recipes caused by upgrade to mechanize 0.3 which returns lists instead of iterators for forms() and links() Fixes #1698646 [Failed: Fetch news from New York Times](https://bugs.launchpad.net/calibre/+bug/1698646) --- recipes/espn.recipe | 2 +- recipes/folhadesaopaulo_sub.recipe | 2 +- recipes/nikkei_news.recipe | 4 ++-- recipes/nytimes_sub.recipe | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/recipes/espn.recipe b/recipes/espn.recipe index d26856fe76..0ee53369ed 100644 --- a/recipes/espn.recipe +++ b/recipes/espn.recipe @@ -86,7 +86,7 @@ class ESPN(BasicNewsRecipe): f.write(raw) br.open_local_file(fname) - br.form = br.forms().next() + br.form = list(br.forms())[0] br.form.find_control( name='username', type='text').value = self.username br.form['password'] = self.password diff --git a/recipes/folhadesaopaulo_sub.recipe b/recipes/folhadesaopaulo_sub.recipe index 361a2a982d..c76f29c684 100644 --- a/recipes/folhadesaopaulo_sub.recipe +++ b/recipes/folhadesaopaulo_sub.recipe @@ -89,7 +89,7 @@ img { background: none !important; float: none; margin: 0px; } br = BasicNewsRecipe.get_browser(self) if self.username is not None and self.password is not None: br.open('https://acesso.uol.com.br/login.html') - br.form = br.forms().next() + br.form = list(br.forms())[0] br['user'] = self.username br['pass'] = self.password br.submit().read() diff --git a/recipes/nikkei_news.recipe b/recipes/nikkei_news.recipe index 994ba564c0..542180ea57 100644 --- a/recipes/nikkei_news.recipe +++ b/recipes/nikkei_news.recipe @@ -51,8 +51,8 @@ class NikkeiNet_paper_subscription(BasicNewsRecipe): br.open('http://www.nikkei.com/') print "-------------------------open first login form-----------------------------" try: - url = br.links( - url_regex="www.nikkei.com/etc/accounts/login").next().url + url = list(br.links( + url_regex="www.nikkei.com/etc/accounts/login"))[0].url except StopIteration: url = 'http://www.nikkei.com/etc/accounts/login?dps=3&pageflag=top&url=http%3A%2F%2Fwww.nikkei.com%2F' br.open(url) # br.follow_link(link) diff --git a/recipes/nytimes_sub.recipe b/recipes/nytimes_sub.recipe index 6ff8d8d9f7..e3d2ece0d4 100644 --- a/recipes/nytimes_sub.recipe +++ b/recipes/nytimes_sub.recipe @@ -417,7 +417,7 @@ class NYTimes(BasicNewsRecipe): br = BasicNewsRecipe.get_browser(self) if self.username is not None and self.password is not None: br.open('https://www.nytimes.com/auth/login') - br.form = br.forms().next() + br.form = list(br.forms())[0] br['userid'] = self.username br['password'] = self.password br.submit().read()