From 7cb006d5521d95cfe1c4b0768b2c99e25c82850b Mon Sep 17 00:00:00 2001 From: Alejandro Sirgo Rica Date: Mon, 13 May 2024 10:45:19 +0200 Subject: 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. --- ogcp/views.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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) -- cgit v1.2.3-18-g5258