diff options
| author | Eli Collins <elic@assurancetechnologies.com> | 2011-12-28 17:26:04 -0500 |
|---|---|---|
| committer | Eli Collins <elic@assurancetechnologies.com> | 2011-12-28 17:26:04 -0500 |
| commit | fec9d1c45fcd201eea26f5ce276825302f10dce0 (patch) | |
| tree | 4381eb3b2321d4dd8ac0814b9fff046864cfdbed /passlib/registry.py | |
| parent | 9d1ca56acb757a034d66eb0b97acf0ca06245146 (diff) | |
| download | passlib-fec9d1c45fcd201eea26f5ce276825302f10dce0.tar.gz | |
removed Undef singleton, private _NOTSET singletons are cleaner.
Diffstat (limited to 'passlib/registry.py')
| -rw-r--r-- | passlib/registry.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/passlib/registry.py b/passlib/registry.py index 31f5b74..06a70ee 100644 --- a/passlib/registry.py +++ b/passlib/registry.py @@ -9,7 +9,7 @@ import logging; log = logging.getLogger(__name__) from warnings import warn #site #libs -from passlib.utils import Undef, is_crypt_handler +from passlib.utils import is_crypt_handler #pkg #local __all__ = [ @@ -259,7 +259,9 @@ def register_crypt_handler(handler, force=False, name=None): _handlers[name] = handler log.info("registered crypt handler %r: %r", name, handler) -def get_crypt_handler(name, default=Undef): +_NOTSET = object() + +def get_crypt_handler(name, default=_NOTSET): """return handler for specified password hash scheme. this method looks up a handler for the specified scheme. @@ -314,7 +316,7 @@ def get_crypt_handler(name, default=Undef): return handler #fail! - if default is Undef: + if default is _NOTSET: raise KeyError("no crypt handler found for algorithm: %r" % (name,)) else: return default |
