-
-
Notifications
You must be signed in to change notification settings - Fork 196
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
Add Plone Site: do a transaction commit before profiles #2410
Add Plone Site: do a transaction commit before profiles #2410
Conversation
…ra profiles. This avoids errors in some cases when selecting add-ons in the advanced Plone Site add form, where installing them right after site creation in the add-ons control panel goes fine. Fixes #2316
5c8f597
to
4be00d0
Compare
LGTM |
+1 for backporting this to Plone 5.1 |
Is it appropriate to commit here? addPloneSite() is supposed to be transactional. An error at some point of the setup procedure should not leave any traces...so what happens if an error occurs after the commit? |
Then you have a Plone Site without add-ons. That is probably acceptable here. The only thing that happens after applying the extra profiles, is a redirect to the Plone Site url: And... actually it should return an empty string after setting the redirect. Currently it also calls |
I don't think that it is acceptable...everything can happen during during the extensions profile after the commit. This will of course produce a naked Plone site but it would not produce what you expect. There is an unwritten contract that you should not commit yourself in Zope and Plone because this is handled by the ZPublisher. In that sense: |
Ah, I found the other issue that I was looking for: #2228 |
I had another look and I see that the transaction commit doesn't really help. It only avoids printing several tracebacks, so that you are more likely to notice the original traceback that was always visible if you cared to scroll up far enough. I will revert this PR. |
Directly reverted on master in 4e67724. |
Branch: refs/heads/master Date: 2018-05-14T14:49:18+02:00 Author: Maurits van Rees (mauritsvanrees) <[email protected]> Commit: plone/Products.CMFPlone@7fddf58 After site creation, do not render the add-site template: we redirect anyway. See also plone/Products.CMFPlone#2410 (comment) Files changed: M CHANGES.rst M Products/CMFPlone/browser/admin.py Repository: Products.CMFPlone Branch: refs/heads/master Date: 2018-05-14T17:00:10+02:00 Author: Jens W. Klein (jensens) <[email protected]> Commit: plone/Products.CMFPlone@3936c29 Merge pull request #2413 from plone/add-plonesite-no-useless-render-master After site creation, do not render a template: we redirect anyway [5.2] Files changed: M CHANGES.rst M Products/CMFPlone/browser/admin.py
Branch: refs/heads/5.1.x Date: 2018-05-14T14:59:34+02:00 Author: Maurits van Rees (mauritsvanrees) <[email protected]> Commit: plone/Products.CMFPlone@2b021c5 After site creation, do not render the add-site template: we redirect anyway. See also plone/Products.CMFPlone#2410 (comment) Files changed: M CHANGES.rst M Products/CMFPlone/browser/admin.py Repository: Products.CMFPlone Branch: refs/heads/5.1.x Date: 2018-05-14T17:00:44+02:00 Author: Jens W. Klein (jensens) <[email protected]> Commit: plone/Products.CMFPlone@dc27a82 Merge pull request #2414 from plone/add-plonesite-no-useless-render-51 After site creation, do not render a template: we redirect anyway [5.1] Files changed: M CHANGES.rst M Products/CMFPlone/browser/admin.py
When adding a Plone Site, do a transaction commit before applying extra profiles. This avoids errors in some cases when selecting add-ons in the advanced Plone Site add form, where installing them right after site creation in the add-ons control panel goes fine.
It should certainly fix some CSRF autoprotection errors raised by the first view after creating a Plone Site.
Fixes #2316.
And I think there was a similar issue raised recently, but I cannot find it.
Note for tests: since this does a transaction commit, any test code that calls
addPloneSite
should use a functional test layer, to avoid leakage into other tests. Case in point is an initial test failure in CMFPlone itself:I fixed that in the PR by adding a condition: when no extra profiles are selected, don't do a commit.
Only two test files in CMFPlone call
addPloneSite
directly, plus of courseplone.app.testing
in test layer setup, so this should not normally cause problems.This PR is for master (5.2). I can port it to other versions once approved. I would say: only 5.1.