summaryrefslogtreecommitdiff
path: root/passlib/exc.py
diff options
context:
space:
mode:
authorEli Collins <elic@assurancetechnologies.com>2013-12-27 14:10:07 -0500
committerEli Collins <elic@assurancetechnologies.com>2013-12-27 14:10:07 -0500
commit97216e14e96d5e8414946be29fe5f50673124d65 (patch)
tree71433321c66db55f7274bd2cf6410cfd1370be48 /passlib/exc.py
parentbcdf0cd2a97fa8dfb4cc06352faa0934ccbf236b (diff)
downloadpasslib-97216e14e96d5e8414946be29fe5f50673124d65.tar.gz
style cleanups (transplant of rc94c6072a652 in default)
Diffstat (limited to 'passlib/exc.py')
-rw-r--r--passlib/exc.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/passlib/exc.py b/passlib/exc.py
index 60dae90..daac72a 100644
--- a/passlib/exc.py
+++ b/passlib/exc.py
@@ -116,7 +116,7 @@ def _get_name(handler):
# generic helpers
#------------------------------------------------------------------------
def type_name(value):
- "return pretty-printed string containing name of value's type"
+ """return pretty-printed string containing name of value's type"""
cls = value.__class__
if cls.__module__ and cls.__module__ not in ["__builtin__", "builtins"]:
return "%s.%s" % (cls.__module__, cls.__name__)
@@ -126,26 +126,26 @@ def type_name(value):
return cls.__name__
def ExpectedTypeError(value, expected, param):
- "error message when param was supposed to be one type, but found another"
+ """error message when param was supposed to be one type, but found another"""
# NOTE: value is never displayed, since it may sometimes be a password.
name = type_name(value)
return TypeError("%s must be %s, not %s" % (param, expected, name))
def ExpectedStringError(value, param):
- "error message when param was supposed to be unicode or bytes"
+ """error message when param was supposed to be unicode or bytes"""
return ExpectedTypeError(value, "unicode or bytes", param)
#------------------------------------------------------------------------
# encrypt/verify parameter errors
#------------------------------------------------------------------------
def MissingDigestError(handler=None):
- "raised when verify() method gets passed config string instead of hash"
+ """raised when verify() method gets passed config string instead of hash"""
name = _get_name(handler)
return ValueError("expected %s hash, got %s config string instead" %
(name, name))
def NullPasswordError(handler=None):
- "raised by OS crypt() supporting hashes, which forbid NULLs in password"
+ """raised by OS crypt() supporting hashes, which forbid NULLs in password"""
name = _get_name(handler)
return ValueError("%s does not allow NULL bytes in password" % name)
@@ -153,25 +153,25 @@ def NullPasswordError(handler=None):
# errors when parsing hashes
#------------------------------------------------------------------------
def InvalidHashError(handler=None):
- "error raised if unrecognized hash provided to handler"
+ """error raised if unrecognized hash provided to handler"""
return ValueError("not a valid %s hash" % _get_name(handler))
def MalformedHashError(handler=None, reason=None):
- "error raised if recognized-but-malformed hash provided to handler"
+ """error raised if recognized-but-malformed hash provided to handler"""
text = "malformed %s hash" % _get_name(handler)
if reason:
text = "%s (%s)" % (text, reason)
return ValueError(text)
def ZeroPaddedRoundsError(handler=None):
- "error raised if hash was recognized but contained zero-padded rounds field"
+ """error raised if hash was recognized but contained zero-padded rounds field"""
return MalformedHashError(handler, "zero-padded rounds")
#------------------------------------------------------------------------
# settings / hash component errors
#------------------------------------------------------------------------
def ChecksumSizeError(handler, raw=False):
- "error raised if hash was recognized, but checksum was wrong size"
+ """error raised if hash was recognized, but checksum was wrong size"""
# TODO: if handler.use_defaults is set, this came from app-provided value,
# not from parsing a hash string, might want different error msg.
checksum_size = handler.checksum_size