I have a product (export.policy) whose setup handler is being used to export information from existing content.
I'm trying to follow instructions for introspecting an interface.
https://docs.plone.org/4/en/external/plone.app.dexterity/docs/reference/manipulating-content-objects.html?highlight=introspect#object-introspection
In my setup handler function, I have this:
def setup_various(context):
...
catalog = api.portal.get_tool(name='portal_catalog')
brains = catalog.searchResults({'portal_type':'my.product.contenttype'})
for i in brains:
obj = i.getObject()
schema = queryContentType(obj)
fields = getFieldsInOrder(schema)
for f in fields:
print f
Unfortunately, it breaks at fields = getFieldsInOrder(schema).
I tried printing the schema, but its returning None.
And calling getFieldsInOrder get this error:
2018-08-08 07:24:39 ERROR Zope.SiteErrorLog 1533727479.590.139046844079 http://localhost:8080/Plone/portal_quickinstaller/reinstallProducts
Traceback (innermost last):
Module ZPublisher.Publish, line 138, in publish
Module ZPublisher.mapply, line 77, in mapply
Module ZPublisher.Publish, line 48, in call_object
Module , line 6, in reinstallProducts
Module AccessControl.requestmethod, line 70, in _curried
Module Products.CMFQuickInstallerTool.QuickInstallerTool, line 784, in reinstallProducts
Module , line 3, in installProducts
Module AccessControl.requestmethod, line 70, in _curried
Module Products.CMFQuickInstallerTool.QuickInstallerTool, line 686, in installProducts
Module Products.CMFQuickInstallerTool.QuickInstallerTool, line 602, in installProduct
-
traceback_info: ('export.policy',)
Module Products.GenericSetup.tool, line 388, in runAllImportStepsFromProfile -
traceback_info: profile-export:policy:default
Module Products.GenericSetup.tool, line 1433, in _runImportStepsFromContext
Module Products.GenericSetup.tool, line 1245, in _doRunImportStep -
traceback_info: export.policy
Module export.policy.setuphandlers, line 16, in setup_various
Module zope.schema._schema, line 42, in getFieldsInOrder
Module zope.schema._schema, line 32, in getFields
TypeError: 'NoneType' object is not iterable
Why is queryContentType returning None for me?