Commit 710c59bf authored by Claude Paroz's avatar Claude Paroz
Browse files

Slightly reworked imports in contrib.auth.__init__

parent dc43fbc2
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
import re

from django.contrib.auth.signals import user_logged_in, user_logged_out, user_login_failed
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured, PermissionDenied
from django.utils.module_loading import import_by_path

from .signals import user_logged_in, user_logged_out, user_login_failed

SESSION_KEY = '_auth_user_id'
BACKEND_SESSION_KEY = '_auth_user_backend'
REDIRECT_FIELD_NAME = 'next'
@@ -14,7 +16,6 @@ def load_backend(path):


def get_backends():
    from django.conf import settings
    backends = []
    for backend_path in settings.AUTHENTICATION_BACKENDS:
        backends.append(load_backend(backend_path))
@@ -106,7 +107,6 @@ def logout(request):

def get_user_model():
    "Return the User model that is active in this project"
    from django.conf import settings
    from django.db.models import get_model

    try:
@@ -120,8 +120,7 @@ def get_user_model():


def get_user(request):
    from django.conf import settings
    from django.contrib.auth.models import AnonymousUser
    from .models import AnonymousUser
    try:
        user_id = request.session[SESSION_KEY]
        backend_path = request.session[BACKEND_SESSION_KEY]