浏览代码

Advanced deprecation warnings for Django 4.0.

Mariusz Felisiak 4 年之前
父节点
当前提交
b4c5f878bd
共有 3 个文件被更改,包括 13 次插入5 次删除
  1. 3 3
      django/utils/deprecation.py
  2. 8 0
      docs/internals/deprecation.txt
  3. 2 2
      tests/runtests.py

+ 3 - 3
django/utils/deprecation.py

@@ -5,15 +5,15 @@ import warnings
 from asgiref.sync import sync_to_async
 from asgiref.sync import sync_to_async
 
 
 
 
-class RemovedInDjango40Warning(DeprecationWarning):
+class RemovedInDjango41Warning(DeprecationWarning):
     pass
     pass
 
 
 
 
-class RemovedInDjango41Warning(PendingDeprecationWarning):
+class RemovedInDjango50Warning(PendingDeprecationWarning):
     pass
     pass
 
 
 
 
-RemovedInNextVersionWarning = RemovedInDjango40Warning
+RemovedInNextVersionWarning = RemovedInDjango41Warning
 
 
 
 
 class warn_about_renamed_method:
 class warn_about_renamed_method:

+ 8 - 0
docs/internals/deprecation.txt

@@ -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-5.0:
+
+5.0
+---
+
+See the :ref:`Django 4.0 release notes <deprecated-features-4.0>` for more
+details on these changes.
+
 .. _deprecation-removed-in-4.1:
 .. _deprecation-removed-in-4.1:
 
 
 4.1
 4.1

+ 2 - 2
tests/runtests.py

@@ -25,7 +25,7 @@ else:
     from django.test.selenium import SeleniumTestCaseBase
     from django.test.selenium import SeleniumTestCaseBase
     from django.test.utils import NullTimeKeeper, TimeKeeper, get_runner
     from django.test.utils import NullTimeKeeper, TimeKeeper, get_runner
     from django.utils.deprecation import (
     from django.utils.deprecation import (
-        RemovedInDjango40Warning, RemovedInDjango41Warning,
+        RemovedInDjango41Warning, RemovedInDjango50Warning,
     )
     )
     from django.utils.log import DEFAULT_LOGGING
     from django.utils.log import DEFAULT_LOGGING
     from django.utils.version import PY37
     from django.utils.version import PY37
@@ -39,7 +39,7 @@ else:
     warnings.filterwarnings('ignore', r'\(1003, *', category=MySQLdb.Warning)
     warnings.filterwarnings('ignore', r'\(1003, *', category=MySQLdb.Warning)
 
 
 # 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", RemovedInDjango40Warning)
+warnings.simplefilter('error', RemovedInDjango50Warning)
 warnings.simplefilter('error', RemovedInDjango41Warning)
 warnings.simplefilter('error', RemovedInDjango41Warning)
 # Make resource and runtime warning errors to ensure no usage of error prone
 # Make resource and runtime warning errors to ensure no usage of error prone
 # patterns.
 # patterns.