diff options
author | Martin Basti <mbasti@redhat.com> | 2016-03-02 17:13:27 +0100 |
---|---|---|
committer | Tomas Babej <tbabej@redhat.com> | 2016-03-04 13:10:08 +0100 |
commit | 2c8e100c73ee1f0c9b57a0aabfc8ab8820e80687 (patch) | |
tree | f727ebe3dd3ba2c6829f4ce93a4b724881850050 /ipalib/util.py | |
parent | 3c519951c5a719421d5abfa864dfeb6fbce6869d (diff) | |
download | freeipa-2c8e100c73ee1f0c9b57a0aabfc8ab8820e80687.tar.gz freeipa-2c8e100c73ee1f0c9b57a0aabfc8ab8820e80687.tar.xz freeipa-2c8e100c73ee1f0c9b57a0aabfc8ab8820e80687.zip |
fix suspicious except statements
The "except ValueError as UnicodeDecodeError" looks very suspicious.
Commit change except to catch both exceptions.
https://fedorahosted.org/freeipa/ticket/5718
Reviewed-By: Tomas Babej <tbabej@redhat.com>
Diffstat (limited to 'ipalib/util.py')
-rw-r--r-- | ipalib/util.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/ipalib/util.py b/ipalib/util.py index 6c70fbdfc..262acf926 100644 --- a/ipalib/util.py +++ b/ipalib/util.py @@ -278,13 +278,13 @@ def normalize_sshpubkey(value): def validate_sshpubkey(ugettext, value): try: SSHPublicKey(value) - except ValueError as UnicodeDecodeError: + except (ValueError, UnicodeDecodeError): return _('invalid SSH public key') def validate_sshpubkey_no_options(ugettext, value): try: pubkey = SSHPublicKey(value) - except ValueError as UnicodeDecodeError: + except (ValueError, UnicodeDecodeError): return _('invalid SSH public key') if pubkey.has_options(): @@ -304,7 +304,7 @@ def convert_sshpubkey_post(ldap, dn, entry_attrs): for pubkey in pubkeys: try: pubkey = SSHPublicKey(pubkey) - except ValueError as UnicodeDecodeError: + except (ValueError, UnicodeDecodeError): continue fp = pubkey.fingerprint_hex_md5() |