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

refactor: post serialization simplified #211

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

wax911
Copy link
Member

@wax911 wax911 commented Mar 12, 2025

AniTrend Pull Request

Thank you for contributing! Please take a moment to review our contributing guidelines to make the process easy and effective for everyone involved.

Please open an issue before embarking on any significant pull request, especially those that
add a new library or change existing tests, otherwise you risk spending a lot of time working
on something that might not end up being merged into the project.

Before opening a pull request, please ensure you've done the following:

  • Check that your branch is based on develop and targets develop (where applicable)
  • Pull request has tests (if applicable)
  • Documentation is updated (if necessary)
  • Description explains the issue/use-case resolved

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Enhancement (Improves existing functionality)

IMPORTANT: By submitting a patch, you agree to allow the project
owners to license your work under the terms of
the Apache License.

@@ -18,6 +18,7 @@ def __init__(self, *, only: Optional[StrSequenceOrSet] = None, exclude: StrSeque
super().__init__(only=only, exclude=exclude, many=many, context=context, load_only=load_only,
dump_only=dump_only, partial=partial, unknown=unknown)

@post_load()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we don't add @post_load on the contract, the decorator is able to add it but it'll never get triggered, I'm not entirely sure why this happens

self._logger.error(f"Conversion from dictionary failed", exc_info=e)
raise e

schema_class._on_post_load = on_post_serialization
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically redefine the contract _on_post_load by assigning it an implementation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant