diff options
author | Eli Collins <elic@assurancetechnologies.com> | 2020-10-07 14:46:57 -0400 |
---|---|---|
committer | Eli Collins <elic@assurancetechnologies.com> | 2020-10-07 14:46:57 -0400 |
commit | 7086228eec5138cd40d39e18c7a132b703d07cdc (patch) | |
tree | f94719c8916600054ac764a3100fa4d63404553b /passlib/exc.py | |
parent | d221b9006a1370a79bc19b8b645250d2bf35397c (diff) | |
download | passlib-7086228eec5138cd40d39e18c7a132b703d07cdc.tar.gz |
passlib.context: now raises UnknownHashError() if hash can't be identified.
this inherits from ValueError, and has same text, so backwards compatible.
Diffstat (limited to 'passlib/exc.py')
-rw-r--r-- | passlib/exc.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/passlib/exc.py b/passlib/exc.py index 4539c7d..755c7dc 100644 --- a/passlib/exc.py +++ b/passlib/exc.py @@ -193,17 +193,23 @@ class UnknownHashError(ValueError): As of version 1.7.3, this may also be raised if hash algorithm is known, but has been disabled due to FIPS mode (message will include phrase "disabled for fips"). + As of version 1.7.4, this may be raised if a :class:`~passlib.context.CryptContext` + is unable to identify the algorithm used by a password hash. + .. versionadded:: 1.7 .. versionchanged: 1.7.3 added 'message' argument. + + .. versionchanged:: 1.7.4 + altered call signature. """ - def __init__(self, name, message=None): - self.name = name + def __init__(self, message=None, value=None): + self.value = value if message is None: - message = "unknown hash algorithm: %r" % name + message = "unknown hash algorithm: %r" % value self.message = message - ValueError.__init__(self, name, message) + ValueError.__init__(self, message, value) def __str__(self): return self.message |