1
0
mirror of https://github.com/django/django.git synced 2025-11-07 07:15:35 +00:00

Fixed #21188 -- Introduced subclasses for to-be-removed-in-django-XX warnings

Thanks Anssi Kääriäinen for the idea and Simon Charette for the
review.
This commit is contained in:
Claude Paroz
2014-02-26 22:48:20 +01:00
parent 70ec4d776e
commit 210d0489c5
84 changed files with 287 additions and 189 deletions

View File

@@ -5,6 +5,7 @@ from django.db.utils import (DEFAULT_DB_ALIAS, DataError, OperationalError,
IntegrityError, InternalError, ProgrammingError, NotSupportedError,
DatabaseError, InterfaceError, Error, load_backend,
ConnectionHandler, ConnectionRouter)
from django.utils.deprecation import RemovedInDjango18Warning
from django.utils.functional import cached_property
@@ -61,7 +62,7 @@ class DefaultBackendProxy(object):
@cached_property
def _backend(self):
warnings.warn("Accessing django.db.backend is deprecated.",
DeprecationWarning, stacklevel=2)
RemovedInDjango18Warning, stacklevel=2)
return load_backend(connections[DEFAULT_DB_ALIAS].settings_dict['ENGINE'])
def __getattr__(self, item):
@@ -79,7 +80,7 @@ backend = DefaultBackendProxy()
def close_connection(**kwargs):
warnings.warn(
"close_connection is superseded by close_old_connections.",
DeprecationWarning, stacklevel=2)
RemovedInDjango18Warning, stacklevel=2)
# Avoid circular imports
from django.db import transaction
for conn in connections: