diff options
| author | Claude Paroz <claude@2xlibre.net> | 2012-11-10 12:05:58 +0100 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2012-11-10 12:10:43 +0100 |
| commit | e6bc0c5babe97af86679ef7fe4f5975eb86f532f (patch) | |
| tree | 33ee07b4c1bd6feb98944d56d50cf58e84ceb779 | |
| parent | 6554137eebe4bd10bdf3f1be21f63f0a9cffd7ff (diff) | |
[1.5.x] Fixed #14264 -- Ensured settings.configure configures logging
Thanks Matt McDonald for the patch.
Backport of 34162698c from master.
| -rw-r--r-- | django/conf/__init__.py | 1 | ||||
| -rw-r--r-- | tests/regressiontests/logging_tests/tests.py | 19 |
2 files changed, 19 insertions, 1 deletions
diff --git a/django/conf/__init__.py b/django/conf/__init__.py index 1804c851bf..4e6f0f9211 100644 --- a/django/conf/__init__.py +++ b/django/conf/__init__.py @@ -83,6 +83,7 @@ class LazySettings(LazyObject): for name, value in options.items(): setattr(holder, name, value) self._wrapped = holder + self._configure_logging() @property def configured(self): diff --git a/tests/regressiontests/logging_tests/tests.py b/tests/regressiontests/logging_tests/tests.py index e40800efde..96f81981c6 100644 --- a/tests/regressiontests/logging_tests/tests.py +++ b/tests/regressiontests/logging_tests/tests.py @@ -4,7 +4,7 @@ import copy import logging import warnings -from django.conf import compat_patch_logging_config +from django.conf import compat_patch_logging_config, LazySettings from django.core import mail from django.test import TestCase, RequestFactory from django.test.utils import override_settings @@ -302,3 +302,20 @@ class SettingsConfigTest(AdminScriptTestCase): out, err = self.run_manage(['validate']) self.assertNoOutput(err) self.assertOutput(out, "0 errors found") + + +def dictConfig(config): + dictConfig.called = True +dictConfig.called = False + + +class SettingsConfigureLogging(TestCase): + """ + Test that calling settings.configure() initializes the logging + configuration. + """ + def test_configure_initializes_logging(self): + settings = LazySettings() + settings.configure( + LOGGING_CONFIG='regressiontests.logging_tests.tests.dictConfig') + self.assertTrue(dictConfig.called) |
