Skip to content

Hook() breaks on custom handler #294

Description

@cdeckard

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions