Mercurial > kallithea
changeset 7637:5bb7a18b0431 stable
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.
author | Thomas De Schampheleire <thomas.de_schampheleire@nokia.com> |
---|---|
date | Tue, 16 Apr 2019 21:52:51 +0200 |
parents | 25bdf9f62ab6 |
children | 11caff9ee818 |
files | kallithea/controllers/admin/settings.py |
diffstat | 1 files changed, 7 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/controllers/admin/settings.py Tue Apr 16 20:39:13 2019 +0200 +++ b/kallithea/controllers/admin/settings.py Tue Apr 16 21:52:51 2019 +0200 @@ -171,11 +171,14 @@ 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')