diff --git a/src/calibre/library/database2.py b/src/calibre/library/database2.py index 22266487e8..3d11020626 100644 --- a/src/calibre/library/database2.py +++ b/src/calibre/library/database2.py @@ -275,8 +275,9 @@ class ResultCache(SearchQueryParser): cmp(self._data[x][loc], self._data[y][loc]) except AttributeError: # Some entries may be None ans = cmp(self._data[x][loc], self._data[y][loc]) - if ans != 0: return ans - return cmp(self._data[x][11].lower(), self._data[y][11].lower()) + #if ans != 0: return ans + #return cmp(self._data[x][11].lower(), self._data[y][11].lower()) + return ans def sort(self, field, ascending): field = field.lower().strip() diff --git a/src/calibre/web/feeds/recipes/recipe_newsweek.py b/src/calibre/web/feeds/recipes/recipe_newsweek.py index 43b7065fa5..6f47019f46 100644 --- a/src/calibre/web/feeds/recipes/recipe_newsweek.py +++ b/src/calibre/web/feeds/recipes/recipe_newsweek.py @@ -68,10 +68,9 @@ class Newsweek(BasicNewsRecipe): def parse_index(self): - ci = self.get_current_issue() - if not ci: + soup = self.get_current_issue() + if not soup: raise RuntimeError('Unable to connect to newsweek.com. Try again later.') - soup = self.index_to_soup(ci) img = soup.find(alt='Cover') if img is not None and img.has_key('src'): small = img['src'] @@ -119,10 +118,10 @@ class Newsweek(BasicNewsRecipe): return soup def get_current_issue(self): - from urllib2 import urlopen # For some reason mechanize fails - home = urlopen('http://www.newsweek.com').read() - soup = BeautifulSoup(home) + #from urllib2 import urlopen # For some reason mechanize fails + #home = urlopen('http://www.newsweek.com').read() + soup = self.index_to_soup('http://www.newsweek.com')#BeautifulSoup(home) img = soup.find('img', alt='Current Magazine') if img and img.parent.has_key('href'): - return urlopen(img.parent['href']).read() + return self.index_to_soup(img.parent['href'])