New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inherit ordered schemas when Meta is defined #593
Conversation
79424f0
to
8340246
Compare
I have reimplemented this feature in a cleaner way. Originally, I patched the |
We should not be messing with Python's inheritance behavior any more than necessary. from marshmallow import Schema
class Parent(Schema):
class Meta:
ordered = True
class Child(Schema):
class Meta(Parent.Meta):
pass
assert Child().opts.ordered is True |
Without this change we have inconsistent behavior as |
I am talking about these lines: marshmallow/marshmallow/schema.py Lines 84 to 97 in 596015a
ordered option there and since you already treat the schema as ordered, it is absolutely fine to help the SchemaOpts to set the ordered value correctly.
This behavior was introduced 2 years ago in 927704b to close #162. BTW, if the Meta is inherited, we won't break anything as marshmallow/marshmallow/schema.py Line 83 in 596015a
|
OK, thanks for your input. I will take a closer look at this when I have the time. |
@frol OK, this looks like a good change. Since this is a bug fix, would you mind resending the PR to the |
Thank you for your review! I agree it is should be in 2.x-line. I will do this shortly. |
8340246
to
3ffb74d
Compare
Rebased and changed the target branch. |
Thanks for the quick turnaround! |
No description provided.