Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed #2437, #6091 -- Added "paste to dpaste" button to debug page. T…

…hanks,

Christian Metts, Erik Karulf, Simon Greenhill, dummy@habmalnefrage.de.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6820 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 13aa1970d44ab282fb2f1da763e558c84e0ca906 1 parent b6a6f66
@malcolmt malcolmt authored
Showing with 49 additions and 23 deletions.
  1. +1 −0  AUTHORS
  2. +48 −23 django/views/debug.py
View
1  AUTHORS
@@ -172,6 +172,7 @@ answer newbie questions, and generally made Django that much better:
junzhang.jn@gmail.com
Antti Kaihola <http://akaihola.blogspot.com/>
Nagy Károly <charlie@rendszergazda.com>
+ Erik Karulf <erik@karulf.com>
Ben Dean Kawamura <ben.dean.kawamura@gmail.com>
Ian G. Kelly <ian.g.kelly@gmail.com>
Thomas Kerpe <thomas@kerpe.net>
View
71 django/views/debug.py
@@ -131,7 +131,7 @@ def technical_500_response(request, exc_type, exc_value, tb):
if start is not None and end is not None:
unicode_str = exc_value.args[1]
unicode_hint = smart_unicode(unicode_str[max(start-5, 0):min(end+5, len(unicode_str))], 'ascii', errors='replace')
-
+ from django import get_version
t = Template(TECHNICAL_500_TEMPLATE, name='Technical 500 template')
c = Context({
'exception_type': exc_type.__name__,
@@ -144,6 +144,7 @@ def technical_500_response(request, exc_type, exc_value, tb):
'settings': get_safe_settings(),
'sys_executable' : sys.executable,
'sys_version_info' : '%d.%d.%d' % sys.version_info[0:3],
+ 'django_version_info' : get_version(),
'template_info': template_info,
'template_does_not_exist': template_does_not_exist,
'loader_debug_info': loader_debug_info,
@@ -275,6 +276,8 @@ def _get_lines_from_file(filename, lineno, context_lines, loader=None, module_na
#requestinfo h3 { margin-bottom:-1em; }
.error { background: #ffc; }
.specific { color:#cc3300; font-weight:bold; }
+ h2 span.commands { font-size:.7em;}
+ span.commands a:link {color:#5E5694;}
</style>
<script type="text/javascript">
//<!--
@@ -409,9 +412,7 @@ def _get_lines_from_file(filename, lineno, context_lines, loader=None, module_na
</div>
{% endif %}
<div id="traceback">
- <h2>Traceback <span>(innermost last)</span></h2>
- <div class="commands"><a href="#" onclick="return switchPastebinFriendly(this);">Switch to copy-and-paste view</a></div>
- <br/>
+ <h2>Traceback <span class="commands"><a href="#" onclick="return switchPastebinFriendly(this);">Switch to copy-and-paste view</a></span></h2>
{% autoescape off %}
<div id="browserTraceback">
<ul class="traceback">
@@ -456,27 +457,51 @@ def _get_lines_from_file(filename, lineno, context_lines, loader=None, module_na
{% endfor %}
</ul>
</div>
+ {% endautoescape %}
+ <form action="http://dpaste.com/" name="pasteform" id="pasteform" method="post">
<div id="pastebinTraceback" class="pastebin">
- <table>
- <tbody>
- <tr>
- <td>
- <code>
-Traceback (most recent call last):<br/>
-{% for frame in frames %}
- File "{{ frame.filename }}" in {{ frame.function }}<br/>
- {% if frame.context_line %}
- &nbsp;&nbsp;{{ frame.lineno }}. {{ frame.context_line|escape }}<br/>
- {% endif %}
-{% endfor %}<br/>
-&nbsp;&nbsp;{{ exception_type }} at {{ request.path|escape }}<br/>
-&nbsp;&nbsp;{{ exception_value|escape }}</code>
- </td>
- </tr>
- </tbody>
- </table>
+ <input type="hidden" name="language" value="PythonConsole" />
+ <input type="hidden" name="title" value="{{ exception_type|escape }} at {{ request.path|escape }}" />
+ <input type="hidden" name="source" value="Django Dpaste Agent" />
+ <input type="hidden" name="poster" value="Django" />
+ <textarea name="content" id="traceback_area" cols="140" rows="25">
+Environment:
+
+Request Method: {{ request.META.REQUEST_METHOD }}
+Request URL: {{ request_protocol }}://{{ request.META.HTTP_HOST }}{{ request.path|escape }}
+Django Version: {{ django_version_info }}
+Python Version: {{ sys_version_info }}
+Installed Applications:
+ {{ settings.INSTALLED_APPS|pprint }}
+Installed Middleware:
+ {{ settings.MIDDLEWARE_CLASSES|pprint }}
+
+{% if template_does_not_exist %}Template Loader Error:
+{% if loader_debug_info %}Django tried loading these templates, in this order:
+{% for loader in loader_debug_info %}Using loader {{ loader.loader }}:
+{% for t in loader.templates %}{{ t.name }} (File {% if t.exists %}exists{% else %}does not exist{% endif %})
+{% endfor %}{% endfor %}
+{% else %}Django couldn't find any templates because your TEMPLATE_LOADERS setting is empty!
+{% endif %}
+{% endif %}{% if template_info %}
+Template error:
+In template {{ template_info.name }}, error at line {{ template_info.line }}
+ {{ template_info.message }}{% for source_line in template_info.source_lines %}{% ifequal source_line.0 template_info.line %}
+ {{ source_line.0 }} : {{ template_info.before }} {{ template_info.during }} {{ template_info.after }}
+{% else %}
+ {{ source_line.0 }} : {{ source_line.1 }}
+{% endifequal %}{% endfor %}{% endif %}
+Traceback:
+{% for frame in frames %}File "{{ frame.filename|escape }}" in {{ frame.function|escape }}
+{% if frame.context_line %} {{ frame.lineno }}. {{ frame.context_line|escape }}{% endif %}
+{% endfor %}
+Exception Type: {{ exception_type|escape }} at {{ request.path|escape }}
+Exception Value: {{ exception_value|escape }}
+</textarea>
+ <br/><br/>
</div>
- {% endautoescape %}
+<input type="submit" value="Send to DPaste">
+</form>
</div>
<div id="requestinfo">
Please sign in to comment.
Something went wrong with that request. Please try again.