Exemplo n.º 1
0
 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()
Exemplo n.º 2
0
 def test_import_env_raw(self):
     storage = BaseSettings()
     import_env_vars({'WEBLATE_FOO': '(r"/project/(.*)$$",)'}, storage)
     self.assertEqual(storage.FOO, ('/project/(.*)$',))
Exemplo n.º 3
0
 def test_import_env_env(self):
     storage = BaseSettings()
     import_env_vars({'WEBLATE_FOO': '"$BAR"', 'BAR': 'baz'}, storage)
     self.assertEqual(storage.FOO, 'baz')
Exemplo n.º 4
0
 def test_import_env_tuple(self):
     storage = BaseSettings()
     import_env_vars({'WEBLATE_FOO': '(1, 2)'}, storage)
     self.assertEqual(storage.FOO, (1, 2))
Exemplo n.º 5
0
 def test_import_env_int(self):
     storage = BaseSettings()
     import_env_vars({'WEBLATE_FOO': '1234'}, storage)
     self.assertEqual(storage.FOO, 1234)
Exemplo n.º 6
0
 def test_import_env_string(self):
     storage = BaseSettings()
     import_env_vars({'WEBLATE_FOO': '"bar"'}, storage)
     self.assertEqual(storage.FOO, 'bar')
Exemplo n.º 7
0
 def set_isolated(self, value):
     if value:
         self._isolated_overrides = BaseSettings()
     self._isolated = value