summaryrefslogtreecommitdiff
path: root/passlib/registry.py
diff options
context:
space:
mode:
authorEli Collins <elic@assurancetechnologies.com>2012-04-17 15:34:14 -0400
committerEli Collins <elic@assurancetechnologies.com>2012-04-17 15:34:14 -0400
commite56e08c56ea0a4a8ac45aff7bfcd39d351e04e53 (patch)
tree00b170736effd3ec37cfd96ab21a0af8e1707913 /passlib/registry.py
parentd1932877f847c74d20c7e5311a4dd91c2b6d03f0 (diff)
downloadpasslib-e56e08c56ea0a4a8ac45aff7bfcd39d351e04e53.tar.gz
CryptPolicy deprecated, part2 - updated rest of library to use CryptContext directly
Diffstat (limited to 'passlib/registry.py')
-rw-r--r--passlib/registry.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/passlib/registry.py b/passlib/registry.py
index 908c23b..627ebe9 100644
--- a/passlib/registry.py
+++ b/passlib/registry.py
@@ -156,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
@@ -289,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"