get_registry_record errors even if default value is given
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 101
- Forks
- 62
- Avg merge
- 15h 15m
- Merged PRs (30d)
- 1
Description
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:
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.'
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/plone/api/portal.py at lines 299-306 and inspect get_registry_record, then reproduce the case where a schema-defined registry record is missing while a default is supplied. Done means the supplied default is returned instead of the KeyError shown in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100