Commit 48edaf17 authored by Russell Keith-Magee's avatar Russell Keith-Magee
Browse files

Advanced deprecations in contrib.auth.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@15970 bcc190cf-cafb-0310-a4f2-bffc1f526a37
parent 98d3a093
Loading
Loading
Loading
Loading
+1 −10
Original line number Diff line number Diff line
@@ -21,19 +21,10 @@ def load_backend(path):
        cls = getattr(mod, attr)
    except AttributeError:
        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'):
        warn("Authentication backends without a `supports_inactive_user` attribute are deprecated. Please define it in %s." % cls,
             PendingDeprecationWarning)
             DeprecationWarning)
        cls.supports_inactive_user = False
    return cls()

+0 −7
Original line number Diff line number Diff line
@@ -386,13 +386,6 @@ class User(models.Model):
                raise SiteProfileNotAvailable
        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):
    """
+0 −4
Original line number Diff line number Diff line
@@ -171,13 +171,9 @@ class RowlevelBackendTest(TestCase):
        self.user1 = User.objects.create_user('test', 'test@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.save_warnings_state()
        warnings.filterwarnings('ignore', category=DeprecationWarning,
                                module='django.contrib.auth')

    def tearDown(self):
        settings.AUTHENTICATION_BACKENDS = self.curr_auth
        self.restore_warnings_state()
        # The get_group_permissions test messes with ContentTypes, which will
        # be cached; flush the cache to ensure there are no side effects
        # Refs #14975, #14925