Ticket #3210: test-client-absolute-urls.diff

File test-client-absolute-urls.diff, 1.1 KB (added by ben <ben.dean.kawamura@…>, 18 years ago)
  • django/test/client.py

     
    11from cStringIO import StringIO
     2from urlparse import urlparse
    23from django.core.handlers.base import BaseHandler
    34from django.core.handlers.wsgi import WSGIRequest
    45from django.dispatch import dispatcher
     
    192193        if response.status_code != 302:
    193194            return False
    194195
    195         login_path, data = response['Location'].split('?')
     196        _, _, login_path, _, data, _= urlparse(response['Location'])
    196197        next = data.split('=')[1]
    197198
    198199        # Second, GET the login page; required to set up cookies
     
    209210        response = self.post(login_path, data=form_data, **extra)
    210211
    211212        # Login page should 302 redirect to the originally requested page
    212         if response.status_code != 302 or response['Location'] != path:
     213        if (response.status_code != 302 or
     214                urlparse(response['Location'])[2] != path):
    213215            return False
    214216
    215217        # Since we are logged in, request the actual page again
Back to Top