django.conf.UserSettingsHolder - python examples

Here are the examples of the python api django.conf.UserSettingsHolder taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

4 Examples 7

3 View Complete Implementation : utils.py
Copyright GNU General Public License v2.0
Author : blackye
    def enable(self):
        override = UserSettingsHolder(settings._wrapped)
        for key, new_value in self.options.items():
            setattr(override, key, new_value)
        settings._wrapped = override
        for key, new_value in self.options.items():
            setting_changed.send(sender=settings._wrapped.__clast__,
                                 setting=key, value=new_value)

3 View Complete Implementation : utils.py
Copyright MIT License
Author : bpgc-cte
    def enable(self):
        # Keep this code at the beginning to leave the settings unchanged
        # in case it raises an exception because INSTALLED_APPS is invalid.
        if 'INSTALLED_APPS' in self.options:
            try:
                apps.set_installed_apps(self.options['INSTALLED_APPS'])
            except Exception:
                apps.unset_installed_apps()
                raise
        override = UserSettingsHolder(settings._wrapped)
        for key, new_value in self.options.items():
            setattr(override, key, new_value)
        self.wrapped = settings._wrapped
        settings._wrapped = override
        for key, new_value in self.options.items():
            setting_changed.send(sender=settings._wrapped.__clast__,
                                 setting=key, value=new_value, enter=True)

3 View Complete Implementation : utils.py
Copyright Apache License 2.0
Author : edisonlz
    def enable(self):
        override = UserSettingsHolder(settings._wrapped)
        for key, new_value in self.options.items():
            setattr(override, key, new_value)
        self.wrapped = settings._wrapped
        settings._wrapped = override
        for key, new_value in self.options.items():
            setting_changed.send(sender=settings._wrapped.__clast__,
                                 setting=key, value=new_value)

0 View Complete Implementation : django.py
Copyright MIT License
Author : kiwicom
    def is_overridden(self, item):
        """Only for cases when Django's `override_settings` is used."""
        return isinstance(self.django_settings, conf.UserSettingsHolder) and self.django_settings.is_overridden(item)