Respect purge=False on simple field types#88
Conversation
When `purge=False` is set. Up until now, it was only the case for lists, tuples or dictionaries, but not for text, ASCII, URL etc.
|
@gforcada thanks for creating this Pull Request and helping to improve Plone! TL;DR: Finish pushing changes, pass all other checks, then paste a comment: To ensure that these changes do not break other parts of Plone, the Plone test suite matrix needs to pass, but it takes 30-60 min. Other CI checks are usually much faster and the Plone Jenkins resources are limited, so when done pushing changes and all other checks pass either start all Jenkins PR jobs yourself, or simply add the comment above in this PR to start all the jobs automatically. Happy hacking! |
|
@jenkins-plone-org please run jobs |
davisagli
left a comment
There was a problem hiding this comment.
I will definitely not approve this without documentation, because I am a little bit unclear on what you are trying to accomplish.
My initial assumption was that purge="False" on a simple value would mean "set this value, unless there is already a value for this field" (that would be a breaking change, btw, so I'm not sure we can do it).
But that's not what this implementation is doing. There's no change to what happens to an existing record if the new value is truthy. If it's falsy, it won't be set if the xml has purge="false". This doesn't make any sense to me.
|
I think the "purge" keyword only makes sense on fields that have lists of elements. For example the Tuple There you have these meanings:
For simple fields like TextLine or URI it currently overwrites the value, no matter what you have in purge. Changing this would be a breaking change for people like me who rely on the previous behavior. If I create an upgrade step/profile and set a new value for a registry record, I expect that this value is set and overwrites a previous value. I think what you want could only be done with a new keyword, something like
Maybe Additionally With |
Closes #73
🎉 Turns out that the fix is rather small and it's great to work on a repository that has good enough test coverage 🤩