Changes between Version 2 and Version 5 of Ticket #25878

12/08/15 04:42:29 (7 years ago)
dong-won kang

I did test and look at the code, and I have question to the behavior.

I found failed test test_non_ascii_query_string_does_not_crash , and It requires http://testserver/slash/?drink=caf%C3%A9 to be redirected(301). I think It doesn't need to be, as there's no need to prepend WWW(False default) and redirect with slash.

I think the test should changed to self.assertEqual(r.status_code, None) , not 301.

and one more thing - this bug has occurred since I upgraded django from 1.8.7 to 1.9. In that case, URL without slash returns 500, not 404, and that makes process_response not working I think. I'm inspecting more about this.

thanks for your sincere.

PS. when debug=False, after Not Found URL occured, this exception occurs: TemplateSyntaxError: Could not parse the remainder: '('static', filename='img/404.jpg')' from 'url_for('static', filename='img/404.jpg')' , and that makes response code to 500, not 404.


  • Ticket #25878

    • Property Summary changed from Django 1.9 works well in Debug=True, but doesn't redirect unslash urls into slashed one in Debug=False to APPEND_SLASH doesn't work with DEBUG=False
  • Ticket #25878 – Description

    v2 v5  
    2020        # Check for a redirect based on settings.PREPEND_WWW
     21        redirect = False
    2122        host = request.get_host()
    23         redirect = False
    2424        if settings.PREPEND_WWW and host and not host.startswith('www.'):
     25            redirect = True
    2526            host = 'www.' + host
    26             redirect = True
    2828        # Check if we also need to append a slash so we can do it all
    2929        # with a single redirect.
    3030        if self.should_redirect_with_slash(request):
     31            redirect = True
    3132            path = self.get_full_path_with_slash(request)
    32             redirect = True
    3333        else:
    3434            path = request.get_full_path()
Back to Top