diff --git a/ckan/controllers/home.py b/ckan/controllers/home.py index 21843ca4fb3..7a9fe062a0d 100644 --- a/ckan/controllers/home.py +++ b/ckan/controllers/home.py @@ -14,6 +14,7 @@ # horrible hack dirty_cached_group_stuff = None + class HomeController(base.BaseController): repo = model.repo @@ -32,7 +33,7 @@ def __before__(self, action, **env): ('no such table' in msg): # table missing, major database problem base.abort(503, _('This site is currently off-line. Database ' - 'is not initialised.')) + 'is not initialised.')) # TODO: send an email to the admin person (#1285) else: raise @@ -58,24 +59,27 @@ def index(self): c.facets = query['facets'] maintain.deprecate_context_item( - 'facets', - 'Use `c.search_facets` instead.') + 'facets', + 'Use `c.search_facets` instead.') c.search_facets = query['search_facets'] - c.facet_titles = {'groups': _('Groups'), - 'tags': _('Tags'), - 'res_format': _('Formats'), - 'license': _('Licence'), } + c.facet_titles = { + 'groups': _('Groups'), + 'tags': _('Tags'), + 'res_format': _('Formats'), + 'license': _('Licence'), + } data_dict = {'sort': 'packages', 'all_fields': 1} # only give the terms to group dictize that are returned in the # facets as full results take a lot longer if 'groups' in c.search_facets: - data_dict['groups'] = [ item['name'] for item in - c.search_facets['groups']['items'] ] + data_dict['groups'] = [ + item['name'] for item in c.search_facets['groups']['items'] + ] c.groups = logic.get_action('group_list')(context, data_dict) - except search.SearchError, se: + except search.SearchError: c.package_count = 0 c.groups = [] @@ -90,8 +94,8 @@ def index(self): msg = _(u'Please update your profile' u' and add your email address and your full name. ' u'{site} uses your email address' - u' if you need to reset your password.'.format(link=url, - site=g.site_title)) + u' if you need to reset your password.'.format( + link=url, site=g.site_title)) elif not c.userobj.email: msg = _('Please update your profile' ' and add your email address. ') % url + \ @@ -134,7 +138,7 @@ def db_to_form_schema(group_type=None): except logic.NotFound: return None - return {'group_dict' :group_dict} + return {'group_dict': group_dict} global dirty_cached_group_stuff if not dirty_cached_group_stuff: @@ -160,14 +164,14 @@ def db_to_form_schema(group_type=None): # We get all the packages or at least too many so # limit it to just 2 for group in groups_data: - group['group_dict']['packages'] = group['group_dict']['packages'][:2] + group['group_dict']['packages'] = \ + group['group_dict']['packages'][:2] #now add blanks so we have two while len(groups_data) < 2: - groups_data.append({'group_dict' :{}}) + groups_data.append({'group_dict': {}}) # cache for later use dirty_cached_group_stuff = groups_data - c.group_package_stuff = dirty_cached_group_stuff # END OF DIRTYNESS