Ticket #5308: decorators.py.patch

File decorators.py.patch, 920 bytes (added by Julian Bez, 17 years ago)
  • decorators.py

     
    11from django.contrib.auth import REDIRECT_FIELD_NAME
    22from django.http import HttpResponseRedirect
    3 from urllib import quote
     3from django.utils.http import urlquote
    44
    55def user_passes_test(test_func, login_url=None):
    66    """
     
    1515        def _checklogin(request, *args, **kwargs):
    1616            if test_func(request.user):
    1717                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())))
    1919        _checklogin.__doc__ = view_func.__doc__
    2020        _checklogin.__dict__ = view_func.__dict__
    2121
Back to Top