summaryrefslogtreecommitdiff
path: root/passlib/base.py
diff options
context:
space:
mode:
authorEli Collins <elic@assurancetechnologies.com>2011-03-05 12:26:12 -0500
committerEli Collins <elic@assurancetechnologies.com>2011-03-05 12:26:12 -0500
commite69cdbd7d5927befa0cb708e787c730c73c032e2 (patch)
treeefaef09e93ecb271ff57f797610da48d70eb0a84 /passlib/base.py
parentebcfd341a99584504e34ea66dbeaef0b1e503307 (diff)
downloadpasslib-e69cdbd7d5927befa0cb708e787c730c73c032e2.tar.gz
fixed wart - CryptContext now searches schemes in order, instead of reverse order (and default is now first option)
Diffstat (limited to 'passlib/base.py')
-rw-r--r--passlib/base.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/passlib/base.py b/passlib/base.py
index dece565..db76da7 100644
--- a/passlib/base.py
+++ b/passlib/base.py
@@ -412,7 +412,7 @@ class CryptPolicy(object):
handlers = self._handlers = []
seen = set()
schemes = options[None]['context'].get("schemes") or []
- for scheme in reversed(schemes): #NOTE: reversed() just so last entry is used as default, and is checked first.
+ for scheme in schemes:
#resolve & validate handler
if is_crypt_handler(scheme):
handler = scheme
@@ -631,7 +631,7 @@ class CryptPolicy(object):
#
value = self._handlers
if value:
- yield format_key(None, None, "schemes"), encode_hlist(reversed(value))
+ yield format_key(None, None, "schemes"), encode_hlist(value)
for cat, value in self._deprecated.iteritems():
yield format_key(cat, None, "deprecated"), encode_hlist(value)
@@ -709,7 +709,7 @@ class CryptContext(object):
>>> from passlib import hash
>>> #create a new context that only understands Md5Crypt & BCrypt
- >>> myctx = hash.CryptContext([ hash.Md5Crypt, hash.BCrypt ])
+ >>> myctx = hash.CryptContext([ hash.BCrypt, hash.Md5Crypt, ])
>>> #the last one in the list will be used as the default for encrypting...
>>> hash1 = myctx.encrypt("too many secrets")