Adds support for marshmallow @post_load - #119
Conversation
Marshmallow `@post_load` decorator can be used as a factory object, to directly return an instance instead of the usual dictionary. This commit adds support for it.
Codecov Report
@@ Coverage Diff @@
## master #119 +/- ##
==========================================
+ Coverage 97.64% 97.65% +0.01%
==========================================
Files 8 8
Lines 339 341 +2
==========================================
+ Hits 331 333 +2
Misses 8 8
Continue to review full report at Codecov.
|
|
Any chance this could be merged? It looks like a pretty common problem... |
|
Can this be merged ? we are also hitting this. |
|
When it will be merged? |
|
Sorry for the delay on this. I can take a look and release this over the weekend. |
|
@sloria Thanks ! |
| if getattr(schema, 'many', False): | ||
| args += tuple(parsed) | ||
| else: | ||
| elif getattr(parsed, 'update', False): |
There was a problem hiding this comment.
There is risk of a false-positive here, e.g. model objects with an update method, so I think type-checking is preferable to duck-typing in this case.
I'll make this change myself.
Fixes #103
Marshmallow
@post_loaddecorator can be used as an object factory, to directly return an instance instead of the usual dictionary.This PR adds support for it, based on #104 plus tests.