Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
Malcolm Tredinnick authored December 02, 2007
1  AUTHORS
@@ -172,6 +172,7 @@ answer newbie questions, and generally made Django that much better:
172 172
     junzhang.jn@gmail.com
173 173
     Antti Kaihola <http://akaihola.blogspot.com/>
174 174
     Nagy Károly <charlie@rendszergazda.com>
  175
+    Erik Karulf <erik@karulf.com>
175 176
     Ben Dean Kawamura <ben.dean.kawamura@gmail.com>
176 177
     Ian G. Kelly <ian.g.kelly@gmail.com>
177 178
     Thomas Kerpe <thomas@kerpe.net>
71  django/views/debug.py
@@ -131,7 +131,7 @@ def technical_500_response(request, exc_type, exc_value, tb):
131 131
         if start is not None and end is not None:
132 132
             unicode_str = exc_value.args[1]
133 133
             unicode_hint = smart_unicode(unicode_str[max(start-5, 0):min(end+5, len(unicode_str))], 'ascii', errors='replace')
134  
-
  134
+    from django import get_version
135 135
     t = Template(TECHNICAL_500_TEMPLATE, name='Technical 500 template')
136 136
     c = Context({
137 137
         'exception_type': exc_type.__name__,
@@ -144,6 +144,7 @@ def technical_500_response(request, exc_type, exc_value, tb):
144 144
         'settings': get_safe_settings(),
145 145
         'sys_executable' : sys.executable,
146 146
         'sys_version_info' : '%d.%d.%d' % sys.version_info[0:3],
  147
+        'django_version_info' : get_version(),
147 148
         'template_info': template_info,
148 149
         'template_does_not_exist': template_does_not_exist,
149 150
         'loader_debug_info': loader_debug_info,
@@ -275,6 +276,8 @@ def _get_lines_from_file(filename, lineno, context_lines, loader=None, module_na
275 276
     #requestinfo h3 { margin-bottom:-1em; }
276 277
     .error { background: #ffc; }
277 278
     .specific { color:#cc3300; font-weight:bold; }
  279
+    h2 span.commands { font-size:.7em;}
  280
+    span.commands a:link {color:#5E5694;}
278 281
   </style>
279 282
   <script type="text/javascript">
280 283
   //<!--
@@ -409,9 +412,7 @@ def _get_lines_from_file(filename, lineno, context_lines, loader=None, module_na
409 412
 </div>
410 413
 {% endif %}
411 414
 <div id="traceback">
412  
-  <h2>Traceback <span>(innermost last)</span></h2>
413  
-  <div class="commands"><a href="#" onclick="return switchPastebinFriendly(this);">Switch to copy-and-paste view</a></div>
414  
-  <br/>
  415
+  <h2>Traceback <span class="commands"><a href="#" onclick="return switchPastebinFriendly(this);">Switch to copy-and-paste view</a></span></h2>
415 416
   {% autoescape off %}
416 417
   <div id="browserTraceback">
417 418
     <ul class="traceback">
@@ -456,27 +457,51 @@ def _get_lines_from_file(filename, lineno, context_lines, loader=None, module_na
456 457
       {% endfor %}
457 458
     </ul>
458 459
   </div>
  460
+  {% endautoescape %}
  461
+  <form action="http://dpaste.com/" name="pasteform" id="pasteform" method="post">
459 462
   <div id="pastebinTraceback" class="pastebin">
460  
-    <table>
461  
-      <tbody>
462  
-        <tr>
463  
-          <td>
464  
-            <code>
465  
-Traceback (most recent call last):<br/>
466  
-{% for frame in frames %}
467  
-  File "{{ frame.filename }}" in {{ frame.function }}<br/>
468  
-  {% if frame.context_line %}
469  
-    &nbsp;&nbsp;{{ frame.lineno }}. {{ frame.context_line|escape }}<br/>
470  
-  {% endif %}
471  
-{% endfor %}<br/>
472  
-&nbsp;&nbsp;{{ exception_type }} at {{ request.path|escape }}<br/>
473  
-&nbsp;&nbsp;{{ exception_value|escape }}</code>
474  
-          </td>
475  
-        </tr>
476  
-      </tbody>
477  
-    </table>
  463
+    <input type="hidden" name="language" value="PythonConsole" />
  464
+    <input type="hidden" name="title" value="{{ exception_type|escape }} at {{ request.path|escape }}" />
  465
+    <input type="hidden" name="source" value="Django Dpaste Agent" />
  466
+    <input type="hidden" name="poster" value="Django" />
  467
+    <textarea name="content" id="traceback_area" cols="140" rows="25">
  468
+Environment:
  469
+
  470
+Request Method: {{ request.META.REQUEST_METHOD }}
  471
+Request URL: {{ request_protocol }}://{{ request.META.HTTP_HOST }}{{ request.path|escape }}
  472
+Django Version: {{ django_version_info }}
  473
+Python Version: {{ sys_version_info }}
  474
+Installed Applications: 
  475
+   {{ settings.INSTALLED_APPS|pprint }}
  476
+Installed Middleware: 
  477
+   {{ settings.MIDDLEWARE_CLASSES|pprint }}
  478
+
  479
+{% if template_does_not_exist %}Template Loader Error:
  480
+{% if loader_debug_info %}Django tried loading these templates, in this order:
  481
+{% for loader in loader_debug_info %}Using loader {{ loader.loader }}:
  482
+{% for t in loader.templates %}{{ t.name }} (File {% if t.exists %}exists{% else %}does not exist{% endif %})
  483
+{% endfor %}{% endfor %}
  484
+{% else %}Django couldn't find any templates because your TEMPLATE_LOADERS setting is empty!
  485
+{% endif %}
  486
+{% endif %}{% if template_info %}
  487
+Template error:
  488
+In template {{ template_info.name }}, error at line {{ template_info.line }}
  489
+   {{ template_info.message }}{% for source_line in template_info.source_lines %}{% ifequal source_line.0 template_info.line %}
  490
+   {{ source_line.0 }} : {{ template_info.before }} {{ template_info.during }} {{ template_info.after }}
  491
+{% else %}
  492
+   {{ source_line.0 }} : {{ source_line.1 }}
  493
+{% endifequal %}{% endfor %}{% endif %}
  494
+Traceback:
  495
+{% for frame in frames %}File "{{ frame.filename|escape }}" in {{ frame.function|escape }}
  496
+{% if frame.context_line %}  {{ frame.lineno }}. {{ frame.context_line|escape }}{% endif %}
  497
+{% endfor %}
  498
+Exception Type: {{ exception_type|escape }} at {{ request.path|escape }}
  499
+Exception Value: {{ exception_value|escape }}
  500
+</textarea>
  501
+  <br/><br/>
478 502
   </div>
479  
-  {% endautoescape %}
  503
+<input type="submit" value="Send to DPaste"> 
  504
+</form>
480 505
 </div>
481 506
 
482 507
 <div id="requestinfo">

0 notes on commit 13aa197

Please sign in to comment.
Something went wrong with that request. Please try again.