Skip to content
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

ReferenceIdSchemaNode needs to serialize None #310

Closed
tseaver opened this issue Aug 29, 2024 · 0 comments · Fixed by #311
Closed

ReferenceIdSchemaNode needs to serialize None #310

tseaver opened this issue Aug 29, 2024 · 0 comments · Fixed by #311
Assignees

Comments

@tseaver
Copy link
Member

tseaver commented Aug 29, 2024

The _reference_property implementation [returns None]](https://github.com/Pylons/substanced/blob/e8b1038053a4f5dc601c323add7cf57b533ab27f/substanced/objectmap/__init__.py#L789) if the requested reference does not exist, but that value is invalid for the schema type (colander.Int). It needs to override serialize`, e.g.:

    def serialize(self, appstruct):
        if appstruct is None:
            return colander.null
        return super().serialize(appstruct)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant