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

Only keep already uploaded image when it is a POST request #38

Merged
merged 3 commits into from
Mar 26, 2019

Conversation

mauritsvanrees
Copy link
Member

Fixes auto csrf error in site-controlpanel (plone/Products.CMFPlone#2628) and personal-information (plone/Products.CMFPlone#2709) page.

Those two errors are gone when I revert to plone.formwidget.namedfile 2.0.5, so it is introduced by the new feature from PR #32 like @pbauer suspected.

When I see it correctly, that feature is only useful on POST requests. That is what this PR does.

…t is a POST request.

Fixes auto csrf error in site-controlpanel (plone/Products.CMFPlone#2628)
and personal-information (plone/Products.CMFPlone#2709) page.
@mauritsvanrees mauritsvanrees requested a review from thet March 22, 2019 21:56
@mister-roboto
Copy link

@mauritsvanrees thanks for creating this Pull Request and help improve Plone!

To ensure that these changes do not break other parts of Plone, the Plone test suite matrix needs to pass.

Whenever you feel that the pull request is ready to be tested, either start all jenkins jobs pull requests by yourself, or simply add a comment in this pull request stating:

@jenkins-plone-org please run jobs

With this simple comment all the jobs will be started automatically.

Happy hacking!

@mauritsvanrees
Copy link
Member Author

@jenkins-plone-org please run jobs

With a new request, we should instantiate a new widget and call update and extract on it.
Otherwise for example a file_upload_id can linger from a previous call.
There was a small mistake on Python 2: we basically set 'got = want', which meant the doctests always passed...
@mauritsvanrees
Copy link
Member Author

@jenkins-plone-org please run jobs

@mauritsvanrees
Copy link
Member Author

The Python 2 tests were passing but Python 3 was failing, and I discovered that this was because the Py23DocChecker normalizer class had an error which made all tests pass on Python 2... I fixed that.

@thet Would you agree that your feature for keeping already uploaded files in case of a validation error, is only needed on POST requests, and can be switched off on other requests, like I do in this PR?

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

Successfully merging this pull request may close these issues.

3 participants