Ticket #18985: 18985-2.diff

File 18985-2.diff, 1.2 KB (added by Claude Paroz, 12 years ago)

Reactivate DeprecationWarning on 2.7+

  • django/conf/__init__.py

    diff --git a/django/conf/__init__.py b/django/conf/__init__.py
    index 7452013..a6631aa 100644
    a b variable, and then from django.conf.global_settings; see the global settings fil  
    66a list of all possible variables.
    77"""
    88
     9import logging
    910import os
    1011import time     # Needed for Windows
    1112import warnings
    class LazySettings(LazyObject):  
    5455        """
    5556        Setup logging from LOGGING_CONFIG and LOGGING settings.
    5657        """
     58        try:
     59            logging.captureWarnings(True)
     60            warnings.simplefilter("default", DeprecationWarning)
     61        except AttributeError:
     62            # No captureWarnings on Python 2.6, DeprecationWarnings are on anyway
     63            pass
     64
    5765        if self.LOGGING_CONFIG:
    5866            from django.utils.log import DEFAULT_LOGGING
    5967            # First find the logging configuration function ...
  • django/utils/log.py

    diff --git a/django/utils/log.py b/django/utils/log.py
    index ea01227..3852271 100644
    a b DEFAULT_LOGGING = {  
    6262            'level': 'ERROR',
    6363            'propagate': False,
    6464        },
     65        'py.warnings': {
     66            'handlers': ['console'],
     67        },
    6568    }
    6669}
    6770
Back to Top