Advanced deprecation warnings for Django 2.0.

This commit is contained in:
Tim Graham 2017-01-10 10:06:07 -05:00
parent e27e4c0339
commit f847308200
3 changed files with 13 additions and 5 deletions

View File

@ -4,15 +4,15 @@ import inspect
import warnings import warnings
class RemovedInDjango20Warning(DeprecationWarning): class RemovedInDjango30Warning(PendingDeprecationWarning):
pass pass
class RemovedInDjango21Warning(PendingDeprecationWarning): class RemovedInDjango21Warning(DeprecationWarning):
pass pass
RemovedInNextVersionWarning = RemovedInDjango20Warning RemovedInNextVersionWarning = RemovedInDjango21Warning
class warn_about_renamed_method(object): class warn_about_renamed_method(object):

View File

@ -7,6 +7,14 @@ in a backward incompatible way, following their deprecation, as per the
:ref:`deprecation policy <internal-release-deprecation-policy>`. More details :ref:`deprecation policy <internal-release-deprecation-policy>`. More details
about each item can often be found in the release notes of two versions prior. about each item can often be found in the release notes of two versions prior.
.. _deprecation-removed-in-3.0:
3.0
---
See the :ref:`Django 2.0 release notes<deprecated-features-2.0>` for more
details on these changes.
.. _deprecation-removed-in-2.1: .. _deprecation-removed-in-2.1:
2.1 2.1

View File

@ -20,12 +20,12 @@ from django.test.utils import get_runner
from django.utils import six from django.utils import six
from django.utils._os import upath from django.utils._os import upath
from django.utils.deprecation import ( from django.utils.deprecation import (
RemovedInDjango20Warning, RemovedInDjango21Warning, RemovedInDjango21Warning, RemovedInDjango30Warning,
) )
from django.utils.log import DEFAULT_LOGGING from django.utils.log import DEFAULT_LOGGING
# Make deprecation warnings errors to ensure no usage of deprecated features. # Make deprecation warnings errors to ensure no usage of deprecated features.
warnings.simplefilter("error", RemovedInDjango20Warning) warnings.simplefilter("error", RemovedInDjango30Warning)
warnings.simplefilter("error", RemovedInDjango21Warning) warnings.simplefilter("error", RemovedInDjango21Warning)
# Make runtime warning errors to ensure no usage of error prone patterns. # Make runtime warning errors to ensure no usage of error prone patterns.
warnings.simplefilter("error", RuntimeWarning) warnings.simplefilter("error", RuntimeWarning)