Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixed #822 -- Changed 500 view to use disclosure triangles instead of…
… up/down arrows. Thanks, aaronsw

git-svn-id: http://code.djangoproject.com/svn/django/trunk@1272 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
adrianholovaty committed Nov 17, 2005
1 parent 6be0210 commit b160356
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions django/views/debug.py
Expand Up @@ -33,8 +33,8 @@ def technical_500_response(request, exc_type, exc_value, tb):
'pre_context_lineno' : pre_context_lineno,
})
tb = tb.tb_next
# Turn the settings module into a dict, filtering out anything that

# Turn the settings module into a dict, filtering out anything that
# matches HIDDEN_SETTINGS along the way.
settings_dict = {}
for k in dir(settings):
Expand All @@ -43,7 +43,7 @@ def technical_500_response(request, exc_type, exc_value, tb):
settings_dict[k] = '********************'
else:
settings_dict[k] = getattr(settings, k)

t = Template(TECHNICAL_500_TEMPLATE)
c = Context({
'exception_type' : exc_type.__name__,
Expand All @@ -53,7 +53,7 @@ def technical_500_response(request, exc_type, exc_value, tb):
'request' : request,
'request_protocol' : os.environ.get("HTTPS") == "on" and "https" or "http",
'settings' : settings_dict,

})
return HttpResponseServerError(t.render(c))

Expand All @@ -66,7 +66,7 @@ def technical_404_response(request, exception):
tried = exception.args[0]['tried']
except (IndexError, TypeError):
tried = []

t = Template(TECHNICAL_404_TEMPLATE)
c = Context({
'root_urlconf' : settings.ROOT_URLCONF,
Expand All @@ -80,7 +80,7 @@ def technical_404_response(request, exception):

def _get_lines_from_file(filename, lineno, context_lines):
"""
Returns context_lines before and after lineno from file.
Returns context_lines before and after lineno from file.
Returns (pre_context_lineno, pre_context, context_line, post_context).
"""
try:
Expand All @@ -91,7 +91,7 @@ def _get_lines_from_file(filename, lineno, context_lines):
pre_context = [line.strip('\n') for line in source[lower_bound:lineno]]
context_line = source[lineno].strip('\n')
post_context = [line.strip('\n') for line in source[lineno+1:upper_bound]]

return lower_bound, pre_context, context_line, post_context
except (OSError, IOError):
return None, [], None, []
Expand Down Expand Up @@ -147,23 +147,23 @@ def _get_lines_from_file(filename, lineno, context_lines):
<script type="text/javascript">
function getElementsByClassName(oElm, strTagName, strClassName){
// Written by Jonathan Snook, http://www.snook.ca/jon; Add-ons by Robert Nyman, http://www.robertnyman.com
var arrElements = (strTagName == "*" && document.all)? document.all :
var arrElements = (strTagName == "*" && document.all)? document.all :
oElm.getElementsByTagName(strTagName);
var arrReturnElements = new Array();
strClassName = strClassName.replace(/\-/g, "\\-");
var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");
var oElement;
for(var i=0; i<arrElements.length; i++){
oElement = arrElements[i];
oElement = arrElements[i];
if(oRegExp.test(oElement.className)){
arrReturnElements.push(oElement);
}
}
}
return (arrReturnElements)
}
function hideAll(elems) {
for (var e = 0; e < elems.length; e++) {
elems[e].style.display = 'none';
for (var e = 0; e < elems.length; e++) {
elems[e].style.display = 'none';
}
}
window.onload = function() {
Expand All @@ -183,8 +183,8 @@ def _get_lines_from_file(filename, lineno, context_lines):
function varToggle(link, id) {
toggle('v' + id);
var s = link.getElementsByTagName('span')[0];
var uarr = String.fromCharCode(0x2191);
var darr = String.fromCharCode(0x2193);
var uarr = String.fromCharCode(0x25b6);
var darr = String.fromCharCode(0x25bc);
s.innerHTML = s.innerHTML == uarr ? darr : uarr;
return false;
}
Expand Down Expand Up @@ -225,7 +225,7 @@ def _get_lines_from_file(filename, lineno, context_lines):
{% for frame in frames %}
<li class="frame">
<code>{{ frame.filename }}</code> in <code>{{ frame.function }}</code>
{% if frame.context_line %}
<div class="context" id="c{{ frame.id }}">
{% if frame.pre_context %}
Expand All @@ -237,10 +237,10 @@ def _get_lines_from_file(filename, lineno, context_lines):
{% endif %}
</div>
{% endif %}
{% if frame.vars %}
<div class="commands">
<a href="#" onclick="return varToggle(this, '{{ frame.id }}')">Local vars <span>&darr;</span> </a>
<a href="#" onclick="return varToggle(this, '{{ frame.id }}')"><span>&#x25b6;</span> Local vars</a>
</div>
<table class="vars" id="v{{ frame.id }}">
<thead>
Expand All @@ -266,7 +266,7 @@ def _get_lines_from_file(filename, lineno, context_lines):
<div id="requestinfo">
<h2>Request information</h2>
<h3 id="get-info">GET</h3>
{% if request.GET %}
<table class="req">
Expand All @@ -288,7 +288,7 @@ def _get_lines_from_file(filename, lineno, context_lines):
{% else %}
<p>No GET data<p>
{% endif %}
<h3 id="post-info">POST</h3>
{% if request.POST %}
<table class="req">
Expand All @@ -310,7 +310,7 @@ def _get_lines_from_file(filename, lineno, context_lines):
{% else %}
<p>No POST data<p>
{% endif %}
<h3 id="cookie-info">COOKIES</h3>
{% if request.COOKIES %}
<table class="req">
Expand All @@ -332,7 +332,7 @@ def _get_lines_from_file(filename, lineno, context_lines):
{% else %}
<p>No cookie data<p>
{% endif %}
<h3 id="meta-info">META</h3>
<table class="req">
<thead>
Expand Down Expand Up @@ -434,12 +434,12 @@ def _get_lines_from_file(filename, lineno, context_lines):
<li>{{ pattern|escape }}</li>
{% endfor %}
</ol>
<p>The current URL, <code>{{ request.path }}</code>, didn't match any of these.</p>
<p>The current URL, <code>{{ request.path }}</code>, didn't match any of these.</p>
{% else %}
<p>{{ reason|escape }}</p>
{% endif %}
</div>
<div id="explanation">
<p>
You're seeing this error because you have <code>DEBUG = True</code> in
Expand Down

0 comments on commit b160356

Please sign in to comment.