You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
user_datastore.create_user will mutate mutable inputs:
roles = ["Admin"]
user_datastore.create_user(username="admin", password=hash_password("admin"), roles=roles)
# now roles is [Role("Admin")] instead of ["Admin"]
This is because _prepare_create_user_args writes to roles:
This can cause issues in situations where a string is always expected, e.g. in a test environment where a set of expected users may be persisted for longer than each database session (and thus the new Role values will be expired in the next session).
The text was updated successfully, but these errors were encountered:
user_datastore.create_user
will mutate mutable inputs:This is because
_prepare_create_user_args
writes toroles
:flask-security/flask_security/datastore.py
Lines 208 to 214 in e387811
This can cause issues in situations where a string is always expected, e.g. in a test environment where a set of expected users may be persisted for longer than each database session (and thus the new Role values will be expired in the next session).
The text was updated successfully, but these errors were encountered: