diff options
author | Alejandro Sirgo Rica <asirgo@soleta.eu> | 2024-05-13 10:45:19 +0200 |
---|---|---|
committer | Alejandro Sirgo Rica <asirgo@soleta.eu> | 2024-05-13 10:45:19 +0200 |
commit | 7cb006d5521d95cfe1c4b0768b2c99e25c82850b (patch) | |
tree | 7ae6417d06a8bd9504efd8f5bc5ee1a4f7ac95fb /ogcp/views.py | |
parent | 1ca3a97da795e910651f447a7edd575c8d112080 (diff) |
views: check if repository is selected in repo/ pages
Add checks and error report about non selected repository.
Non having a repository selected caused a traceback to be shown
in the web.
Diffstat (limited to 'ogcp/views.py')
-rw-r--r-- | ogcp/views.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/ogcp/views.py b/ogcp/views.py index 431e9c1..fcd8412 100644 --- a/ogcp/views.py +++ b/ogcp/views.py @@ -2271,6 +2271,10 @@ def action_repo_update(): return redirect(url_for('manage_repos')) repo_id = repos.pop() server_ip_port = params.get('repos-server') + + if not server_ip_port: + flash(_('Please, select a server'), category='error') + return redirect(url_for('manage_repos')) server = get_server_from_ip_port(server_ip_port) try: repository = get_repository(int(repo_id), server) @@ -2315,6 +2319,10 @@ def action_repo_delete(): return redirect(url_for('manage_repos')) repo_id = int(repo_id) server_ip_port = params.get('repos-server') + + if not server_ip_port: + flash(_('Please, select a server'), category='error') + return redirect(url_for('manage_repos')) server = get_server_from_ip_port(server_ip_port) try: repository = get_repository(repo_id, server) @@ -2347,6 +2355,10 @@ def action_repo_info(): return redirect(url_for('manage_repos')) repo_id = int(repo_id) server_ip_port = params.get('repos-server') + + if not server_ip_port: + flash(_('Please, select a server'), category='error') + return redirect(url_for('manage_repos')) server = get_server_from_ip_port(server_ip_port) try: repository = get_repository(repo_id, server) |