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

plone-upgrade to 5.0.3 shows plain text as result #1436

Closed
mauritsvanrees opened this issue Mar 4, 2016 · 5 comments · Fixed by #1438
Closed

plone-upgrade to 5.0.3 shows plain text as result #1436

mauritsvanrees opened this issue Mar 4, 2016 · 5 comments · Fixed by #1438

Comments

@mauritsvanrees
Copy link
Member

This is caused by plone/plone.app.upgrade#67 by @vangheem, though this change looks fine to me.

With the above change, when running @@plone-upgrade, even with dry-run selected, the result page is shown as text: you see plain html. Very strange. Reported here: https://community.plone.org/t/plone-5-0-3-soft-released/1699/4
When I empty the registry.xml, keeping only the main registry tags for safety, it all works fine. Keeping one of the two changed records, it again shows as text.

To check it:

  • Use current coredev 5.0
  • Create a Plone Site.
  • Simulate a Plone 5.0.2 site: in portal_setup, Upgrades, select Products.CMFPlone:plone, and run the to502 upgrade profile.
  • Go to @@plone-upgrade, optionally select dry-run, and run the upgrade.

Result: it will show as plain text.
BTW, afterwards, all is fine: the migration has succeeded and it looks like all pages show up fine.

Any idea?

@mauritsvanrees
Copy link
Member Author

BTW, if I copy-paste this plain html in a file and view it with a browser, it shows up just fine. I guess the registry.xml changes trigger a text/plain response header.

@tomgross
Copy link
Member

tomgross commented Mar 4, 2016

I can confirm this issue

@mauritsvanrees
Copy link
Member Author

I had another look. It is actually not text/plain, but application/javascript. The header is set here:

https://github.com/plone/Products.CMFPlone/blob/master/Products/CMFPlone/resources/browser/configjs.py#L97

With a pdb, this is the stack trace:

  /Users/maurits/community/plone-coredev/5.0/src/plone.app.upgrade/plone/app/upgrade/v50/final.py(97)to503()
-> loadMigrationProfile(context, 'profile-plone.app.upgrade.v50:to503')
  /Users/maurits/community/plone-coredev/5.0/src/plone.app.upgrade/plone/app/upgrade/utils.py(134)loadMigrationProfile()
-> context.runAllImportStepsFromProfile(profile, purge_old=False)
  /Users/maurits/shared-eggs/Products.GenericSetup-1.8.2-py2.7.egg/Products/GenericSetup/tool.py(379)runAllImportStepsFromProfile()
-> dependency_strategy=dependency_strategy)
  /Users/maurits/shared-eggs/Products.GenericSetup-1.8.2-py2.7.egg/Products/GenericSetup/tool.py(1414)_runImportStepsFromContext()
-> message = self._doRunImportStep(step, context)
  /Users/maurits/shared-eggs/Products.GenericSetup-1.8.2-py2.7.egg/Products/GenericSetup/tool.py(1226)_doRunImportStep()
-> return handler(context)
  /Users/maurits/community/plone-coredev/5.0/src/Products.CMFPlone/Products/CMFPlone/resources/exportimport/bundles.py(19)combine()
-> combine_bundles(site)
  /Users/maurits/community/plone-coredev/5.0/src/Products.CMFPlone/Products/CMFPlone/resources/browser/combine.py(107)combine_bundles()
-> write_js(context, production_folder, 'default')
  /Users/maurits/community/plone-coredev/5.0/src/Products.CMFPlone/Products/CMFPlone/resources/browser/combine.py(59)write_js()
-> registry.records['plone.resources.configjs'].value))
  /Users/maurits/community/plone-coredev/5.0/src/Products.CMFPlone/Products/CMFPlone/resources/browser/combine.py(43)get_resource()
-> return resource()
  /Users/maurits/community/plone-coredev/5.0/src/Products.CMFPlone/Products/CMFPlone/resources/browser/configjs.py(97)__call__()
-> "application/javascript")

So when the bundles import step needs to do something (as in the condition in this line: https://github.com/plone/Products.CMFPlone/blob/master/Products/CMFPlone/resources/exportimport/bundles.py#L17) it has the side effect of making the plone-upgrade result page show up as plain text.

@ebrehault is this something you can take a look at, since this is part of plip #1277?
Maybe pass an extra parameter around that prevents calling setHeader?

@mauritsvanrees
Copy link
Member Author

I wondered why I do not see this when doing the same upgrade in portal_setup. The reason is simple. I can see with a pdb that the header is set to application/javascript as well, but then GenericSetup does a redirect to the manage_upgrades page, and on this new request the header is normal again.

mauritsvanrees added a commit that referenced this issue Mar 4, 2016
It would be set to application/javascript.  This would result
in the plone-upgrade result page being shown in plain text.

Fixes #1436
mauritsvanrees added a commit that referenced this issue Mar 4, 2016
It would be set to application/javascript.  This would result
in the plone-upgrade result page being shown in plain text.

Fixes #1436
mauritsvanrees added a commit that referenced this issue Mar 5, 2016
It would be set to application/javascript.  This would result
in the plone-upgrade result page being shown in plain text.

Fixes #1436
@mauritsvanrees mauritsvanrees self-assigned this Mar 5, 2016
@ebrehault
Copy link
Member

@mauritsvanrees thank you for fixing this

esteele pushed a commit that referenced this issue Mar 29, 2016
It would be set to application/javascript.  This would result
in the plone-upgrade result page being shown in plain text.

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

Successfully merging a pull request may close this issue.

3 participants