Code

Ticket #8287: wrong-url-r8338.patch

File wrong-url-r8338.patch, 3.6 KB (added by Giuliani Vito Ivan <giuliani.v@…>, 6 years ago)

Shows right URL informations in debug page

  • django/views/debug.py

     
    254254    t = Template(TECHNICAL_404_TEMPLATE, name='Technical 404 template') 
    255255    c = Context({ 
    256256        'root_urlconf': settings.ROOT_URLCONF, 
    257         'request_path': request.path[1:], # Trim leading slash 
     257        'request_path': request.path_info[1:], # Trim leading slash 
    258258        'urlpatterns': tried, 
    259259        'reason': str(exception), 
    260260        'request': request, 
     
    282282<head> 
    283283  <meta http-equiv="content-type" content="text/html; charset=utf-8"> 
    284284  <meta name="robots" content="NONE,NOARCHIVE"> 
    285   <title>{{ exception_type }} at {{ request.path|escape }}</title> 
     285  <title>{{ exception_type }} at {{ request.path_info|escape }}</title> 
    286286  <style type="text/css"> 
    287287    html * { padding:0; margin:0; } 
    288288    body * { padding:10px 20px; } 
     
    387387</head> 
    388388<body> 
    389389<div id="summary"> 
    390   <h1>{{ exception_type }} at {{ request.path|escape }}</h1> 
     390  <h1>{{ exception_type }} at {{ request.path_info|escape }}</h1> 
    391391  <h2>{{ exception_value|escape }}</h2> 
    392392  <table class="meta"> 
    393393    <tr> 
     
    396396    </tr> 
    397397    <tr> 
    398398      <th>Request URL:</th> 
    399       <td>{{ request_protocol }}://{{ request.META.HTTP_HOST }}{{ request.path|escape }}</td> 
     399      <td>{{ request_protocol }}://{{ request.META.HTTP_HOST }}{{ request.path_info|escape }}</td> 
    400400    </tr> 
    401401    <tr> 
    402402      <th>Exception Type:</th> 
     
    519519  <form action="http://dpaste.com/" name="pasteform" id="pasteform" method="post"> 
    520520  <div id="pastebinTraceback" class="pastebin"> 
    521521    <input type="hidden" name="language" value="PythonConsole"> 
    522     <input type="hidden" name="title" value="{{ exception_type|escape }} at {{ request.path|escape }}"> 
     522    <input type="hidden" name="title" value="{{ exception_type|escape }} at {{ request.path_info|escape }}"> 
    523523    <input type="hidden" name="source" value="Django Dpaste Agent"> 
    524524    <input type="hidden" name="poster" value="Django"> 
    525525    <textarea name="content" id="traceback_area" cols="140" rows="25"> 
    526526Environment: 
    527527 
    528528Request Method: {{ request.META.REQUEST_METHOD }} 
    529 Request URL: {{ request_protocol }}://{{ request.META.HTTP_HOST }}{{ request.path|escape }} 
     529Request URL: {{ request_protocol }}://{{ request.META.HTTP_HOST }}{{ request.path_info|escape }} 
    530530Django Version: {{ django_version_info }} 
    531531Python Version: {{ sys_version_info }} 
    532532Installed Applications: 
     
    553553{% for frame in frames %}File "{{ frame.filename|escape }}" in {{ frame.function|escape }} 
    554554{% if frame.context_line %}  {{ frame.lineno }}. {{ frame.context_line|escape }}{% endif %} 
    555555{% endfor %} 
    556 Exception Type: {{ exception_type|escape }} at {{ request.path|escape }} 
     556Exception Type: {{ exception_type|escape }} at {{ request.path_info|escape }} 
    557557Exception Value: {{ exception_value|escape }} 
    558558</textarea> 
    559559  <br><br> 
     
    686686<html lang="en"> 
    687687<head> 
    688688  <meta http-equiv="content-type" content="text/html; charset=utf-8"> 
    689   <title>Page not found at {{ request.path|escape }}</title> 
     689  <title>Page not found at {{ request.path_info|escape }}</title> 
    690690  <meta name="robots" content="NONE,NOARCHIVE"> 
    691691  <style type="text/css"> 
    692692    html * { padding:0; margin:0; } 
     
    716716      </tr> 
    717717      <tr> 
    718718        <th>Request URL:</th> 
    719       <td>{{ request_protocol }}://{{ request.META.HTTP_HOST }}{{ request.path|escape }}</td> 
     719      <td>{{ request_protocol }}://{{ request.META.HTTP_HOST }}{{ request.path_info|escape }}</td> 
    720720      </tr> 
    721721    </table> 
    722722  </div>