Skip to content

Commit

Permalink
gracefully handle tracebacks when installing addons during site creation
Browse files Browse the repository at this point in the history
fixes #2228
  • Loading branch information
petschki committed Apr 15, 2019
1 parent c28e3a6 commit d7d0fe5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 11 additions & 2 deletions Products/CMFPlone/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from Products.CMFPlone.events import SiteManagerCreatedEvent
from Products.CMFPlone.interfaces import INonInstallable
from Products.GenericSetup.tool import SetupTool
from Products.statusmessages.interfaces import IStatusMessage
from plone.registry.interfaces import IRegistry
from zope.component import queryUtility
from zope.event import notify
Expand Down Expand Up @@ -163,8 +164,16 @@ def addPloneSite(context, site_id, title='Plone site', description='',
site.manage_changeProperties(**props)

for extension_id in extension_ids:
setup_tool.runAllImportStepsFromProfile(
'profile-%s' % extension_id)
try:
setup_tool.runAllImportStepsFromProfile(
'profile-%s' % extension_id)
except Exception as msg:
IStatusMessage(request).add(
'Could not install {}: {}\n'
'Please try to install it manually using the "Addons" '
'controlpanel and report any issues to the '
'addon maintainers'.format(extension_id, msg.args),
type='warning')

if snapshot is True:
setup_tool.createSnapshot('initial_configuration')
Expand Down
2 changes: 2 additions & 0 deletions news/2228.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
gracefully handle tracebacks during addon installation
[petschki]

0 comments on commit d7d0fe5

Please sign in to comment.