From 91f3567d0935da46b8064100952a3974cecc3a67 Mon Sep 17 00:00:00 2001 From: Javier Sánchez Parra Date: Thu, 13 Jan 2022 11:36:41 +0100 Subject: Change some f-strings to format() python-babel is not compatible with f-strings. See also: https://github.com/python-babel/babel/issues/594 --- ogcp/views.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ogcp/views.py b/ogcp/views.py index 114e768..07a54ae 100644 --- a/ogcp/views.py +++ b/ogcp/views.py @@ -79,11 +79,11 @@ login_manager.login_view = 'login' def validate_elements(elements, min_len=1, max_len=float('inf')): valid = True if len(elements) < min_len: - flash(_(f'Please, select at least {min_len} element(s)'), + flash(_('Please, select at least {} element(s)').format(min_len), category='error') valid = not valid elif len(elements) > max_len: - flash(_(f'No more than {max_len} element(s) can be selected for the given action'), + flash(_('No more than {} element(s) can be selected for the given action').format(max_len), category='error') valid = not valid return valid @@ -437,10 +437,10 @@ def action_image_restore(): return redirect(url_for('commands')) else: - flash(_(f'ogServer was unable to obtain setup of selected computer {ip}'), category='error') + flash(_('ogServer was unable to obtain setup of selected computer {}').format(ip), category='error') return redirect(url_for('commands')) - form.partition.choices = [ (f'{disk_id} {part_id}', _(f'Disk: {disk_id} | Part: {part_id}')) + form.partition.choices = [ (f'{disk_id} {part_id}', _('Disk: {} | Part: {}').format(disk_id, part_id)) for disk_id, part_id in part_choices ] return render_template('actions/image_restore.html', form=form) @@ -487,7 +487,7 @@ def action_software(): if r.status_code == requests.codes.ok: flash(_('Software profile request sent successfully'), category='info') return redirect(url_for('commands')) - flash(_(f'Error processing software profile request: ({r.status})'), category='error') + flash(_('Error processing software profile request: ({})').format(r.status), category='error') return make_response("400 Bad Request", 400) else: ips = parse_elements(request.args.to_dict()) -- cgit v1.2.3-18-g5258