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

Hook() breaks on custom handler #294

Open
cdeckard opened this issue Apr 11, 2023 · 0 comments
Open

Hook() breaks on custom handler #294

cdeckard opened this issue Apr 11, 2023 · 0 comments

Comments

@cdeckard
Copy link

cdeckard commented Apr 11, 2023

Perhaps i'm using it wrong, but:
str: { Hook('my_key', handler=my_handler): str, 'another_key': str }

breaks. this is due to the lack of processing and break statement when the handler returns at line 402. Perhaps i should use a class instead of handler function (I didn't look into this) 😺. As for now, I fixed it by adding:

skey.handler(nkey, data, e)
   try:
       nvalue = Schema(svalue, error=e, ignore_extra_keys=i).validate(value, **kwargs)
   except SchemaError as x:
       k = "Key '%s' error:" % nkey
       message = self._prepend_schema_name(k)
       raise SchemaError([message] + x.autos,
                         [e.format(data) if e else None] + x.errors)
   else:
       new[nkey] = nvalue
       coverage.add(skey)
       break
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