| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Giving a transformer class instead of an instance made the parser call create_instance() on the class itself, with the class description as the self argument, and failed with a confusing missing argument error. v2 and v3 now check that argument up front. Fixes #54. Signed-off-by: Thomas Calmant <thomas.calmant@gmail.com>
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Summary
Giving a transformer class instead of an instance, i.e. load(fd, MyTransformer)
instead of load(fd, MyTransformer()), made the parser call
create_instance() on the class itself. The class description was then given
as the self argument, and the call failed with:
which points at the internals of the parser instead of the call of the user.
v2 and v3 now check that argument up front and explain what to do:
The check only rejects classes: transformers are duck-typed, so an instance
which does not inherit from ObjectTransformer is still accepted, as before.
Test plan
that load() and loads() both reject a class and that the message names
the transformer, and that instances are still accepted, with and without
inheriting from ObjectTransformer.
Fixes #54