diff options
author | Eli Collins <elic@assurancetechnologies.com> | 2012-04-17 23:14:51 -0400 |
---|---|---|
committer | Eli Collins <elic@assurancetechnologies.com> | 2012-04-17 23:14:51 -0400 |
commit | 64ab6fc89b497efa9169f11d55251e417c4db0ba (patch) | |
tree | b3f6f5dc27b87a6bc90cb3686fa98239ee8ff053 /passlib/registry.py | |
parent | 8eb4c4d3b58eec6802c698ddbf357b2fd243a68c (diff) | |
parent | cd029846fdc0c3d7ffc7f53caad4579e7e0e8725 (diff) | |
download | passlib-ironpython-support-dev.tar.gz |
Merge from defaultironpython-support-dev
Diffstat (limited to 'passlib/registry.py')
-rw-r--r-- | passlib/registry.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/passlib/registry.py b/passlib/registry.py index 662c9d1..627ebe9 100644 --- a/passlib/registry.py +++ b/passlib/registry.py @@ -105,6 +105,7 @@ _handler_locations = { "hex_sha1": ("passlib.handlers.digests", "hex_sha1"), "hex_sha256": ("passlib.handlers.digests", "hex_sha256"), "hex_sha512": ("passlib.handlers.digests", "hex_sha512"), + "htdigest": ("passlib.handlers.digests", "htdigest"), "ldap_plaintext": ("passlib.handlers.ldap_digests","ldap_plaintext"), "ldap_md5": ("passlib.handlers.ldap_digests","ldap_md5"), "ldap_sha1": ("passlib.handlers.ldap_digests","ldap_sha1"), @@ -155,7 +156,7 @@ _handler_locations = { _name_re = re.compile("^[a-z][_a-z0-9]{2,}$") #: names which aren't allowed for various reasons (mainly keyword conflicts in CryptContext) -_forbidden_names = frozenset(["policy", "context", "all", "default", "none"]) +_forbidden_names = frozenset(["onload", "policy", "context", "all", "default", "none"]) #========================================================== #registry frontend functions @@ -288,10 +289,11 @@ def get_crypt_handler(name, default=_NOTSET): """ global _handlers, _handler_locations - #check if handler loaded - handler = _handlers.get(name) - if handler: - return handler + #check if handler is already loaded + try: + return _handlers[name] + except KeyError: + pass #normalize name (and if changed, check dict again) assert isinstance(name, str), "name must be str instance" |