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

api.content.create fails to create a Plone4 AT Collection #413

Closed
gbastien opened this issue Sep 4, 2018 · 6 comments
Closed

api.content.create fails to create a Plone4 AT Collection #413

gbastien opened this issue Sep 4, 2018 · 6 comments

Comments

@gbastien
Copy link
Member

gbastien commented Sep 4, 2018

Hi everybody, @david-batranu

it fails in archetypes/querywidget/widget.py because the form given to process_form is {None: None} and values are not iterable.

This is due to a recent change, so either we change {None: None} to {'': ''} or we have to change archetypes.querywidget. Would {'': ''} sove your problem @david-batranu because it solves our ;-)

Thank you!

Gauthier

@hvelarde
Copy link
Member

hvelarde commented Sep 4, 2018

please be careful when fixing this or we could find an issue similar with the one I described in #407.

@gbastien
Copy link
Member Author

gbastien commented Sep 4, 2018

Hi @hvelarde

I will add a test to plone.api showing the issue. Actually a simple create fails, we could also fix it in archetypes.querywidget but that does not seems correct to me. I will add a test that creates every ATCT default types.

Thank you for advice,

Gauthier

@hvelarde
Copy link
Member

hvelarde commented Sep 4, 2018

@gbastien we already created a failing test on the referenced pull request.

@david-batranu
Copy link
Member

@gbastien A lot of time has passed, and don't remember exactly why I chose {None: None} as the "empty" value.

The purpose of the fix was for the if in BaseObject.process_form to pass, so that form = values instead of getting polluted by the request.form data. Looks like {'': ''} would pass this check as well. I'm not sure of any side-effects. I guess if the tests pass, it's ok :)

All of my findings are described on #99 (comment)

@gbastien
Copy link
Member Author

gbastien commented Sep 5, 2018

@david-batranu

thank you for feedback, I think {'':''} will have the same behavior and it solves the problem... I proposed this change to @idgserpro and @hvelarde

Gauthier

@hvelarde
Copy link
Member

fixed in #414

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

No branches or pull requests

3 participants