summaryrefslogtreecommitdiff
path: root/passlib/utils
diff options
context:
space:
mode:
authorEli Collins <elic@assurancetechnologies.com>2012-04-11 19:31:37 -0400
committerEli Collins <elic@assurancetechnologies.com>2012-04-11 19:31:37 -0400
commit046cfe8a3489ccf87e06a5a9982b283eb71945b0 (patch)
tree1d9fd914de2826d339b3893ff5b8457efa2ac714 /passlib/utils
parent2183916ae35ca69fcf3c7d1550d096488e51a9a8 (diff)
downloadpasslib-046cfe8a3489ccf87e06a5a9982b283eb71945b0.tar.gz
ran full UTs, found and fixed a few bugs introduced in last few commits.
Diffstat (limited to 'passlib/utils')
-rw-r--r--passlib/utils/__init__.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/passlib/utils/__init__.py b/passlib/utils/__init__.py
index b9ee776..e0b9e75 100644
--- a/passlib/utils/__init__.py
+++ b/passlib/utils/__init__.py
@@ -548,6 +548,7 @@ def to_bytes(source, encoding="utf-8", errname="value", source_encoding=None):
* if *source_encoding* is specified, byte strings will be transcoded
to *encoding*.
"""
+ assert encoding
if isinstance(source, bytes):
if source_encoding and not is_same_codec(source_encoding, encoding):
return source.decode(source_encoding).encode(encoding)
@@ -579,6 +580,7 @@ def to_unicode(source, source_encoding="utf-8", errname="value"):
if isinstance(source, unicode):
return source
elif isinstance(source, bytes):
+ assert source_encoding
return source.decode(source_encoding)
else:
raise ExpectedStringError(source, errname)