KeyError: 'Interface `Products.CMFPlone.interfaces.controlpanel.INavigationSchema` defines a field `generate_tabs`, for which there is no record.'

I have a fresh 5.1.2 site.

This code

        registry = getUtility(IRegistry)
        settings = registry.forInterface(INavigationSchema)
        display_types = settings.get('plone.displayed_types')

causes this error:

  Module dynamore.policy.browser.folder, line 32, in all_entries
  Module plone.registry.registry, line 82, in forInterface
KeyError: 'Interface `Products.CMFPlone.interfaces.controlpanel.INavigationSchema` defines a field `generate_tabs`, for which there is no record.'

However the configuration registry clearly shows an entry for plone.generate_tabs for INavigationSchema.

How can I get around this error?

Create a registry entry plone.generate_tabs. This should be present though. I thought about preventing this error from happening by just creating a registy entry for a field that is not known. Though, this would hide a problem somewhere else, so in the end we decided against it...

Sorry, I don't get the point. The entry is already visible within the configuration registry and I could update the value of this option through the control panel. What else is need here? So the key is obviously definied through some profile, it exists....what else?

Just a thought: Check for a schema_prefix or a prefix in the form definition. Might not be your problem, but I've hit that before.

Looks like it's got a prefix='plone' defined in the profile registry.xml , but no schema_prefix= in the python interface.

I've been thinking about this lately:

Nevermind, I'm way off.


settings = registry.forInterface(INavigationSchema, prefix='plone')

You can also check the controlpanel code in CMFPlone for further details, e.g.: