compile scheme list using a generator

master
Alexander Graf 3 years ago
parent 0772e172ff
commit 3f91dcb7af

@ -507,13 +507,13 @@ class User(Base, Email):
if cls._ctx: if cls._ctx:
return cls._ctx return cls._ctx
schemes = passlib.registry.list_crypt_handlers() # compile schemes
# scrypt throws a warning if the native wheels aren't found # - scrypt throws a warning if the native wheels aren't found
schemes.remove('scrypt') # - we can't leave plaintext schemes as they will be misidentified
# we can't leave plaintext schemes as they will be misidentified schemes = [
for scheme in schemes: scheme for scheme in passlib.registry.list_crypt_handlers()
if scheme.endswith('plaintext'): if not (scheme == 'scrypt' or scheme.endswith('plaintext'))
schemes.remove(scheme) ]
cls._ctx = passlib.context.CryptContext( cls._ctx = passlib.context.CryptContext(
schemes=schemes, schemes=schemes,
default='bcrypt_sha256', default='bcrypt_sha256',

Loading…
Cancel
Save