Fixed #1420 -- Added copy-and-paste (pastebin-friendly) toggle for debug view. Thanks, jpaulofarias

git-svn-id: http://code.djangoproject.com/svn/django/trunk@2444 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2006-02-28 15:52:57 +00:00
parent f15a983d88
commit 074299db83
1 changed files with 69 additions and 37 deletions

View File

@ -255,6 +255,7 @@ TECHNICAL_500_TEMPLATE = """
hideAll(getElementsByClassName(document, 'table', 'vars'));
hideAll(getElementsByClassName(document, 'ol', 'pre-context'));
hideAll(getElementsByClassName(document, 'ol', 'post-context'));
hideAll(getElementsByClassName(document, 'div', 'pastebin'));
}
function toggle() {
for (var i = 0; i < arguments.length; i++) {
@ -273,6 +274,13 @@ TECHNICAL_500_TEMPLATE = """
s.innerHTML = s.innerHTML == uarr ? darr : uarr;
return false;
}
function switchPastebinFriendly(link) {
s1 = "Switch to copy-and-paste view";
s2 = "Switch back to interactive view";
link.innerHTML = link.innerHTML == s1 ? s2 : s1;
toggle('browserTraceback', 'pastebinTraceback');
return false;
}
//-->
</script>
</head>
@ -341,6 +349,9 @@ TECHNICAL_500_TEMPLATE = """
{% 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/>
<div id="browserTraceback">
<ul class="traceback">
{% for frame in frames %}
<li class="frame">
@ -382,6 +393,27 @@ TECHNICAL_500_TEMPLATE = """
</li>
{% endfor %}
</ul>
</div>
<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|add:"1" }}. {{ frame.context_line|escape }}<br/>
{% endif %}
{% endfor %}<br/>
&nbsp;&nbsp;{{ exception_type }} at {{ request.path }}<br/>
&nbsp;&nbsp;{{ exception_value|escape }}</code>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div id="requestinfo">