Ticket #8275: 8275.unused_imports.diff
File 8275.unused_imports.diff, 2.4 KB (added by , 16 years ago) |
---|
-
django/django/contrib/auth/views.py
2 2 from django.contrib.auth import REDIRECT_FIELD_NAME 3 3 from django.contrib.auth.decorators import login_required 4 4 from django.contrib.auth.forms import AuthenticationForm 5 from django.contrib.auth.forms import PasswordResetForm, SetPasswordForm, PasswordChangeForm , AdminPasswordChangeForm5 from django.contrib.auth.forms import PasswordResetForm, SetPasswordForm, PasswordChangeForm 6 6 from django.contrib.auth.tokens import default_token_generator 7 from django.core.exceptions import PermissionDenied8 7 from django.core.urlresolvers import reverse 9 8 from django.shortcuts import render_to_response, get_object_or_404 10 9 from django.contrib.sites.models import Site, RequestSite 11 10 from django.http import HttpResponseRedirect, Http404 12 11 from django.template import RequestContext 13 12 from django.utils.http import urlquote, base36_to_int 14 from django.utils.html import escape15 13 from django.utils.translation import ugettext as _ 16 14 from django.contrib.auth.models import User 17 import re18 15 19 16 def login(request, template_name='registration/login.html', redirect_field_name=REDIRECT_FIELD_NAME): 20 17 "Displays the login form and handles the login action." … … 24 21 if form.is_valid(): 25 22 # Light security check -- make sure redirect_to isn't garbage. 26 23 if not redirect_to or '//' in redirect_to or ' ' in redirect_to: 27 from django.conf import settings28 24 redirect_to = settings.LOGIN_REDIRECT_URL 29 25 from django.contrib.auth import login 30 26 login(request, form.get_user()) … … 57 53 def logout_then_login(request, login_url=None): 58 54 "Logs out the user if he is logged in. Then redirects to the log-in page." 59 55 if not login_url: 60 from django.conf import settings61 56 login_url = settings.LOGIN_URL 62 57 return logout(request, login_url) 63 58 64 59 def redirect_to_login(next, login_url=None, redirect_field_name=REDIRECT_FIELD_NAME): 65 60 "Redirects the user to the login page, passing the given 'next' page" 66 61 if not login_url: 67 from django.conf import settings68 62 login_url = settings.LOGIN_URL 69 63 return HttpResponseRedirect('%s?%s=%s' % (login_url, urlquote(redirect_field_name), urlquote(next))) 70 64