-
Notifications
You must be signed in to change notification settings - Fork 219
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
[BUG] get_settings() does not return the inherited settings #644
Comments
Hi! Thank you for the catch. I'll check it out in the next bug-fixing session. This or next week. |
Hi! It looks like I cannot solve this. Overriding this behavior is possible using metaclasses. However, Pydantic already uses its metaclass there. Python doesn't allow metaclass conflicts. If you have any ideas, please share. |
Thanks for taking a look. I guess all I am trying to achieve is to have some common settings to prevent duplicate code on each class as I have over 100 collections. Is there an alternative approach? |
Ok so something simple like this seems to work:
|
Feature / Fix: Allow Settings to be inherited and extended (fixes #644)
Describe the bug
When inheriting settings from a common class, get_settings() does not return the inherited settings.
To Reproduce
Expected behavior
doc.get_settings().bson_encoders (in this case) should return the same as doc.Settings.bson_encoder, i.e. the values from the inherited class.
Additional context
If
is removed, get_settings() works as expected.
The text was updated successfully, but these errors were encountered: