diff options
| author | Preston Holmes <preston@ptone.com> | 2013-03-24 21:34:46 -0700 |
|---|---|---|
| committer | Preston Holmes <preston@ptone.com> | 2013-03-24 22:06:02 -0700 |
| commit | e79b857a07905340556f781a7d63016236b21c61 (patch) | |
| tree | ea310fbcb7c07aa70b48cbb4da9092d938fb062c /django/conf/__init__.py | |
| parent | 9c4882b391157f6aa3c0ade309638ffcd3bdf684 (diff) | |
Fixed #18985 -- ensure module level deprecations are displayed
Also don't compete with -W CLI option.
Thanks to Aymeric Augustin for the catch, and Claude Paroz for the patch.
Diffstat (limited to 'django/conf/__init__.py')
| -rw-r--r-- | django/conf/__init__.py | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/django/conf/__init__.py b/django/conf/__init__.py index efb56b2871..f876c490c8 100644 --- a/django/conf/__init__.py +++ b/django/conf/__init__.py @@ -8,6 +8,7 @@ a list of all possible variables. import logging import os +import sys import time # Needed for Windows import warnings @@ -57,14 +58,15 @@ class LazySettings(LazyObject): """ Setup logging from LOGGING_CONFIG and LOGGING settings. """ - try: - # Route warnings through python logging - logging.captureWarnings(True) - # Allow DeprecationWarnings through the warnings filters - warnings.simplefilter("default", DeprecationWarning) - except AttributeError: - # No captureWarnings on Python 2.6, DeprecationWarnings are on anyway - pass + if not sys.warnoptions: + try: + # Route warnings through python logging + logging.captureWarnings(True) + # Allow DeprecationWarnings through the warnings filters + warnings.simplefilter("default", DeprecationWarning) + except AttributeError: + # No captureWarnings on Python 2.6, DeprecationWarnings are on anyway + pass if self.LOGGING_CONFIG: from django.utils.log import DEFAULT_LOGGING |
