diff options
| author | Eli Collins <elic@assurancetechnologies.com> | 2012-01-18 20:36:38 -0500 |
|---|---|---|
| committer | Eli Collins <elic@assurancetechnologies.com> | 2012-01-18 20:36:38 -0500 |
| commit | 6f816a3d7f1f3a394fedcc0aa410792a95b9ece6 (patch) | |
| tree | 66308581e5b36a60198cd8a0c8b8916ba271eda5 /passlib/handlers | |
| parent | a4a4d20ec8245f0e2763d08e6f00acbe343c854d (diff) | |
| download | passlib-6f816a3d7f1f3a394fedcc0aa410792a95b9ece6.tar.gz | |
split exceptions/warnings to separate module; added some additional warning classes to make filtering easier
Diffstat (limited to 'passlib/handlers')
| -rw-r--r-- | passlib/handlers/bcrypt.py | 11 | ||||
| -rw-r--r-- | passlib/handlers/scram.py | 4 |
2 files changed, 9 insertions, 6 deletions
diff --git a/passlib/handlers/bcrypt.py b/passlib/handlers/bcrypt.py index e30ffc3..9a1f595 100644 --- a/passlib/handlers/bcrypt.py +++ b/passlib/handlers/bcrypt.py @@ -26,6 +26,7 @@ try: except ImportError: #pragma: no cover - though should run whole suite w/o bcryptor installed bcryptor_engine = None #libs +from passlib.exc import PasslibHandlerWarning from passlib.utils import BCRYPT_CHARS as BCHARS, safe_os_crypt, \ classproperty, rng, getrandstr from passlib.utils.compat import bytes, u, uascii_to_str, unicode @@ -84,7 +85,7 @@ class bcrypt(uh.HasManyIdents, uh.HasRounds, uh.HasSalt, uh.HasManyBackends, uh. 3. stdlib's :func:`crypt.crypt()`, if the host OS supports BCrypt (eg: BSD). If no backends are available at runtime, - :exc:`~passlib.utils.MissingBackendError` will be raised + :exc:`~passlib.exc.MissingBackendError` will be raised whenever :meth:`encrypt` or :meth:`verify` are called. You can see which backend is in use by calling the :meth:`~passlib.utils.handlers.HasManyBackends.get_backend()` method. @@ -187,8 +188,8 @@ class bcrypt(uh.HasManyIdents, uh.HasRounds, uh.HasSalt, uh.HasManyBackends, uh. warn( "encountered a bcrypt hash with incorrectly set padding bits; " "you may want to use bcrypt.normhash() " - "to fix this; see Passlib 1.5.3 changelog." - ) + "to fix this; see Passlib 1.5.3 changelog.", + PasslibHandlerWarning) return salt @classmethod @@ -200,8 +201,8 @@ class bcrypt(uh.HasManyIdents, uh.HasRounds, uh.HasSalt, uh.HasManyBackends, uh. warn( "encountered a bcrypt hash with incorrectly set padding bits; " "you may want to use bcrypt.normhash() " - "to fix this; see Passlib 1.5.3 changelog." - ) + "to fix this; see Passlib 1.5.3 changelog.", + PasslibHandlerWarning) return checksum #========================================================= diff --git a/passlib/handlers/scram.py b/passlib/handlers/scram.py index 1ff33b1..af3481f 100644 --- a/passlib/handlers/scram.py +++ b/passlib/handlers/scram.py @@ -23,6 +23,7 @@ import logging; log = logging.getLogger(__name__) from warnings import warn #site #libs +from passlib.exc import PasslibHandlerWarning from passlib.utils import ab64_decode, ab64_encode, consteq, saslprep, \ to_native_str, xor_bytes from passlib.utils.compat import b, bytes, bascii_to_str, iteritems, \ @@ -110,7 +111,8 @@ def norm_digest_name(name): # (and digest probably won't be found) m = re.match("^([a-z]{2,}\d?)(-\d{3,4})?$", name) if not m: - warn("encountered oddly named digest: %r" % (name,)) + warn("encountered oddly named digest: %r" % (name,), + PasslibWarning) # store in cache _ndn_cache[key] = name |
