mirror of https://github.com/django/django.git
Advanced deprecations in contrib.auth.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15970 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
98d3a09338
commit
48edaf17a3
|
@ -21,19 +21,10 @@ def load_backend(path):
|
||||||
cls = getattr(mod, attr)
|
cls = getattr(mod, attr)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
raise ImproperlyConfigured('Module "%s" does not define a "%s" authentication backend' % (module, attr))
|
raise ImproperlyConfigured('Module "%s" does not define a "%s" authentication backend' % (module, attr))
|
||||||
if not hasattr(cls, "supports_object_permissions"):
|
|
||||||
warn("Authentication backends without a `supports_object_permissions` attribute are deprecated. Please define it in %s." % cls,
|
|
||||||
DeprecationWarning)
|
|
||||||
cls.supports_object_permissions = False
|
|
||||||
|
|
||||||
if not hasattr(cls, 'supports_anonymous_user'):
|
|
||||||
warn("Authentication backends without a `supports_anonymous_user` attribute are deprecated. Please define it in %s." % cls,
|
|
||||||
DeprecationWarning)
|
|
||||||
cls.supports_anonymous_user = False
|
|
||||||
|
|
||||||
if not hasattr(cls, 'supports_inactive_user'):
|
if not hasattr(cls, 'supports_inactive_user'):
|
||||||
warn("Authentication backends without a `supports_inactive_user` attribute are deprecated. Please define it in %s." % cls,
|
warn("Authentication backends without a `supports_inactive_user` attribute are deprecated. Please define it in %s." % cls,
|
||||||
PendingDeprecationWarning)
|
DeprecationWarning)
|
||||||
cls.supports_inactive_user = False
|
cls.supports_inactive_user = False
|
||||||
return cls()
|
return cls()
|
||||||
|
|
||||||
|
|
|
@ -386,13 +386,6 @@ class User(models.Model):
|
||||||
raise SiteProfileNotAvailable
|
raise SiteProfileNotAvailable
|
||||||
return self._profile_cache
|
return self._profile_cache
|
||||||
|
|
||||||
def _get_message_set(self):
|
|
||||||
import warnings
|
|
||||||
warnings.warn('The user messaging API is deprecated. Please update'
|
|
||||||
' your code to use the new messages framework.',
|
|
||||||
category=DeprecationWarning)
|
|
||||||
return self._message_set
|
|
||||||
message_set = property(_get_message_set)
|
|
||||||
|
|
||||||
class Message(models.Model):
|
class Message(models.Model):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -171,13 +171,9 @@ class RowlevelBackendTest(TestCase):
|
||||||
self.user1 = User.objects.create_user('test', 'test@example.com', 'test')
|
self.user1 = User.objects.create_user('test', 'test@example.com', 'test')
|
||||||
self.user2 = User.objects.create_user('test2', 'test2@example.com', 'test')
|
self.user2 = User.objects.create_user('test2', 'test2@example.com', 'test')
|
||||||
self.user3 = User.objects.create_user('test3', 'test3@example.com', 'test')
|
self.user3 = User.objects.create_user('test3', 'test3@example.com', 'test')
|
||||||
self.save_warnings_state()
|
|
||||||
warnings.filterwarnings('ignore', category=DeprecationWarning,
|
|
||||||
module='django.contrib.auth')
|
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
settings.AUTHENTICATION_BACKENDS = self.curr_auth
|
settings.AUTHENTICATION_BACKENDS = self.curr_auth
|
||||||
self.restore_warnings_state()
|
|
||||||
# The get_group_permissions test messes with ContentTypes, which will
|
# The get_group_permissions test messes with ContentTypes, which will
|
||||||
# be cached; flush the cache to ensure there are no side effects
|
# be cached; flush the cache to ensure there are no side effects
|
||||||
# Refs #14975, #14925
|
# Refs #14975, #14925
|
||||||
|
|
Loading…
Reference in New Issue