Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't assume id for primary key column #153

Open
jace opened this issue Jun 5, 2017 · 1 comment
Open

Don't assume id for primary key column #153

jace opened this issue Jun 5, 2017 · 1 comment

Comments

@jace
Copy link
Member

jace commented Jun 5, 2017

Baseframe forms provide an edit_id that is set to obj.id. As discussed in hasgeek/coaster#111, this is incorrect usage. edit_id should be deprecated in favour of an edit_identity value using the correct method. (We use a different name here since the value will change from a scalar to a tuple.) All references within Baseframe to edit_id must be replaced with edit_identity (for example in something like AvailableName).

@jace
Copy link
Member Author

jace commented Jun 5, 2017

Baseframe has two uses of edit_id.

  1. In forms/form.py, where the form constructor is notionally unaware of SQLAlchemy but checks if the object has an attribute named id. Introducing SQLAlchemy awareness seems like a bad idea here.

  2. In forms/sqlalchemy.py, in the AvailableAttr (previously AvailableName) validator, where edit_id could be replaced with the inspect approach, but where we also need to know the columns to test against in a query.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant