question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ModelSchema.load(instance=None) call wont overridden .instance

See original GitHub issue

as 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:closed
  • Created 7 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
sloriacommented, Jan 5, 2017

I’ve just released 0.12.1, which should fix this bug. Thanks for reporting! Please reopen this if the issue persists.

2reactions
blurrcatcommented, Aug 23, 2016

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found