From 7737a502ab98da6abb76c8332f133089eb482008 Mon Sep 17 00:00:00 2001 From: Alejandro Sirgo Rica Date: Thu, 6 Jun 2024 16:26:46 +0200 Subject: views: use conventional for loop in boot mode selection Use a conventional for loop instead of a oneliner. Improve code readability. --- ogcp/views.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'ogcp') diff --git a/ogcp/views.py b/ogcp/views.py index 41042a8..f910626 100644 --- a/ogcp/views.py +++ b/ogcp/views.py @@ -1771,7 +1771,11 @@ def action_mode(): if most_used_mode in r.json()['modes']: most_used_t = (most_used_mode, mode_descriptions.get(most_used_mode, most_used_mode)) available_modes.append(most_used_t) - available_modes.extend([(mode, mode_descriptions.get(mode, mode)) for mode in r.json()['modes'] if mode != most_used_mode]) + + for mode in r.json()['modes']: + if mode != most_used_mode: + available_modes.append((mode, mode_descriptions.get(mode, mode))) + if not available_modes: flash(_('no boot templates are available in the server'), category='error') -- cgit v1.2.3-18-g5258