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

TypeError: __call__() missing 1 required positional argument: 'context' #880

Open
ptitpoulpe opened this issue Jan 19, 2021 · 0 comments
Open

Comments

@ptitpoulpe
Copy link

ptitpoulpe commented Jan 19, 2021

If a validator handler raise a TypeError hug catch it believing (here) that’s is an expected error unexpected keyword argument "context"

A solution is to use replace initialize_handler code with something like that:

import inspect
    def initialize_handler(handler, value, context):
        if "context" in inspect.signature(handler).parameters: # It's better to ask for permission than for forgiveness
            return handler(value, context=context)
        else:
            return handler(value)
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

No branches or pull requests

1 participant