Skip to content
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

Allow customization of the setting name #735

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions pipeline/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
from django.core.signals import setting_changed
from django.dispatch import receiver

if getattr(_settings, "PIPELINE_SETTING_NAME", ""):
setting_name = getattr(_settings, "PIPELINE_SETTING_NAME")
else:
setting_name = "PIPELINE"

DEFAULTS = {
'PIPELINE_ENABLED': not _settings.DEBUG,
Expand Down Expand Up @@ -115,10 +119,10 @@ def __getattr__(self, name):
return self.__getitem__(name)


settings = PipelineSettings(_settings.PIPELINE)
settings = PipelineSettings(getattr(_settings, setting_name))


@receiver(setting_changed)
def reload_settings(**kwargs):
if kwargs['setting'] == 'PIPELINE':
if kwargs['setting'] == setting_name:
settings.update(kwargs['value'])