diff options
author | Eli Collins <elic@assurancetechnologies.com> | 2015-07-23 13:49:07 -0400 |
---|---|---|
committer | Eli Collins <elic@assurancetechnologies.com> | 2015-07-23 13:49:07 -0400 |
commit | 5d3229a432a48aa750f9c134ff33b49a12d31d5f (patch) | |
tree | ec5a2b2e8d3f26c318b9e67379e94610e93310af | |
parent | 9b6e2743dd2c542f70b4777c277fd3c1fc9ccd88 (diff) | |
download | passlib-5d3229a432a48aa750f9c134ff33b49a12d31d5f.tar.gz |
added PrefixWrapper.using() implementation which takes care of proxying
the using() call; and added PrefixWrapper.needs_update() proxy wrapper.
-rw-r--r-- | passlib/utils/handlers.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/passlib/utils/handlers.py b/passlib/utils/handlers.py index 3636829..f44acbb 100644 --- a/passlib/utils/handlers.py +++ b/passlib/utils/handlers.py @@ -892,7 +892,6 @@ class HasManyIdents(GenericHandler): # create subclasss subcls = super(HasManyIdents, cls).using(**kwds) - assert issubclass(subcls, cls) # add custom default ident if default_ident is not None: @@ -2008,6 +2007,18 @@ class PrefixWrapper(object): wrapped = self.prefix + hash[len(orig_prefix):] return uascii_to_str(wrapped) + def using(self, **kwds): + # generate subclass of wrapped handler + subcls = self.wrapped.using(**kwds) + if subcls is self.wrapped: + return self + # then create identical wrapper which wraps the new subclass. + return PrefixWrapper(self.name, subcls, prefix=self.prefix, orig_prefix=self.orig_prefix) + + def needs_update(self, hash, **kwds): + hash = self._unwrap_hash(hash) + return self.wrapped.needs_update(hash, **kwds) + def identify(self, hash): hash = to_unicode_for_identify(hash) if not hash.startswith(self.prefix): |