diff --git a/Contents/Code/general_helper.py b/Contents/Code/general_helper.py index 1d938799..808b8993 100644 --- a/Contents/Code/general_helper.py +++ b/Contents/Code/general_helper.py @@ -237,11 +237,19 @@ def get_theme_provider(item): } if not item.themes(): + Log.Debug('No themes found for item: {}'.format(item.title)) return provider = None - selected = (theme for theme in item.themes() if theme.selected).next() + selected = None + for theme in item.themes(): + if getattr(theme, 'selected'): + selected = theme + break + if not selected: + Log.Debug('No selected theme found for item: {}'.format(item.title)) + return if selected.provider in provider_map.keys(): provider = provider_map[selected.provider] diff --git a/Contents/Code/webapp.py b/Contents/Code/webapp.py index a07f30e6..7b53538c 100644 --- a/Contents/Code/webapp.py +++ b/Contents/Code/webapp.py @@ -343,6 +343,8 @@ def cache_data(): else: theme_status = 'missing' + theme_provider = general_helper.get_theme_provider(item=item) + items[section.key]['items'].append(dict( title=item.title, agent=item_agent, @@ -352,7 +354,7 @@ def cache_data(): issue_action=issue_action, issue_url=item_issue_url, theme=True if item.theme else False, - theme_provider=general_helper.get_theme_provider(item=item), + theme_provider=theme_provider, theme_status=theme_status, type=item.type, year=year,