# HG changeset patch # User Thomas De Schampheleire # Date 2019-04-16 21:52:51 # Node ID 5bb7a18b0431b13da9777016435c61223bd1ffd8 # Parent 25bdf9f62ab6d38c586f831c865ed7c00160c848 settings: rework logic for flash message after repository scan Make the code more readable by extracting added_msg and removed_msg away from the h.flash() call and reindenting the logic. There are no functional changes here. These changes serve as preparatory work for a subsequent commit that will change the logic. diff --git a/kallithea/controllers/admin/settings.py b/kallithea/controllers/admin/settings.py --- a/kallithea/controllers/admin/settings.py +++ b/kallithea/controllers/admin/settings.py @@ -171,11 +171,14 @@ class SettingsController(BaseController) install_git_hooks=install_git_hooks, user=request.authuser.username, overwrite_git_hooks=overwrite_git_hooks) + added_msg = ', '.join( + h.link_to(safe_unicode(repo_name), h.url('summary_home', repo_name=repo_name)) for repo_name in added + ) or '-' + removed_msg = ', '.join( + h.escape(safe_unicode(repo_name)) for repo_name in removed + ) or '-' h.flash(h.literal(_('Repositories successfully rescanned. Added: %s. Removed: %s.') % - (', '.join(h.link_to(safe_unicode(repo_name), h.url('summary_home', repo_name=repo_name)) - for repo_name in added) or '-', - ', '.join(h.escape(safe_unicode(repo_name)) for repo_name in removed) or '-')), - category='success') + (added_msg, removed_msg)), category='success') if invalidate_cache: log.debug('invalidating all repositories cache')