Ticket #5308: decorators.py.patch
File decorators.py.patch, 920 bytes (added by , 17 years ago) |
---|
-
decorators.py
1 1 from django.contrib.auth import REDIRECT_FIELD_NAME 2 2 from django.http import HttpResponseRedirect 3 from urllib importquote3 from django.utils.http import urlquote 4 4 5 5 def user_passes_test(test_func, login_url=None): 6 6 """ … … 15 15 def _checklogin(request, *args, **kwargs): 16 16 if test_func(request.user): 17 17 return view_func(request, *args, **kwargs) 18 return HttpResponseRedirect('%s?%s=%s' % (login_url, REDIRECT_FIELD_NAME, quote(request.get_full_path())))18 return HttpResponseRedirect('%s?%s=%s' % (login_url, REDIRECT_FIELD_NAME, urlquote(request.get_full_path()))) 19 19 _checklogin.__doc__ = view_func.__doc__ 20 20 _checklogin.__dict__ = view_func.__dict__ 21 21