diff options
author | Eli Collins <elic@assurancetechnologies.com> | 2011-03-28 01:51:39 -0400 |
---|---|---|
committer | Eli Collins <elic@assurancetechnologies.com> | 2011-03-28 01:51:39 -0400 |
commit | 929f59a76b45ecd3101f5609493f3dd6e1fcd723 (patch) | |
tree | 588858bff51f221ba1f2524e5497fe4e78d97cfd /passlib/handlers/pbkdf2.py | |
parent | d477d89822dbfc94bc52bc569f5352ffe402a7c4 (diff) | |
download | passlib-929f59a76b45ecd3101f5609493f3dd6e1fcd723.tar.gz |
replaced "raise exc, msg" with "raise exc(msg)" everywhere (working on py3k compat, changes made by 2to3)
Diffstat (limited to 'passlib/handlers/pbkdf2.py')
-rw-r--r-- | passlib/handlers/pbkdf2.py | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/passlib/handlers/pbkdf2.py b/passlib/handlers/pbkdf2.py index 5b0426d..825f7e4 100644 --- a/passlib/handlers/pbkdf2.py +++ b/passlib/handlers/pbkdf2.py @@ -57,10 +57,10 @@ class Pbkdf2DigestHandler(ExtendedHandler): @classmethod def from_string(cls, hash): if not hash: - raise ValueError, "no hash specified" + raise ValueError("no hash specified") ident = cls._ident if not hash.startswith(ident): - raise ValueError, "invalid %s hash" % (cls.name,) + raise ValueError("invalid %s hash" % (cls.name,)) parts = hash[len(ident):].split("$") if len(parts) == 3: rounds, salt, chk = parts @@ -68,10 +68,10 @@ class Pbkdf2DigestHandler(ExtendedHandler): rounds, salt = parts chk = None else: - raise ValueError, "invalid %s hash" % (cls.name,) + raise ValueError("invalid %s hash" % (cls.name,)) int_rounds = int(rounds) if rounds != str(int_rounds): #forbid zero padding, etc. - raise ValueError, "invalid %s hash" % (cls.name,) + raise ValueError("invalid %s hash" % (cls.name,)) raw_salt = adapted_b64_decode(salt) raw_chk = adapted_b64_decode(chk) if chk else None return cls( @@ -194,13 +194,13 @@ class dlitz_pbkdf2_sha1(ExtendedHandler): @classmethod def from_string(cls, hash): if not hash: - raise ValueError, "no hash specified" + raise ValueError("no hash specified") m = cls._pat.match(hash) if not m: - raise ValueError, "invalid dlitz_pbkdf2_crypt hash" + raise ValueError("invalid dlitz_pbkdf2_crypt hash") rounds, salt, chk = m.group("rounds", "salt", "chk") if rounds.startswith("0"): #zero not allowed, nor left-padded with zeroes - raise ValueError, "invalid dlitz_pbkdf2_crypt hash" + raise ValueError("invalid dlitz_pbkdf2_crypt hash") rounds = int(rounds, 16) if rounds else 400 return cls( rounds=rounds, @@ -277,10 +277,10 @@ class grub_pbkdf2_sha512(ExtendedHandler): @classmethod def from_string(cls, hash): if not hash: - raise ValueError, "no hash specified" + raise ValueError("no hash specified") ident = cls._ident if not hash.startswith(ident): - raise ValueError, "invalid %s hash" % (cls.name,) + raise ValueError("invalid %s hash" % (cls.name,)) parts = hash[len(ident):].split(".") if len(parts) == 3: rounds, salt, chk = parts @@ -288,10 +288,10 @@ class grub_pbkdf2_sha512(ExtendedHandler): rounds, salt = parts chk = None else: - raise ValueError, "invalid %s hash" % (cls.name,) + raise ValueError("invalid %s hash" % (cls.name,)) int_rounds = int(rounds) if rounds != str(int_rounds): #forbid zero padding, etc. - raise ValueError, "invalid %s hash" % (cls.name,) + raise ValueError("invalid %s hash" % (cls.name,)) raw_salt = unhexlify(salt) raw_chk = unhexlify(chk) if chk else None return cls( |