collective.exportimport icon indicating copy to clipboard operation
collective.exportimport copied to clipboard

ComponentLookupError with programmatic exporter

Open zopyx opened this issue 3 years ago • 1 comments

I am using this exporter script

acl = app.acl_users
user = acl.getUser(USER)
newSecurityManager(None, user.__of__(acl))

site = app.eteaching
makerequest(site)

setSite(site)

export_content = api.content.get_view('export_content', site, site.REQUEST)
site.REQUEST.form['form.submitted'] = True
export_content(portal_type=['Folder', 'Document', 'Event'], include_blobs=2, download_to_server=True)

that returns this error:

2022-04-13 07:18:14 ERROR collective.exportimport.export_content Error exporting http://nohost/eteaching/community/communityevents/workshops/community-workshop/arbeitsblaetter
Traceback (most recent call last):
  File "/home/ajung/sandboxes/iwm/plone4.buildout/src/collective.exportimport/src/collective/exportimport/export_content.py", line 281, in export_content
    item = serializer(include_items=False)
  File "/home/ajung/.buildout/eggs/plone.restapi-6.13.4-py2.7.egg/plone/restapi/serializer/dxcontent.py", line 161, in __call__
    folder_metadata = super(SerializeFolderToJson, self).__call__(version=version)
  File "/home/ajung/.buildout/eggs/plone.restapi-6.13.4-py2.7.egg/plone/restapi/serializer/dxcontent.py", line 108, in __call__
    (self.context, self.request), name="conversation_view"
  File "/home/ajung/.buildout/eggs/zope.component-3.9.5-py2.7.egg/zope/component/_api.py", line 109, in getMultiAdapter
    raise ComponentLookupError(objects, interface, name)
ComponentLookupError: ((<Folder at /eteaching/community/communityevents/workshops/community-workshop/arbeitsblaetter>, <HTTPRequest, URL=http://nohost>), <InterfaceClass zope.interface.Interface>, 'conversation_view')

I run the script using bin/instance run myexport.py. In my understanding, Zope/Plone would pick up the related ZCML configurations for view etc. also when using bin/instance run ...

zopyx avatar Apr 13 '22 05:04 zopyx

This is more related to plone.restapi:

        result["allow_discussion"] = getMultiAdapter(
            (self.context, self.request), name="conversation_view"
        ).enabled()

zopyx avatar Apr 13 '22 05:04 zopyx