-
-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
get_registry_record errors even if default value is given #417
Comments
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: But this will throw a KeyError next on L303 , so that would have to be Exception handled as well. Nasty stuff. |
@fredvd I think what it needs is modifed records proxy that returns the schema defaults if the data is missing |
@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: