Skip to content

Settings file to declare what settings should be merged#2294

Merged
mauromsl merged 5 commits into
b_1_5_2from
2284-bugfix
Mar 12, 2024
Merged

Settings file to declare what settings should be merged#2294
mauromsl merged 5 commits into
b_1_5_2from
2284-bugfix

Conversation

@mauromsl

@mauromsl mauromsl commented Jul 8, 2021

Copy link
Copy Markdown
Member

Instead of mandating what settting iterables should be merged from the
runtime, a user writing a custom settings module can declare a set of
MERGEABLE_SETTINGS

Closes #2284

Instead of mandating what settting iterables should be merged from the
runtime, a user writing a custom settings module can declare a set of
MERGEABLE_SETTINGS

@alexdutton alexdutton left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me (just the one minor comment), and solves my problem. :-D

Comment thread src/utils/__init__.py Outdated
LOCK = threading.Lock()

MERGEABLE_SETTINGS = {"INSTALLED_APPS", "MIDDLEWARE_CLASSES"}
MERGEABLE_SETTINGS = {}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't look to be used anymore?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We try to be extra defensive when removing public constants like this in case a plugin out there might be using them, so we keep them for at least one release cycle.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense :-). For full backwards-compatibility then, should this be unchanged, and be the default if it's not provided in custom_settings?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, though as {} it's now a dictionary and not a set as before :-)

@ajrbyers

Copy link
Copy Markdown
Member

test this please

@mauromsl mauromsl requested a review from ajrbyers March 12, 2024 08:29
@mauromsl mauromsl marked this pull request as ready for review March 12, 2024 08:30
@mauromsl mauromsl changed the base branch from master to b_1_5_2 March 12, 2024 08:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

No open projects
Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

Merging settings makes it almost impossible to fully override settings

3 participants