Ticket #2437: django-dpaste-prettified.diff

File django-dpaste-prettified.diff, 3.4 KB (added by xian, 13 years ago)
  • django/views/debug.py

     
    131131        if start is not None and end is not None:
    132132            unicode_str = exc_value.args[1]
    133133            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
    135135    t = Template(TECHNICAL_500_TEMPLATE, name='Technical 500 template')
    136136    c = Context({
    137137        'exception_type': exc_type.__name__,
     
    144144        'settings': get_safe_settings(),
    145145        'sys_executable' : sys.executable,
    146146        'sys_version_info' : '%d.%d.%d' % sys.version_info[0:3],
     147        'django_version_info' : get_version(),
    147148        'template_info': template_info,
    148149        'template_does_not_exist': template_does_not_exist,
    149150        'loader_debug_info': loader_debug_info,
     
    275276    #requestinfo h3 { margin-bottom:-1em; }
    276277    .error { background: #ffc; }
    277278    .specific { color:#cc3300; font-weight:bold; }
     279    h2 span.commands { font-size:.7em;}
     280    span.commands a:link {color:#5E5694;}
    278281  </style>
    279282  <script type="text/javascript">
    280283  //<!--
     
    409412</div>
    410413{% endif %}
    411414<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>
     416
    415417  {% autoescape off %}
    416418  <div id="browserTraceback">
    417419    <ul class="traceback">
     
    456458      {% endfor %}
    457459    </ul>
    458460  </div>
     461  {% endautoescape %}
    459462  <div id="pastebinTraceback" class="pastebin">
    460     <table>
    461       <tbody>
    462         <tr>
    463           <td>
    464             <code>
    465 Traceback (most recent call last):<br/>
     463    <form action="http://dpaste.com/" name="pasteform" id="pasteform" method="post">
     464    <input type="hidden" name="language" value="PythonConsole" />
     465    <input type="hidden" name="title" value="{{ exception_type|escape }} at {{ request.path|escape }}" />
     466    <input type="hidden" name="source" value="Django Dpaste Agent" />
     467    <input type="hidden" name="poster" value="Django" />
     468<textarea name="content" id="traceback_area" cols="140" rows="25">
     469Environment:
     470Django Version: {{ django_version_info }}
     471Python Version: {{ sys_version_info }}
     472Installed Applications:
     473{{ settings.INSTALLED_APPS|pprint }}
     474Installed Middleware:
     475{{ settings.MIDDLEWARE_CLASSES|pprint }}
     476
     477Traceback:
    466478{% 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>
     479File "{{ frame.filename|escape }}" in {{ frame.function|escape }}
     480  {% if frame.context_line %}{{ frame.lineno }}. {{ frame.context_line|escape }}{% endif %}
     481{% endfor %}
     482
     483  {{ exception_type|escape }} at {{ request.path|escape }}
     484  {{ exception_value|escape }}
     485</textarea>
     486      <br><input type="submit" value="Send to DPaste">
     487    </form>
    478488  </div>
    479   {% endautoescape %}
    480489</div>
    481490
    482491<div id="requestinfo">
Back to Top