def render_item(type_, col, autogen_context):
if type_ == "type" and isinstance(col, PasswordType):
autogen_context.imports.add("import sqlalchemy_utils")
return "sqlalchemy_utils.PasswordType"
else:
return False
python类PasswordType()的实例源码
def __init__(self, max_length=None, **kwargs):
# Fail if passlib is not found.
if passlib is None:
raise ImproperlyConfigured(
"'passlib' is required to use 'PasswordType'"
)
# Construct the passlib crypt context.
self.context = LazyCryptContext(**kwargs)
self._max_length = max_length