diff --git a/recipes/volksrant.recipe b/recipes/volksrant.recipe index b3629ee4e0..e5499fed73 100644 --- a/recipes/volksrant.recipe +++ b/recipes/volksrant.recipe @@ -9,7 +9,6 @@ __docformat__ = 'restructuredtext en' Modified by Tony Stegall on 10/10/10 to include function to grab print version of articles ''' - from datetime import date from calibre.web.feeds.news import BasicNewsRecipe ''' @@ -42,9 +41,16 @@ class AdvancedUserRecipe1249039563(BasicNewsRecipe): ####################################################################################################### temp_files = [] articles_are_obfuscated = True + use_javascript_to_login = True + + def javascript_login(self, br, username, password): + 'Volksrant wants the user to explicitly allow cookies' + if not br.visit('http://www.volkskrant.nl'): + raise Exception('Failed to connect to volksrant website') + br.click('#pop_cookie_text a[onclick]', wait_for_load=True, timeout=120) def get_obfuscated_article(self, url): - br = self.get_browser() + br = self.browser.clone_browser() print 'THE CURRENT URL IS: ', url br.open(url) year = date.today().year diff --git a/src/calibre/db/categories.py b/src/calibre/db/categories.py index b934aec0c1..900f245b36 100644 --- a/src/calibre/db/categories.py +++ b/src/calibre/db/categories.py @@ -35,6 +35,8 @@ class Tag(object): self.avg_rating = avg/2.0 if avg is not None else 0 self.sort = sort self.use_sort_as_name = use_sort_as_name + if tooltip is None: + tooltip = '(%s:%s)'%(category, name) if self.avg_rating > 0: if tooltip: tooltip = tooltip + ': ' @@ -65,7 +67,6 @@ def find_categories(field_metadata): def create_tag_class(category, fm, icon_map): cat = fm[category] icon = None - tooltip = None if category in {'formats', 'identifiers'} else ('(' + category + ')') label = fm.key_to_label(category) if icon_map: if not fm.is_custom_field(category): @@ -87,8 +88,7 @@ def create_tag_class(category, fm, icon_map): use_sort_as_name = False return partial(Tag, use_sort_as_name=use_sort_as_name, icon=icon, - tooltip=tooltip, is_editable=is_editable, - category=category) + is_editable=is_editable, category=category) def clean_user_categories(dbcache): user_cats = dbcache.pref('user_categories', {}) diff --git a/src/calibre/ebooks/oeb/transforms/subset.py b/src/calibre/ebooks/oeb/transforms/subset.py index 0cca73fcce..3d2ab8d873 100644 --- a/src/calibre/ebooks/oeb/transforms/subset.py +++ b/src/calibre/ebooks/oeb/transforms/subset.py @@ -280,7 +280,7 @@ class SubsetFonts(object): return ans def find_usage_in(self, elem, inherited_style): - style = self.elem_style(elem.get('class', ''), inherited_style) + style = self.elem_style(elem.get('class', '') or '', inherited_style) for child in elem: self.find_usage_in(child, style) font = self.used_font(style) diff --git a/src/calibre/library/database2.py b/src/calibre/library/database2.py index 1397d0ca51..754a583f74 100644 --- a/src/calibre/library/database2.py +++ b/src/calibre/library/database2.py @@ -1935,8 +1935,6 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns): is_editable = category not in ['news', 'rating', 'languages'] categories[category] = [tag_class(formatter(r.n), count=r.c, id=r.id, avg=avgr(r), sort=r.s, icon=icon, - tooltip=u'({0}:{1})'.format(category, - formatter(r.n)), category=category, id_set=r.id_set, is_editable=is_editable, use_sort_as_name=use_sort_as_name)