django.conf.BaseSettings

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

7 Examples 7

Example 1

Project: easy-thumbnails Source File: conf.py
Function: revert
    def revert(self):
        """
        Revert any changes made to settings.
        """
        for attr, value in self._changed.items():
            setattr(django_settings, attr, value)
        for attr in self._added:
            delattr(django_settings, attr)
        self._changed = {}
        self._added = []
        if self.isolated:
            self._isolated_overrides = BaseSettings()

Example 2

Project: easy-thumbnails Source File: conf.py
    def set_isolated(self, value):
        if value:
            self._isolated_overrides = BaseSettings()
        self._isolated = value

Example 3

Project: weblate Source File: test_openshift.py
    def test_import_env_string(self):
        storage = BaseSettings()
        import_env_vars({'WEBLATE_FOO': '"bar"'}, storage)
        self.assertEqual(storage.FOO, 'bar')

Example 4

Project: weblate Source File: test_openshift.py
    def test_import_env_int(self):
        storage = BaseSettings()
        import_env_vars({'WEBLATE_FOO': '1234'}, storage)
        self.assertEqual(storage.FOO, 1234)

Example 5

Project: weblate Source File: test_openshift.py
    def test_import_env_tuple(self):
        storage = BaseSettings()
        import_env_vars({'WEBLATE_FOO': '(1, 2)'}, storage)
        self.assertEqual(storage.FOO, (1, 2))

Example 6

Project: weblate Source File: test_openshift.py
    def test_import_env_env(self):
        storage = BaseSettings()
        import_env_vars({'WEBLATE_FOO': '"$BAR"', 'BAR': 'baz'}, storage)
        self.assertEqual(storage.FOO, 'baz')

Example 7

Project: weblate Source File: test_openshift.py
    def test_import_env_raw(self):
        storage = BaseSettings()
        import_env_vars({'WEBLATE_FOO': '(r"/project/(.*)$$",)'}, storage)
        self.assertEqual(storage.FOO, ('/project/(.*)$',))