Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
ModelSchema.load(instance=None) call wont overridden .instance #78
self.instance = instance or self.instance
because I instantiation schema class in module level, reuse them in multiple places and across requests,
is there a good reason for this behavior and not just set
Is it just me or is marshallow-sqlalchemy currently not usable when reusing the schema due to this bug? If you use the "load" method and pass through an instance (for example in a REST call that modifies a resource) the instance will then stick and it will use that instance for subsequent REST calls. Creating a new resource by using the load method will just reuse the instance and thus modify that instance instead of creating a new SQLAlchemy model. Here's some minimal code that's affected by this issue:
Create a puppy, then edit it and finally create another new puppy. Instead of creating the second puppy, it will just edit the first one.
@nielstuts It's usable, just not like what you'd expect.