[SOLVED] schema.List problems indexing in the catalog


I am upgrading from 5.0.4 to 5.2.2, as well as py2 to py3, and updating 16 addons.

I am running into a reoccurring issue in my addons with schema.List. I also have my schema.List declaration below being indexed in the catalog. It works fine in 5.0.4.

content_type = schema.List(
title=u"Restrict content types in this collection",

When saving throws...

Traceback (innermost last):
Module ZPublisher.WSGIPublisher, line 156, in transaction_pubevents
Module ZPublisher.WSGIPublisher, line 338, in publish_module
Module ZPublisher.WSGIPublisher, line 256, in publish
Module ZPublisher.mapply, line 85, in mapply
Module ZPublisher.WSGIPublisher, line 62, in call_object
Module plone.z3cform.layout, line 63, in call
Module plone.z3cform.layout, line 47, in update
Module plone.dexterity.browser.add, line 141, in update
Module plone.z3cform.fieldsets.extensible, line 65, in update
Module plone.z3cform.patch, line 30, in GroupForm_update
Module z3c.form.group, line 145, in update
Module plone.app.z3cform.csrf, line 22, in execute
Module z3c.form.action, line 98, in execute
Module z3c.form.button, line 315, in call
Module z3c.form.button, line 170, in call
Module plone.dexterity.browser.add, line 116, in handleAdd
Module z3c.form.form, line 265, in createAndAdd
Module plone.dexterity.browser.add, line 91, in add
Module plone.dexterity.utils, line 189, in addContentToContainer
Module OFS.ObjectManager, line 384, in _setObject
Module zope.event, line 32, in notify
Module zope.component.event, line 27, in dispatch
Module zope.component._api, line 124, in subscribers
Module zope.interface.registry, line 442, in subscribers
Module zope.interface.adapter, line 607, in subscribers
Module zope.component.event, line 36, in objectEventNotify
Module zope.component._api, line 124, in subscribers
Module zope.interface.registry, line 442, in subscribers
Module zope.interface.adapter, line 607, in subscribers
Module Products.CMFCore.CMFCatalogAware, line 274, in handleContentishEvent
Module Products.CMFCore.CMFCatalogAware, line 197, in notifyWorkflowCreated
Module Products.CMFCore.WorkflowTool, line 300, in notifyCreated
Module Products.CMFCore.WorkflowTool, line 610, in _reindexWorkflowVariables
Module Products.CMFCore.CMFCatalogAware, line 110, in reindexObjectSecurity
Module Products.CMFCore.CatalogTool, line 271, in unrestrictedSearchResults
Module Products.CMFCore.indexing, line 96, in processQueue
Module Products.CMFCore.indexing, line 223, in process
Module Products.CMFCore.indexing, line 51, in reindex
Module Products.CMFCore.CatalogTool, line 367, in _reindexObject
Module Products.CMFPlone.CatalogTool, line 351, in catalog_object
Module Products.ZCatalog.ZCatalog, line 499, in catalog_object
Module Products.ZCatalog.Catalog, line 338, in catalogObject
Module Products.ZCatalog.Catalog, line 289, in updateMetadata
Module Products.ZCatalog.Catalog, line 422, in recordify
Module plone.indexer.wrapper, line 65, in getattr
Module plone.indexer.delegate, line 20, in call
Module plone.app.contenttypes.indexers, line 187, in mime_type
TypeError: 'list' object is not callable

I have been trying and trying to figure out what is going on. When I comment out the content_type field in the Model, it saves fine. It is something with the schema.List not being able to be cataloged. This is happening to all my Lists schemas that are cataloged.

I upgraded my plone.app.z3cform package to 3.2.2 already.

Thank you,

That is in the standard mime_type indexer. This indexer expects that it can call content_type() on the object. This is a method in content.py. Your field name overrides this.

If you can rename your field, that should solve it.

Alternatively it should be possible to register your own mime_type indexer and register it for a more specific interface for your content, instead of IDexterityContent. That should avoid the direct error. I am not sure if you then run into other problems, where other code expects that it can call content_type().

1 Like

Agh! You are 100% correct. Thank you!

I work in a library, we have almost identical naming conventions to the plone_catalog. Probably because the portal_catalog is based on Dublin Core. This probably explains why so many of my addons are conflicting in the catalog. So weird it never had a problem before.

Thank you!

1 Like