diff options
author | Alejandro Sirgo Rica <asirgo@soleta.eu> | 2024-06-06 16:26:46 +0200 |
---|---|---|
committer | Alejandro Sirgo Rica <asirgo@soleta.eu> | 2024-06-07 14:35:41 +0200 |
commit | 7737a502ab98da6abb76c8332f133089eb482008 (patch) | |
tree | 6993a71a04a8f0789a683360a9bca2567398acb5 /ogcp | |
parent | e136e77b56edbf730cad36a404cd2f9fadb0fdeb (diff) |
views: use conventional for loop in boot mode selection
Use a conventional for loop instead of a oneliner.
Improve code readability.
Diffstat (limited to 'ogcp')
-rw-r--r-- | ogcp/views.py | 6 |
1 files changed, 5 insertions, 1 deletions
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') |