Replies: 1 comment 2 replies
-
In addition, I got the CLI to work and I tried to add a role and that worked, but adding permissions resulted in the same type unsupported error. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I've been trying to create a role with this line:
security.datastore.find_or_create_role(
name="admin",
description="Site Adminitrator",
permissions={"admin-read", "admin-write", "customer-read", "customer-write"},
)
The table has name/description/permissions fields as varargs.
I get this error:
(sqlite3.InterfaceError) Error binding parameter 2 - probably unsupported type.
[SQL: INSERT INTO application_roles (name, description, permissions) VALUES (?, ?, ?)]
[parameters: ('admin', 'Site Adminitrator', ['customer-write', 'admin-read', 'customer-read', 'admin-write'])]
Looking at the create_roles function, the permissions field is processes and sent to SQLAlchemy as a list. So this explains why I see a list in the last line in the error above.
The question is this: is SQLAlchemy having problems with sqlite specifically, or is this a bug in flask-security? In other words, why is create_roles sending a list of strings to SQLAlchemy?
Beta Was this translation helpful? Give feedback.
All reactions