Ticket #2437: django-dpaste-prettified-2.diff

File django-dpaste-prettified-2.diff, 4.5 KB (added by Erik Karulf, 17 years ago)

Updated the prettified code per some recommendations from fellow sprinters

  • 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>
    415416  {% autoescape off %}
    416417  <div id="browserTraceback">
    417418    <ul class="traceback">
     
    456457      {% endfor %}
    457458    </ul>
    458459  </div>
     460  {% endautoescape %}
     461  <form action="http://dpaste.com/" name="pasteform" id="pasteform" method="post">
    459462  <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">
     468Environment:
     469
     470Request Method: {{ request.META.REQUEST_METHOD }}
     471Request URL: {{ request_protocol }}://{{ request.META.HTTP_HOST }}{{ request.path|escape }}
     472Django Version: {{ django_version_info }}
     473Python Version: {{ sys_version_info }}
     474Installed Applications:
     475   {{ settings.INSTALLED_APPS|pprint }}
     476Installed 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 %}
     487Template error:
     488In 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 %}
     494Traceback:
     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 %}
     498Exception Type: {{ exception_type|escape }} at {{ request.path|escape }}
     499Exception Value: {{ exception_value|escape }}
     500</textarea>
     501  <br/><br/>
    478502  </div>
    479   {% endautoescape %}
     503<input type="submit" value="Send to DPaste">
     504</form>
    480505</div>
    481506
    482507<div id="requestinfo">
Back to Top