-
Notifications
You must be signed in to change notification settings - Fork 397
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
Introduce factory.declaration.Transformer #623
Introduce factory.declaration.Transformer #623
Conversation
7f3e50c
to
981dde5
Compare
I believe it would be best to make a minor release first, to get the small fixes from the past weeks out to users. Perhaps the release should be a Then, we can discuss integrating this work. |
@francoisfreitag what is the status on this? I think this is a great feature! Although I would change one part of the logic: Currently in
Then I would change the
|
The first step is to rewrite the example for
I don’t think we should |
Well for now, we always save the model when a post-generation hook was called, because it could have modified the object. I think we should change it so that every post-generation hook can determine if the
I made a suggestion to make your first assumption in the description of the ticket more likely to happen. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, I think this is a great idea. I find the save per postgeneration
hook to frequently be unnecessary overhead. Putting that control in hands of users is welcome, I think.
I'm a bit concerned that without being careful, some users will end up with differences in memory and their persistent storage system. But I think the tradeoff is ultimately worth it. As resolving this concern takes some attention, I agree that we increase a full revision.
981dde5
to
1298438
Compare
Changes:
|
1298438
to
be63501
Compare
be63501
to
136488c
Compare
Rebased on master with some tweaks to the changelog to make it clearer. I suggest squashing the changes in new commit “Deprecation plan”. I’m sure the change is going to cause disruption for users. The deprecation plan allows warning users about the upcoming disruption, giving them time adapt. What do you think? |
136488c
to
880d9e7
Compare
Without further feedback, I’ll take a last look at this patch in January and merge it. I’m happy to delay the merge if someone needs more time to review? |
Transforms a value using provided `transform` function. Values coming from the declaration and values overridden through keywords arguments are transformed before the generated object attribute is set. Removes the need to save objects with a post generation hook twice to the database. Facilitates overriding Django passwords when instantiating the factory. Fixes FactoryBoy#316 Fixes FactoryBoy#366
880d9e7
to
6003305
Compare
Transforms a value using provided
transform
function. Values coming from the declaration and values overridden through keywords arguments are transformed before the generated object attribute is set.Removes the need to save objects with a post generation hook twice to the database.
Facilitates overriding Django passwords when instantiating the factory.
Fixes #316
Fixes #366