Fixed #8287: the debug page now shows the actual requested URL even if you've messed with request.path. Patch from Giuliani Vito Ivan.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@8633 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Jacob Kaplan-Moss 2008-08-27 19:59:29 +00:00
parent 2e9a8801d0
commit 887f778794
1 changed files with 9 additions and 9 deletions

View File

@ -254,7 +254,7 @@ def technical_404_response(request, exception):
t = Template(TECHNICAL_404_TEMPLATE, name='Technical 404 template') t = Template(TECHNICAL_404_TEMPLATE, name='Technical 404 template')
c = Context({ c = Context({
'root_urlconf': settings.ROOT_URLCONF, 'root_urlconf': settings.ROOT_URLCONF,
'request_path': request.path[1:], # Trim leading slash 'request_path': request.path_info[1:], # Trim leading slash
'urlpatterns': tried, 'urlpatterns': tried,
'reason': smart_str(exception, errors='replace'), 'reason': smart_str(exception, errors='replace'),
'request': request, 'request': request,
@ -282,7 +282,7 @@ TECHNICAL_500_TEMPLATE = """
<head> <head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="robots" content="NONE,NOARCHIVE"> <meta name="robots" content="NONE,NOARCHIVE">
<title>{{ exception_type }} at {{ request.path|escape }}</title> <title>{{ exception_type }} at {{ request.path_info|escape }}</title>
<style type="text/css"> <style type="text/css">
html * { padding:0; margin:0; } html * { padding:0; margin:0; }
body * { padding:10px 20px; } body * { padding:10px 20px; }
@ -388,7 +388,7 @@ TECHNICAL_500_TEMPLATE = """
</head> </head>
<body> <body>
<div id="summary"> <div id="summary">
<h1>{{ exception_type }} at {{ request.path|escape }}</h1> <h1>{{ exception_type }} at {{ request.path_info|escape }}</h1>
<pre class="exception_value">{{ exception_value|escape }}</pre> <pre class="exception_value">{{ exception_value|escape }}</pre>
<table class="meta"> <table class="meta">
<tr> <tr>
@ -397,7 +397,7 @@ TECHNICAL_500_TEMPLATE = """
</tr> </tr>
<tr> <tr>
<th>Request URL:</th> <th>Request URL:</th>
<td>{{ request_protocol }}://{{ request.META.HTTP_HOST }}{{ request.path|escape }}</td> <td>{{ request_protocol }}://{{ request.META.HTTP_HOST }}{{ request.path_info|escape }}</td>
</tr> </tr>
<tr> <tr>
<th>Exception Type:</th> <th>Exception Type:</th>
@ -520,14 +520,14 @@ TECHNICAL_500_TEMPLATE = """
<form action="http://dpaste.com/" name="pasteform" id="pasteform" method="post"> <form action="http://dpaste.com/" name="pasteform" id="pasteform" method="post">
<div id="pastebinTraceback" class="pastebin"> <div id="pastebinTraceback" class="pastebin">
<input type="hidden" name="language" value="PythonConsole"> <input type="hidden" name="language" value="PythonConsole">
<input type="hidden" name="title" value="{{ exception_type|escape }} at {{ request.path|escape }}"> <input type="hidden" name="title" value="{{ exception_type|escape }} at {{ request.path_info|escape }}">
<input type="hidden" name="source" value="Django Dpaste Agent"> <input type="hidden" name="source" value="Django Dpaste Agent">
<input type="hidden" name="poster" value="Django"> <input type="hidden" name="poster" value="Django">
<textarea name="content" id="traceback_area" cols="140" rows="25"> <textarea name="content" id="traceback_area" cols="140" rows="25">
Environment: Environment:
Request Method: {{ request.META.REQUEST_METHOD }} Request Method: {{ request.META.REQUEST_METHOD }}
Request URL: {{ request_protocol }}://{{ request.META.HTTP_HOST }}{{ request.path|escape }} Request URL: {{ request_protocol }}://{{ request.META.HTTP_HOST }}{{ request.path_info|escape }}
Django Version: {{ django_version_info }} Django Version: {{ django_version_info }}
Python Version: {{ sys_version_info }} Python Version: {{ sys_version_info }}
Installed Applications: Installed Applications:
@ -554,7 +554,7 @@ Traceback:
{% for frame in frames %}File "{{ frame.filename|escape }}" in {{ frame.function|escape }} {% for frame in frames %}File "{{ frame.filename|escape }}" in {{ frame.function|escape }}
{% if frame.context_line %} {{ frame.lineno }}. {{ frame.context_line|escape }}{% endif %} {% if frame.context_line %} {{ frame.lineno }}. {{ frame.context_line|escape }}{% endif %}
{% endfor %} {% endfor %}
Exception Type: {{ exception_type|escape }} at {{ request.path|escape }} Exception Type: {{ exception_type|escape }} at {{ request.path_info|escape }}
Exception Value: {{ exception_value|escape }} Exception Value: {{ exception_value|escape }}
</textarea> </textarea>
<br><br> <br><br>
@ -687,7 +687,7 @@ TECHNICAL_404_TEMPLATE = """
<html lang="en"> <html lang="en">
<head> <head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Page not found at {{ request.path|escape }}</title> <title>Page not found at {{ request.path_info|escape }}</title>
<meta name="robots" content="NONE,NOARCHIVE"> <meta name="robots" content="NONE,NOARCHIVE">
<style type="text/css"> <style type="text/css">
html * { padding:0; margin:0; } html * { padding:0; margin:0; }
@ -717,7 +717,7 @@ TECHNICAL_404_TEMPLATE = """
</tr> </tr>
<tr> <tr>
<th>Request URL:</th> <th>Request URL:</th>
<td>{{ request_protocol }}://{{ request.META.HTTP_HOST }}{{ request.path|escape }}</td> <td>{{ request_protocol }}://{{ request.META.HTTP_HOST }}{{ request.path_info|escape }}</td>
</tr> </tr>
</table> </table>
</div> </div>