Ticket #7529: debug-files.diff

File debug-files.diff, 2.6 KB (added by Alex Gaynor, 16 years ago)
  • django/views/debug.py

    diff --git a/django/views/debug.py b/django/views/debug.py
    index f2288cf..650aeba 100644
    a b Exception Value: {{ exception_value|escape }}  
    611611  {% else %}
    612612    <p>No POST data</p>
    613613  {% endif %}
     614  <h3 id="files-info">FILES</h3>
     615  {% if request.FILES %}
     616    <table class="req">
     617        <thead>
     618            <tr>
     619                <th>Variable</th>
     620                <th>Value</th>
     621            </tr>
     622        </thead>
     623        <tbody>
     624            {% for var in request.FILES.items %}
     625                <tr>
     626                    <td>{{ var.0 }}</td>
     627                    <td class="code"><div>{{ var.1|pprint }}</div></td>
     628                </tr>
     629            {% endfor %}
     630        </tbody>
     631    </table>
     632  {% else %}
     633    <p>No FILES data</p>
     634  {% endif %}
     635 
    614636
    615637  <h3 id="cookie-info">COOKIES</h3>
    616638  {% if request.COOKIES %}
  • tests/regressiontests/views/tests/__init__.py

    diff --git a/tests/regressiontests/views/tests/__init__.py b/tests/regressiontests/views/tests/__init__.py
    index 9964cd5..9c363b3 100644
    a b from i18n import *  
    33from static import *
    44from generic.date_based import *
    55from generic.create_update import *
     6from debug import *
  • tests/regressiontests/views/urls.py

    diff --git a/tests/regressiontests/views/urls.py b/tests/regressiontests/views/urls.py
    index 6403ab3..b6a269f 100644
    a b urlpatterns += patterns('django.views.generic.create_update',  
    8282    (r'^create_update/no_url/update/article/(?P<slug>[-\w]+)/$',
    8383        'update_object', dict(slug_field='slug', model=UrlArticle)),
    8484)
     85
     86# a view that raises an exception for the debug view
     87urlpatterns += patterns('',
     88    (r'^raises/$', views.raises)
     89)
  • tests/regressiontests/views/views.py

    diff --git a/tests/regressiontests/views/views.py b/tests/regressiontests/views/views.py
    index b908521..969d760 100644
    a b  
     1import sys
     2
    13from django.http import HttpResponse
    24from django import forms
     5from django.views.debug import technical_500_response
    36from django.views.generic.create_update import create_object
    47
    58from models import Article
    def custom_create(request):  
    2730    return create_object(request,
    2831        post_save_redirect='/views/create_update/view/article/%(slug)s/',
    2932        form_class=SlugChangingArticleForm)
     33
     34def raises(request):
     35    try:
     36        raise Exception
     37    except Exception:
     38        return technical_500_response(request, *sys.exc_info())
Back to Top