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

prevent validators from getting inserted twice #1099

Merged
merged 1 commit into from
Oct 27, 2015

Conversation

pawl
Copy link
Contributor

@pawl pawl commented Oct 27, 2015

Fixes #1094

When kwargs in convert() is updated with field_args (really self.form_args), only a referenced to mutable objects in self.form_args are copied. So, modifying kwargs can also modify mutable objects in the overridden self.form_args. Validators like Unique will be added to self.form_args once when the edit form is created, then duplicated when the create form is created.

The solution is to create a deepcopy of field_args to prevent the rest of that code from modifying self.form_args.

Also submitted a pull request to wtf-peewee here: coleifer/wtf-peewee#30

mrjoes added a commit that referenced this pull request Oct 27, 2015
prevent validators from getting inserted twice
@mrjoes mrjoes merged commit 113a45c into pallets-eco:master Oct 27, 2015
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

sqla.Unique validator is inserted twice
2 participants