ModelSchema.load(instance=None) call wont overridden .instance
See original GitHub issueas in ModelSchema.load
self.instance = instance or self.instance
because I instantiation schema class in module level, reuse them in multiple places and across requests,
the .instance
value firstly set will persists in following load()
calls, regardless load(instance=None)
, this will trigger nasty bug as its value depends on request order.
is there a good reason for this behavior and not just set self.instance
from parameter?
or should I instantiation a new schema object before any load
or dump
call?
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
"Unknown field" after updating to 3.5.0 marshmallow
or when calling load. UserSchema().load(data, unknown=EXCLUDE). The unknown option value set in load will override the value applied at ...
Read more >API Reference - marshmallow-sqlalchemy
Deserialize a serialized value to a model instance. If the parent schema is transient, create a new (transient) instance. Otherwise, attempt to find...
Read more >marshmallow-sqlalchemy - Read the Docs
It can be tedious to implement a large number of schemas if not overriding any of the generated fields as detailed above.
Read more >marshmallow-sqlalchemy from marshmallow-code - GithubHelp
ModelSchema.load(instance=None) call wont overridden .instance. as in ModelSchema.load. self.instance = instance or self.instance.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ve just released 0.12.1, which should fix this bug. Thanks for reporting! Please reopen this if the issue persists.
I’m experiencing the same problem and it costs me the whole afternoon. I feel there’s no point keeping the instance on the schema.