mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Don't index exceptions directly
In Python 3, exceptions don't behave as tuples of their arguments; instead of e[1] it's necessary to use e.args[1]. https://fedorahosted.org/freeipa/ticket/5623 Reviewed-By: Jan Cholasta <jcholast@redhat.com> Reviewed-By: Martin Basti <mbasti@redhat.com>
This commit is contained in:
committed by
Jan Cholasta
parent
126d899321
commit
465dd9829c
@@ -1284,14 +1284,14 @@ class cli(backend.Executioner):
|
||||
except IOError as e:
|
||||
raise ValidationError(
|
||||
name=to_cli(p.cli_name),
|
||||
error='%s: %s:' % (fname, e[1])
|
||||
error='%s: %s:' % (fname, e.args[1])
|
||||
)
|
||||
elif p.stdin_if_missing:
|
||||
try:
|
||||
raw = sys.stdin.read()
|
||||
except IOError as e:
|
||||
raise ValidationError(
|
||||
name=to_cli(p.cli_name), error=e[1]
|
||||
name=to_cli(p.cli_name), error=e.args[1]
|
||||
)
|
||||
|
||||
if raw:
|
||||
|
||||
@@ -221,7 +221,7 @@ def validated_read(argname, filename, mode='r', encoding=None):
|
||||
raise errors.ValidationError(
|
||||
name=argname,
|
||||
error=_("Cannot read file '%(filename)s': %(exc)s") % {
|
||||
'filename': filename, 'exc': exc[1]
|
||||
'filename': filename, 'exc': exc.args[1]
|
||||
}
|
||||
)
|
||||
except UnicodeError as exc:
|
||||
@@ -1547,7 +1547,7 @@ class vault_archive(PKQuery, Local):
|
||||
except OSError as exc:
|
||||
raise errors.ValidationError(name="in", error=_(
|
||||
"Cannot read file '%(filename)s': %(exc)s")
|
||||
% {'filename': input_file, 'exc': exc[1]})
|
||||
% {'filename': input_file, 'exc': exc.args[1]})
|
||||
if stat.st_size > MAX_VAULT_DATA_SIZE:
|
||||
raise errors.ValidationError(name="in", error=_(
|
||||
"Size of data exceeds the limit. Current vault data size "
|
||||
|
||||
Reference in New Issue
Block a user