You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I query a record that is not yet loaded in the registry by running an upgrade step which reads in registry records defined by xml or a zope.schema interface, I should receive a default parameter if I passed that into the get_registry_record function call
The function already errors on L300 when the forInterface() call cannot find my schema, L305 is never reached in this case.
Module plone.api.portal, line 2, in get_registry_record
Module plone.api.validation, line 77, in wrapped
Module plone.api.portal, line 300, in get_registry_record
Module plone.registry.registry, line 78, in forInterface
KeyError: 'Interface `myproject.content.interfaces.IProjectSettings` defines a field `somefield`, for which there is no record.'
The text was updated successfully, but these errors were encountered:
Whoops, wrong assumption. My IProjectSettings was already loaded in the registry, but I added a new field. And plone.registry.forInterface is checking if all fields from the Interface are loaded in the registry, which is not the case.
My suggested solution would be to pass 'check=False' to the forInterface call on L300, which will skip the field verification:
@fredvd I created a fix for the same problem in the restapi. it probably needs a similar fix here, or a combined fix somewhere else - plone/plone.restapi#1736
expected behavior:
When I query a record that is not yet loaded in the registry by running an upgrade step which reads in registry records defined by xml or a zope.schema interface, I should receive a default parameter if I passed that into the get_registry_record function call
What happens:
plone.api/src/plone/api/portal.py
Lines 299 to 306 in a8361ed
The function already errors on L300 when the forInterface() call cannot find my schema, L305 is never reached in this case.
The text was updated successfully, but these errors were encountered: