Hi folks.
I'm at a loss.
I'm trying to automate the import of some .zexp
files from a script. Essentially the script does:
zexpFile = '/path/to/import.zexp'
_EXTENSION_IDS = [
'plonetheme.barceloneta:default',
'plone.app.caching:default',
'mysite.policy:default'
]
app = makerequest.makerequest(app)
acl_users = app.acl_users
setSecurityPolicy(PermissiveSecurityPolicy())
newSecurityManager(None, OmnipotentUser().__of__(acl_users))
portal = addPloneSite(
app,
'mysite',
u'My Site',
u'Welcome to my site.',
extension_ids=_EXTENSION_IDS,
setup_content=False
)
portal._importObjectFromFile(zexpFile)
I run it using bin/instance-debug run
. This fails with the following stack trace:
Traceback (most recent call last):
File "support/setupSite.py", line 117, in _loadZEXPFiles
portal._importObjectFromFile(zexpFile)
File "/Users/kelly/.buildout/eggs/Zope2-2.13.27-py2.7.egg/OFS/ObjectManager.py", line 648, in _importObjectFromFile
self._setObject(id, ob, set_owner=set_owner)
File "/Users/kelly/.buildout/eggs/Zope2-2.13.27-py2.7.egg/OFS/ObjectManager.py", line 358, in _setObject
notify(ObjectAddedEvent(ob, self, id))
File "/Users/kelly/.buildout/eggs/zope.event-3.5.2-py2.7.egg/zope/event/__init__.py", line 31, in notify
subscriber(event)
File "/Users/kelly/.buildout/eggs/zope.component-4.4.1-py2.7.egg/zope/component/event.py", line 27, in dispatch
component_subscribers(event, None)
File "/Users/kelly/.buildout/eggs/zope.component-4.4.1-py2.7.egg/zope/component/_api.py", line 139, in subscribers
return sitemanager.subscribers(objects, interface)
File "/Users/kelly/.buildout/eggs/zope.interface-4.4.3-py2.7-macosx-10.14-x86_64.egg/zope/interface/registry.py", line 442, in subscribers
return self.adapters.subscribers(objects, provided)
File "/Users/kelly/.buildout/eggs/zope.interface-4.4.3-py2.7-macosx-10.14-x86_64.egg/zope/interface/adapter.py", line 607, in subscribers
subscription(*objects)
File "/Users/kelly/.buildout/eggs/zope.component-4.4.1-py2.7.egg/zope/component/event.py", line 36, in objectEventNotify
component_subscribers((event.object, event), None)
File "/Users/kelly/.buildout/eggs/zope.component-4.4.1-py2.7.egg/zope/component/_api.py", line 139, in subscribers
return sitemanager.subscribers(objects, interface)
File "/Users/kelly/.buildout/eggs/zope.interface-4.4.3-py2.7-macosx-10.14-x86_64.egg/zope/interface/registry.py", line 442, in subscribers
return self.adapters.subscribers(objects, provided)
File "/Users/kelly/.buildout/eggs/zope.interface-4.4.3-py2.7-macosx-10.14-x86_64.egg/zope/interface/adapter.py", line 607, in subscribers
subscription(*objects)
File "/Users/kelly/.buildout/eggs/Zope2-2.13.27-py2.7.egg/OFS/subscribers.py", line 113, in dispatchObjectMovedEvent
dispatchToSublocations(ob, event)
File "/Users/kelly/.buildout/eggs/zope.container-3.11.2-py2.7-macosx-10.14-x86_64.egg/zope/container/contained.py", line 153, in dispatchToSublocations
for ignored in zope.component.subscribers((sub, event), None):
File "/Users/kelly/.buildout/eggs/zope.component-4.4.1-py2.7.egg/zope/component/_api.py", line 139, in subscribers
return sitemanager.subscribers(objects, interface)
File "/Users/kelly/.buildout/eggs/zope.interface-4.4.3-py2.7-macosx-10.14-x86_64.egg/zope/interface/registry.py", line 442, in subscribers
return self.adapters.subscribers(objects, provided)
File "/Users/kelly/.buildout/eggs/zope.interface-4.4.3-py2.7-macosx-10.14-x86_64.egg/zope/interface/adapter.py", line 607, in subscribers
subscription(*objects)
File "/Users/kelly/.buildout/eggs/Zope2-2.13.27-py2.7.egg/OFS/subscribers.py", line 113, in dispatchObjectMovedEvent
dispatchToSublocations(ob, event)
File "/Users/kelly/.buildout/eggs/zope.container-3.11.2-py2.7-macosx-10.14-x86_64.egg/zope/container/contained.py", line 153, in dispatchToSublocations
for ignored in zope.component.subscribers((sub, event), None):
File "/Users/kelly/.buildout/eggs/zope.component-4.4.1-py2.7.egg/zope/component/_api.py", line 139, in subscribers
return sitemanager.subscribers(objects, interface)
File "/Users/kelly/.buildout/eggs/zope.interface-4.4.3-py2.7-macosx-10.14-x86_64.egg/zope/interface/registry.py", line 442, in subscribers
return self.adapters.subscribers(objects, provided)
File "/Users/kelly/.buildout/eggs/zope.interface-4.4.3-py2.7-macosx-10.14-x86_64.egg/zope/interface/adapter.py", line 607, in subscribers
subscription(*objects)
File "/Users/kelly/.buildout/eggs/plone.app.linkintegrity-3.3.7-py2.7.egg/plone/app/linkintegrity/handlers.py", line 108, in modifiedContent
links = retriever.retrieveLinks()
File "/Users/kelly/.buildout/eggs/plone.app.linkintegrity-3.3.7-py2.7.egg/plone/app/linkintegrity/retriever.py", line 57, in retrieveLinks
fti = getUtility(IDexterityFTI, name=self.context.portal_type)
File "/Users/kelly/.buildout/eggs/zope.component-4.4.1-py2.7.egg/zope/component/_api.py", line 169, in getUtility
raise ComponentLookupError(interface, name)
ComponentLookupError: (<InterfaceClass plone.dexterity.interfaces.IDexterityFTI>, 'Document')
What's perplexing, though, is that if I just do bin/instance-debug fg
and use the ZMI's "Import/export" button, I can import the same ZEXP file just fine.
What am I missing that's preventing the script from working?