We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
AttributeError: 'PersistentAdapterRegistry' object has no attribute 'lookupAll'
The following error is raised in Plone 5.1 when you try to install a new Plone site with an add-on where the Dexterity content-class could not be imported properly e.g. for some NameError in my case.

In particular this error message shadows the primary problem. It seems to me that some errors in the bootstrapping phase of Plone or inside of GS are just swallowed.

```
2017-11-30 11:29:03 ERROR txn.140599418205952 Failed to abort resource manager: <Products.CMFCore.indexing.QueueTM object at 0x7fdfddecbd50>
Traceback (most recent call last):
  File "/home/ajung/.buildout/eggs/transaction-2.1.2-py2.7.egg/transaction/_transaction.py", line 514, in abort
    rm.abort(self)
  File "/home/ajung/.buildout/eggs/Products.CMFCore-2.2.12-py2.7.egg/Products/CMFCore/indexing.py", line 321, in tpc_abort
    self.queue.abort()
  File "/home/ajung/.buildout/eggs/Products.CMFCore-2.2.12-py2.7.egg/Products/CMFCore/indexing.py", line 237, in abort
    for name, util in sm.getUtilitiesFor(IIndexQueueProcessor):
  File "/home/ajung/.buildout/eggs/zope.interface-4.4.2-py2.7-linux-x86_64.egg/zope/interface/registry.py", line 290, in getUtilitiesFor
    for name, utility in self.utilities.lookupAll((), interface):
AttributeError: 'PersistentAdapterRegistry' object has no attribute 'lookupAll'
```

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `Products/CMFPlone/factory.py`
Content:
```
1 # -*- coding: utf-8 -*-
2 from Products.CMFPlone.Portal import PloneSite
3 from Products.CMFPlone.events import SiteManagerCreatedEvent
4 from Products.CMFPlone.interfaces import INonInstallable
5 from Products.GenericSetup.tool import SetupTool
6 from plone.registry.interfaces import IRegistry
7 from zope.component import queryUtility
8 from zope.event import notify
9 from zope.interface import implementer
10 from zope.site.hooks import setSite
11 
12 _TOOL_ID = 'portal_setup'
13 _DEFAULT_PROFILE = 'Products.CMFPlone:plone'
14 _CONTENT_PROFILE = 'plone.app.contenttypes:plone-content'
15 
16 # A little hint for PloneTestCase
17 _IMREALLYPLONE5 = True
18 
19 
20 @implementer(INonInstallable)
21 class NonInstallable(object):
22 
23     def getNonInstallableProducts(self):
24         return [
25             'Archetypes', 'Products.Archetypes',
26             'CMFDefault', 'Products.CMFDefault',
27             'CMFPlone', 'Products.CMFPlone', 'Products.CMFPlone.migrations',
28             'CMFTopic', 'Products.CMFTopic',
29             'CMFUid', 'Products.CMFUid',
30             'DCWorkflow', 'Products.DCWorkflow',
31             'PasswordResetTool', 'Products.PasswordResetTool',
32             'PlonePAS', 'Products.PlonePAS',
33             'wicked.at',
34             'PloneLanguageTool', 'Products.PloneLanguageTool',
35             'CMFFormController', 'Products.CMFFormController',
36             'MimetypesRegistry', 'Products.MimetypesRegistry',
37             'PortalTransforms', 'Products.PortalTransforms',
38             'CMFDiffTool', 'Products.CMFDiffTool',
39             'CMFEditions', 'Products.CMFEditions',
40             'Products.NuPlone',
41             'borg.localrole',
42             'plone.app.blob',
43             'plone.app.caching',
44             'plone.app.collection',
45             'plone.app.dexterity',
46             'plone.app.discussion',
47             'plone.app.event',
48             'plone.app.imaging',
49             'plone.app.intid',
50             'plone.app.linkintegrity',
51             'plone.app.querystring',
52             'plone.app.registry',
53             'plone.app.referenceablebehavior',
54             'plone.app.relationfield',
55             'plone.app.theming',
56             'plone.app.users',
57             'plone.app.widgets',
58             'plone.app.z3cform',
59             'plone.formwidget.recurrence',
60             'plone.keyring',
61             'plone.outputfilters',
62             'plone.portlet.static',
63             'plone.portlet.collection',
64             'plone.protect',
65             'plone.resource',
66             'plonetheme.barceloneta',
67         ]
68 
69     def getNonInstallableProfiles(self):
70         return [_DEFAULT_PROFILE,
71                 _CONTENT_PROFILE,
72                 u'Products.Archetypes:Archetypes',
73                 u'Products.ATContentTypes:default',
74                 u'Products.CMFDiffTool:CMFDiffTool',
75                 u'Products.CMFEditions:CMFEditions',
76                 u'Products.CMFFormController:CMFFormController',
77                 u'Products.CMFPlone:dependencies',
78                 u'Products.CMFPlone:testfixture',
79                 u'Products.CMFQuickInstallerTool:CMFQuickInstallerTool',
80                 u'Products.NuPlone:uninstall',
81                 u'Products.MimetypesRegistry:MimetypesRegistry',
82                 u'Products.PasswordResetTool:PasswordResetTool',
83                 u'Products.PortalTransforms:PortalTransforms',
84                 u'Products.PloneLanguageTool:PloneLanguageTool',
85                 u'Products.PlonePAS:PlonePAS',
86                 u'borg.localrole:default',
87                 u'plone.browserlayer:default',
88                 u'plone.keyring:default',
89                 u'plone.outputfilters:default',
90                 u'plone.portlet.static:default',
91                 u'plone.portlet.collection:default',
92                 u'plone.protect:default',
93                 u'plone.app.blob:default',
94                 u'plone.app.blob:file-replacement',
95                 u'plone.app.blob:image-replacement',
96                 u'plone.app.blob:sample-type',
97                 u'plone.app.collection:default',
98                 u'plone.app.contenttypes:default',
99                 u'plone.app.dexterity:default',
100                 u'plone.app.discussion:default',
101                 u'plone.app.event:default',
102                 u'plone.app.imaging:default',
103                 u'plone.app.linkintegrity:default',
104                 u'plone.app.registry:default',
105                 u'plone.app.relationfield:default',
106                 u'plone.app.theming:default',
107                 u'plone.app.users:default',
108                 u'plone.app.versioningbehavior:default',
109                 u'plone.app.z3cform:default',
110                 u'plone.formwidget.recurrence:default',
111                 u'plone.resource:default',
112                 ]
113 
114 
115 def zmi_constructor(context):
116     """This is a dummy constructor for the ZMI."""
117     url = context.DestinationURL()
118     request = context.REQUEST
119     return request.response.redirect(url + '/@@plone-addsite?site_id=Plone')
120 
121 
122 def addPloneSite(context, site_id, title='Plone site', description='',
123                  profile_id=_DEFAULT_PROFILE,
124                  content_profile_id=_CONTENT_PROFILE, snapshot=False,
125                  extension_ids=(), setup_content=True,
126                  default_language='en', portal_timezone='UTC'):
127     """Add a PloneSite to the context."""
128     context._setObject(site_id, PloneSite(site_id))
129     site = context._getOb(site_id)
130     site.setLanguage(default_language)
131     # Set the accepted language for the rest of the request.  This makes sure
132     # the front-page text gets the correct translation also when your browser
133     # prefers non-English and you choose English as language for the Plone
134     # Site.
135     request = context.REQUEST
136     request['HTTP_ACCEPT_LANGUAGE'] = default_language
137 
138     site[_TOOL_ID] = SetupTool(_TOOL_ID)
139     setup_tool = site[_TOOL_ID]
140 
141     notify(SiteManagerCreatedEvent(site))
142     setSite(site)
143 
144     setup_tool.setBaselineContext('profile-%s' % profile_id)
145     setup_tool.runAllImportStepsFromProfile('profile-%s' % profile_id)
146 
147     reg = queryUtility(IRegistry, context=site)
148     reg['plone.portal_timezone'] = portal_timezone
149     reg['plone.available_timezones'] = [portal_timezone]
150     reg['plone.default_language'] = default_language
151     reg['plone.available_languages'] = [default_language]
152 
153     if setup_content:
154         setup_tool.runAllImportStepsFromProfile(
155             'profile-%s' % content_profile_id)
156 
157     props = dict(
158         title=title,
159         description=description,
160     )
161     # Do this before applying extension profiles, so the settings from a
162     # properties.xml file are applied and not overwritten by this
163     site.manage_changeProperties(**props)
164 
165     for extension_id in extension_ids:
166         setup_tool.runAllImportStepsFromProfile(
167             'profile-%s' % extension_id)
168 
169     if snapshot is True:
170         setup_tool.createSnapshot('initial_configuration')
171 
172     return site
173
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/Products/CMFPlone/factory.py b/Products/CMFPlone/factory.py
--- a/Products/CMFPlone/factory.py
+++ b/Products/CMFPlone/factory.py
@@ -1,8 +1,11 @@
 # -*- coding: utf-8 -*-
+from Products.CMFPlone import PloneMessageFactory as _
 from Products.CMFPlone.Portal import PloneSite
 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 logging import getLogger
 from plone.registry.interfaces import IRegistry
 from zope.component import queryUtility
 from zope.event import notify
@@ -16,6 +19,8 @@
 # A little hint for PloneTestCase
 _IMREALLYPLONE5 = True
 
+logger = getLogger('Plone')
+
 
 @implementer(INonInstallable)
 class NonInstallable(object):
@@ -163,8 +168,23 @@
     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 ${profile_id}: ${error_msg}! '
+                'Please try to install it manually using the "Addons" '
+                'controlpanel and report any issues to the '
+                'addon maintainers.',
+                mapping={
+                    'profile_id': extension_id,
+                    'error_msg': msg.args,
+                }),
+                type='error')
+            logger.exception(
+                'Error while installing addon {}. '
+                'See traceback below for details.'.format(extension_id))
 
     if snapshot is True:
         setup_tool.createSnapshot('initial_configuration')

{"golden_diff": "diff --git a/Products/CMFPlone/factory.py b/Products/CMFPlone/factory.py\n--- a/Products/CMFPlone/factory.py\n+++ b/Products/CMFPlone/factory.py\n@@ -1,8 +1,11 @@\n # -*- coding: utf-8 -*-\n+from Products.CMFPlone import PloneMessageFactory as _\n from Products.CMFPlone.Portal import PloneSite\n from Products.CMFPlone.events import SiteManagerCreatedEvent\n from Products.CMFPlone.interfaces import INonInstallable\n from Products.GenericSetup.tool import SetupTool\n+from Products.statusmessages.interfaces import IStatusMessage\n+from logging import getLogger\n from plone.registry.interfaces import IRegistry\n from zope.component import queryUtility\n from zope.event import notify\n@@ -16,6 +19,8 @@\n # A little hint for PloneTestCase\n _IMREALLYPLONE5 = True\n \n+logger = getLogger('Plone')\n+\n \n @implementer(INonInstallable)\n class NonInstallable(object):\n@@ -163,8 +168,23 @@\n     site.manage_changeProperties(**props)\n \n     for extension_id in extension_ids:\n-        setup_tool.runAllImportStepsFromProfile(\n-            'profile-%s' % extension_id)\n+        try:\n+            setup_tool.runAllImportStepsFromProfile(\n+                'profile-%s' % extension_id)\n+        except Exception as msg:\n+            IStatusMessage(request).add(_(\n+                'Could not install ${profile_id}: ${error_msg}! '\n+                'Please try to install it manually using the \"Addons\" '\n+                'controlpanel and report any issues to the '\n+                'addon maintainers.',\n+                mapping={\n+                    'profile_id': extension_id,\n+                    'error_msg': msg.args,\n+                }),\n+                type='error')\n+            logger.exception(\n+                'Error while installing addon {}. '\n+                'See traceback below for details.'.format(extension_id))\n \n     if snapshot is True:\n         setup_tool.createSnapshot('initial_configuration')\n", "issue": "AttributeError: 'PersistentAdapterRegistry' object has no attribute 'lookupAll'\nThe following error is raised in Plone 5.1 when you try to install a new Plone site with an add-on where the Dexterity content-class could not be imported properly e.g. for some NameError in my case.\r\n\r\nIn particular this error message shadows the primary problem. It seems to me that some errors in the bootstrapping phase of Plone or inside of GS are just swallowed.\r\n\r\n```\r\n2017-11-30 11:29:03 ERROR txn.140599418205952 Failed to abort resource manager: <Products.CMFCore.indexing.QueueTM object at 0x7fdfddecbd50>\r\nTraceback (most recent call last):\r\n  File \"/home/ajung/.buildout/eggs/transaction-2.1.2-py2.7.egg/transaction/_transaction.py\", line 514, in abort\r\n    rm.abort(self)\r\n  File \"/home/ajung/.buildout/eggs/Products.CMFCore-2.2.12-py2.7.egg/Products/CMFCore/indexing.py\", line 321, in tpc_abort\r\n    self.queue.abort()\r\n  File \"/home/ajung/.buildout/eggs/Products.CMFCore-2.2.12-py2.7.egg/Products/CMFCore/indexing.py\", line 237, in abort\r\n    for name, util in sm.getUtilitiesFor(IIndexQueueProcessor):\r\n  File \"/home/ajung/.buildout/eggs/zope.interface-4.4.2-py2.7-linux-x86_64.egg/zope/interface/registry.py\", line 290, in getUtilitiesFor\r\n    for name, utility in self.utilities.lookupAll((), interface):\r\nAttributeError: 'PersistentAdapterRegistry' object has no attribute 'lookupAll'\r\n```\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\nfrom Products.CMFPlone.Portal import PloneSite\nfrom Products.CMFPlone.events import SiteManagerCreatedEvent\nfrom Products.CMFPlone.interfaces import INonInstallable\nfrom Products.GenericSetup.tool import SetupTool\nfrom plone.registry.interfaces import IRegistry\nfrom zope.component import queryUtility\nfrom zope.event import notify\nfrom zope.interface import implementer\nfrom zope.site.hooks import setSite\n\n_TOOL_ID = 'portal_setup'\n_DEFAULT_PROFILE = 'Products.CMFPlone:plone'\n_CONTENT_PROFILE = 'plone.app.contenttypes:plone-content'\n\n# A little hint for PloneTestCase\n_IMREALLYPLONE5 = True\n\n\n@implementer(INonInstallable)\nclass NonInstallable(object):\n\n    def getNonInstallableProducts(self):\n        return [\n            'Archetypes', 'Products.Archetypes',\n            'CMFDefault', 'Products.CMFDefault',\n            'CMFPlone', 'Products.CMFPlone', 'Products.CMFPlone.migrations',\n            'CMFTopic', 'Products.CMFTopic',\n            'CMFUid', 'Products.CMFUid',\n            'DCWorkflow', 'Products.DCWorkflow',\n            'PasswordResetTool', 'Products.PasswordResetTool',\n            'PlonePAS', 'Products.PlonePAS',\n            'wicked.at',\n            'PloneLanguageTool', 'Products.PloneLanguageTool',\n            'CMFFormController', 'Products.CMFFormController',\n            'MimetypesRegistry', 'Products.MimetypesRegistry',\n            'PortalTransforms', 'Products.PortalTransforms',\n            'CMFDiffTool', 'Products.CMFDiffTool',\n            'CMFEditions', 'Products.CMFEditions',\n            'Products.NuPlone',\n            'borg.localrole',\n            'plone.app.blob',\n            'plone.app.caching',\n            'plone.app.collection',\n            'plone.app.dexterity',\n            'plone.app.discussion',\n            'plone.app.event',\n            'plone.app.imaging',\n            'plone.app.intid',\n            'plone.app.linkintegrity',\n            'plone.app.querystring',\n            'plone.app.registry',\n            'plone.app.referenceablebehavior',\n            'plone.app.relationfield',\n            'plone.app.theming',\n            'plone.app.users',\n            'plone.app.widgets',\n            'plone.app.z3cform',\n            'plone.formwidget.recurrence',\n            'plone.keyring',\n            'plone.outputfilters',\n            'plone.portlet.static',\n            'plone.portlet.collection',\n            'plone.protect',\n            'plone.resource',\n            'plonetheme.barceloneta',\n        ]\n\n    def getNonInstallableProfiles(self):\n        return [_DEFAULT_PROFILE,\n                _CONTENT_PROFILE,\n                u'Products.Archetypes:Archetypes',\n                u'Products.ATContentTypes:default',\n                u'Products.CMFDiffTool:CMFDiffTool',\n                u'Products.CMFEditions:CMFEditions',\n                u'Products.CMFFormController:CMFFormController',\n                u'Products.CMFPlone:dependencies',\n                u'Products.CMFPlone:testfixture',\n                u'Products.CMFQuickInstallerTool:CMFQuickInstallerTool',\n                u'Products.NuPlone:uninstall',\n                u'Products.MimetypesRegistry:MimetypesRegistry',\n                u'Products.PasswordResetTool:PasswordResetTool',\n                u'Products.PortalTransforms:PortalTransforms',\n                u'Products.PloneLanguageTool:PloneLanguageTool',\n                u'Products.PlonePAS:PlonePAS',\n                u'borg.localrole:default',\n                u'plone.browserlayer:default',\n                u'plone.keyring:default',\n                u'plone.outputfilters:default',\n                u'plone.portlet.static:default',\n                u'plone.portlet.collection:default',\n                u'plone.protect:default',\n                u'plone.app.blob:default',\n                u'plone.app.blob:file-replacement',\n                u'plone.app.blob:image-replacement',\n                u'plone.app.blob:sample-type',\n                u'plone.app.collection:default',\n                u'plone.app.contenttypes:default',\n                u'plone.app.dexterity:default',\n                u'plone.app.discussion:default',\n                u'plone.app.event:default',\n                u'plone.app.imaging:default',\n                u'plone.app.linkintegrity:default',\n                u'plone.app.registry:default',\n                u'plone.app.relationfield:default',\n                u'plone.app.theming:default',\n                u'plone.app.users:default',\n                u'plone.app.versioningbehavior:default',\n                u'plone.app.z3cform:default',\n                u'plone.formwidget.recurrence:default',\n                u'plone.resource:default',\n                ]\n\n\ndef zmi_constructor(context):\n    \"\"\"This is a dummy constructor for the ZMI.\"\"\"\n    url = context.DestinationURL()\n    request = context.REQUEST\n    return request.response.redirect(url + '/@@plone-addsite?site_id=Plone')\n\n\ndef addPloneSite(context, site_id, title='Plone site', description='',\n                 profile_id=_DEFAULT_PROFILE,\n                 content_profile_id=_CONTENT_PROFILE, snapshot=False,\n                 extension_ids=(), setup_content=True,\n                 default_language='en', portal_timezone='UTC'):\n    \"\"\"Add a PloneSite to the context.\"\"\"\n    context._setObject(site_id, PloneSite(site_id))\n    site = context._getOb(site_id)\n    site.setLanguage(default_language)\n    # Set the accepted language for the rest of the request.  This makes sure\n    # the front-page text gets the correct translation also when your browser\n    # prefers non-English and you choose English as language for the Plone\n    # Site.\n    request = context.REQUEST\n    request['HTTP_ACCEPT_LANGUAGE'] = default_language\n\n    site[_TOOL_ID] = SetupTool(_TOOL_ID)\n    setup_tool = site[_TOOL_ID]\n\n    notify(SiteManagerCreatedEvent(site))\n    setSite(site)\n\n    setup_tool.setBaselineContext('profile-%s' % profile_id)\n    setup_tool.runAllImportStepsFromProfile('profile-%s' % profile_id)\n\n    reg = queryUtility(IRegistry, context=site)\n    reg['plone.portal_timezone'] = portal_timezone\n    reg['plone.available_timezones'] = [portal_timezone]\n    reg['plone.default_language'] = default_language\n    reg['plone.available_languages'] = [default_language]\n\n    if setup_content:\n        setup_tool.runAllImportStepsFromProfile(\n            'profile-%s' % content_profile_id)\n\n    props = dict(\n        title=title,\n        description=description,\n    )\n    # Do this before applying extension profiles, so the settings from a\n    # properties.xml file are applied and not overwritten by this\n    site.manage_changeProperties(**props)\n\n    for extension_id in extension_ids:\n        setup_tool.runAllImportStepsFromProfile(\n            'profile-%s' % extension_id)\n\n    if snapshot is True:\n        setup_tool.createSnapshot('initial_configuration')\n\n    return site\n", "path": "Products/CMFPlone/factory.py"}], "after_files": [{"content": "# -*- coding: utf-8 -*-\nfrom Products.CMFPlone import PloneMessageFactory as _\nfrom Products.CMFPlone.Portal import PloneSite\nfrom Products.CMFPlone.events import SiteManagerCreatedEvent\nfrom Products.CMFPlone.interfaces import INonInstallable\nfrom Products.GenericSetup.tool import SetupTool\nfrom Products.statusmessages.interfaces import IStatusMessage\nfrom logging import getLogger\nfrom plone.registry.interfaces import IRegistry\nfrom zope.component import queryUtility\nfrom zope.event import notify\nfrom zope.interface import implementer\nfrom zope.site.hooks import setSite\n\n_TOOL_ID = 'portal_setup'\n_DEFAULT_PROFILE = 'Products.CMFPlone:plone'\n_CONTENT_PROFILE = 'plone.app.contenttypes:plone-content'\n\n# A little hint for PloneTestCase\n_IMREALLYPLONE5 = True\n\nlogger = getLogger('Plone')\n\n\n@implementer(INonInstallable)\nclass NonInstallable(object):\n\n    def getNonInstallableProducts(self):\n        return [\n            'Archetypes', 'Products.Archetypes',\n            'CMFDefault', 'Products.CMFDefault',\n            'CMFPlone', 'Products.CMFPlone', 'Products.CMFPlone.migrations',\n            'CMFTopic', 'Products.CMFTopic',\n            'CMFUid', 'Products.CMFUid',\n            'DCWorkflow', 'Products.DCWorkflow',\n            'PasswordResetTool', 'Products.PasswordResetTool',\n            'PlonePAS', 'Products.PlonePAS',\n            'wicked.at',\n            'PloneLanguageTool', 'Products.PloneLanguageTool',\n            'CMFFormController', 'Products.CMFFormController',\n            'MimetypesRegistry', 'Products.MimetypesRegistry',\n            'PortalTransforms', 'Products.PortalTransforms',\n            'CMFDiffTool', 'Products.CMFDiffTool',\n            'CMFEditions', 'Products.CMFEditions',\n            'Products.NuPlone',\n            'borg.localrole',\n            'plone.app.blob',\n            'plone.app.caching',\n            'plone.app.collection',\n            'plone.app.dexterity',\n            'plone.app.discussion',\n            'plone.app.event',\n            'plone.app.imaging',\n            'plone.app.intid',\n            'plone.app.linkintegrity',\n            'plone.app.querystring',\n            'plone.app.registry',\n            'plone.app.referenceablebehavior',\n            'plone.app.relationfield',\n            'plone.app.theming',\n            'plone.app.users',\n            'plone.app.widgets',\n            'plone.app.z3cform',\n            'plone.formwidget.recurrence',\n            'plone.keyring',\n            'plone.outputfilters',\n            'plone.portlet.static',\n            'plone.portlet.collection',\n            'plone.protect',\n            'plone.resource',\n            'plonetheme.barceloneta',\n        ]\n\n    def getNonInstallableProfiles(self):\n        return [_DEFAULT_PROFILE,\n                _CONTENT_PROFILE,\n                u'Products.Archetypes:Archetypes',\n                u'Products.ATContentTypes:default',\n                u'Products.CMFDiffTool:CMFDiffTool',\n                u'Products.CMFEditions:CMFEditions',\n                u'Products.CMFFormController:CMFFormController',\n                u'Products.CMFPlone:dependencies',\n                u'Products.CMFPlone:testfixture',\n                u'Products.CMFQuickInstallerTool:CMFQuickInstallerTool',\n                u'Products.NuPlone:uninstall',\n                u'Products.MimetypesRegistry:MimetypesRegistry',\n                u'Products.PasswordResetTool:PasswordResetTool',\n                u'Products.PortalTransforms:PortalTransforms',\n                u'Products.PloneLanguageTool:PloneLanguageTool',\n                u'Products.PlonePAS:PlonePAS',\n                u'borg.localrole:default',\n                u'plone.browserlayer:default',\n                u'plone.keyring:default',\n                u'plone.outputfilters:default',\n                u'plone.portlet.static:default',\n                u'plone.portlet.collection:default',\n                u'plone.protect:default',\n                u'plone.app.blob:default',\n                u'plone.app.blob:file-replacement',\n                u'plone.app.blob:image-replacement',\n                u'plone.app.blob:sample-type',\n                u'plone.app.collection:default',\n                u'plone.app.contenttypes:default',\n                u'plone.app.dexterity:default',\n                u'plone.app.discussion:default',\n                u'plone.app.event:default',\n                u'plone.app.imaging:default',\n                u'plone.app.linkintegrity:default',\n                u'plone.app.registry:default',\n                u'plone.app.relationfield:default',\n                u'plone.app.theming:default',\n                u'plone.app.users:default',\n                u'plone.app.versioningbehavior:default',\n                u'plone.app.z3cform:default',\n                u'plone.formwidget.recurrence:default',\n                u'plone.resource:default',\n                ]\n\n\ndef zmi_constructor(context):\n    \"\"\"This is a dummy constructor for the ZMI.\"\"\"\n    url = context.DestinationURL()\n    request = context.REQUEST\n    return request.response.redirect(url + '/@@plone-addsite?site_id=Plone')\n\n\ndef addPloneSite(context, site_id, title='Plone site', description='',\n                 profile_id=_DEFAULT_PROFILE,\n                 content_profile_id=_CONTENT_PROFILE, snapshot=False,\n                 extension_ids=(), setup_content=True,\n                 default_language='en', portal_timezone='UTC'):\n    \"\"\"Add a PloneSite to the context.\"\"\"\n    context._setObject(site_id, PloneSite(site_id))\n    site = context._getOb(site_id)\n    site.setLanguage(default_language)\n    # Set the accepted language for the rest of the request.  This makes sure\n    # the front-page text gets the correct translation also when your browser\n    # prefers non-English and you choose English as language for the Plone\n    # Site.\n    request = context.REQUEST\n    request['HTTP_ACCEPT_LANGUAGE'] = default_language\n\n    site[_TOOL_ID] = SetupTool(_TOOL_ID)\n    setup_tool = site[_TOOL_ID]\n\n    notify(SiteManagerCreatedEvent(site))\n    setSite(site)\n\n    setup_tool.setBaselineContext('profile-%s' % profile_id)\n    setup_tool.runAllImportStepsFromProfile('profile-%s' % profile_id)\n\n    reg = queryUtility(IRegistry, context=site)\n    reg['plone.portal_timezone'] = portal_timezone\n    reg['plone.available_timezones'] = [portal_timezone]\n    reg['plone.default_language'] = default_language\n    reg['plone.available_languages'] = [default_language]\n\n    if setup_content:\n        setup_tool.runAllImportStepsFromProfile(\n            'profile-%s' % content_profile_id)\n\n    props = dict(\n        title=title,\n        description=description,\n    )\n    # Do this before applying extension profiles, so the settings from a\n    # properties.xml file are applied and not overwritten by this\n    site.manage_changeProperties(**props)\n\n    for extension_id in extension_ids:\n        try:\n            setup_tool.runAllImportStepsFromProfile(\n                'profile-%s' % extension_id)\n        except Exception as msg:\n            IStatusMessage(request).add(_(\n                'Could not install ${profile_id}: ${error_msg}! '\n                'Please try to install it manually using the \"Addons\" '\n                'controlpanel and report any issues to the '\n                'addon maintainers.',\n                mapping={\n                    'profile_id': extension_id,\n                    'error_msg': msg.args,\n                }),\n                type='error')\n            logger.exception(\n                'Error while installing addon {}. '\n                'See traceback below for details.'.format(extension_id))\n\n    if snapshot is True:\n        setup_tool.createSnapshot('initial_configuration')\n\n    return site\n", "path": "Products/CMFPlone/factory.py"}]}