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

migration is always true #247

Open
yurj opened this issue Jul 31, 2024 · 2 comments
Open

migration is always true #247

yurj opened this issue Jul 31, 2024 · 2 comments

Comments

@yurj
Copy link

yurj commented Jul 31, 2024

looking at the request, if the "Modify exported data for migrations" is unchecked, it misses the "migration". If missing, the default is True. If checked, it is True. So it is always True!

This mean that a lot of fields will be missing (particularly the relation choice fields)/changed even if this option is not chosen.

@pbauer do you agree? Maybe this is something related on how Zope consider boolean fields?

@yurj
Copy link
Author

yurj commented Jul 31, 2024

See https://6.docs.plone.org/backend/upgrading/version-specific-migration/upgrade-to-60.html?highlight=ticking#boolean-fields

"Since zope.schema==6.1.0, all zope.schema.Bool fields must have a required=False attribute. This allows you to either tick or not tick the checkbox, submit the form, and process the field with either its value when ticked or None when unticked. Otherwise, you can't save the form without ticking the checkbox, which effectively makes the field value always True."

Note: the browserview default is True...

@petschki
Copy link
Member

Two things:

  1. @yurj is right, that self.migration is always true because if you uncheck the checkbox, its missing in self.request.form and therefore defaults to True always -> simple fix: change migration=False in the __call__ to opt-in migration instead of opt-out.

  2. This has nothing to do with the zope.schema.Bool problem, because the @@export_content view template is a hand-crafted form and not generated from a schema.

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

2 participants