Ticket #14264: 14264.3.diff

File 14264.3.diff, 1.6 KB (added by Matt McDonald, 12 years ago)
  • django/conf/__init__.py

    diff --git a/django/conf/__init__.py b/django/conf/__init__.py
    index 1804c85..4e6f0f9 100644
    a b class LazySettings(LazyObject):  
    8383        for name, value in options.items():
    8484            setattr(holder, name, value)
    8585        self._wrapped = holder
     86        self._configure_logging()
    8687
    8788    @property
    8889    def configured(self):
  • tests/regressiontests/logging_tests/tests.py

    diff --git a/tests/regressiontests/logging_tests/tests.py b/tests/regressiontests/logging_tests/tests.py
    index e40800e..02d37be 100644
    a b import copy  
    44import logging
    55import warnings
    66
    7 from django.conf import compat_patch_logging_config
     7from django.conf import compat_patch_logging_config, LazySettings
    88from django.core import mail
    99from django.test import TestCase, RequestFactory
    1010from django.test.utils import override_settings
    class SettingsConfigTest(AdminScriptTestCase):  
    302302        out, err = self.run_manage(['validate'])
    303303        self.assertNoOutput(err)
    304304        self.assertOutput(out, "0 errors found")
     305
     306
     307def dictConfig(config):
     308  dictConfig.called = True
     309dictConfig.called = False
     310
     311
     312class SettingsConfigureLogging(SimpleTestCase):
     313    """
     314    Test that calling settings.configure() initializes the logging
     315    configuration.
     316    """
     317    def test_configure_initializes_logging(self):
     318      settings = LazySettings()
     319      settings.configure(
     320          LOGGING_CONFIG='regressiontests.logging_tests.tests.dictConfig')
     321      self.assertTrue(dictConfig.called)
Back to Top