From 7da1dcda4a8290d9ff116f967e50108a6c355848 Mon Sep 17 00:00:00 2001 From: Vivek Anand Date: Nov 01 2016 17:46:36 +0000 Subject: some code beautification in library widget --- diff --git a/hubs/widgets/library.py b/hubs/widgets/library.py index c476ced..b18354a 100644 --- a/hubs/widgets/library.py +++ b/hubs/widgets/library.py @@ -16,8 +16,12 @@ position = 'both' help="A comma separated list of URLs to add to the library. " "External links must include the whole link (starting with http...)") def data(session, widget, urls): + ''' Data for the Library widget. Given the widget, it + returns the hypertext links of it's configuration urls ''' + urls = [ - clean_input.clean('{0}'.format(u.encode('utf-8').strip())) + clean_input.clean( + '{0}'.format(u.encode('utf-8').strip())) for u in widget.config.get('urls', '').split(',') if u.encode('utf-8').strip() ] @@ -26,6 +30,9 @@ def data(session, widget, urls): @hint(topics=[_('hubs.widget.update')]) def should_invalidate(message, session, widget): + ''' Check if the Library widget cache needs an update. + Called by a backend daemon listening to fedmsg ''' + if not message['topic'].endswith('hubs.widget.update'): return False if message['msg']['widget']['id'] != widget.id: