diff --git a/django/views/debug.py b/django/views/debug.py
index f2288cf..650aeba 100644
a
|
b
|
Exception Value: {{ exception_value|escape }}
|
611 | 611 | {% else %} |
612 | 612 | <p>No POST data</p> |
613 | 613 | {% 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 | |
614 | 636 | |
615 | 637 | <h3 id="cookie-info">COOKIES</h3> |
616 | 638 | {% if request.COOKIES %} |
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 *
|
3 | 3 | from static import * |
4 | 4 | from generic.date_based import * |
5 | 5 | from generic.create_update import * |
| 6 | from debug import * |
diff --git a/tests/regressiontests/views/tests/debug.py b/tests/regressiontests/views/tests/debug.py
new file mode 100644
index 0000000..0c0b62f
-
|
+
|
|
| 1 | from django.conf import settings |
| 2 | from django.core.files.uploadedfile import SimpleUploadedFile |
| 3 | from django.test import TestCase |
| 4 | |
| 5 | class DebugViewTests(TestCase): |
| 6 | def setUp(self): |
| 7 | settings.DEBUG = True |
| 8 | |
| 9 | def tearDown(self): |
| 10 | settings.DEBUG = False |
| 11 | |
| 12 | def test_files(self): |
| 13 | response = self.client.get('/views/raises/') |
| 14 | self.assertEquals(response.status_code, 500) |
| 15 | |
| 16 | data = { |
| 17 | 'file_data.txt': SimpleUploadedFile('file_data.txt', 'haha'), |
| 18 | } |
| 19 | response = self.client.post('/views/raises/', data) |
| 20 | self.failUnless('file_data.txt' in response.content) |
| 21 | self.failIf('haha' in response.content) |
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',
|
82 | 82 | (r'^create_update/no_url/update/article/(?P<slug>[-\w]+)/$', |
83 | 83 | 'update_object', dict(slug_field='slug', model=UrlArticle)), |
84 | 84 | ) |
| 85 | |
| 86 | # a view that raises an exception for the debug view |
| 87 | urlpatterns += patterns('', |
| 88 | (r'^raises/$', views.raises) |
| 89 | ) |
diff --git a/tests/regressiontests/views/views.py b/tests/regressiontests/views/views.py
index b908521..969d760 100644
a
|
b
|
|
| 1 | import sys |
| 2 | |
1 | 3 | from django.http import HttpResponse |
2 | 4 | from django import forms |
| 5 | from django.views.debug import technical_500_response |
3 | 6 | from django.views.generic.create_update import create_object |
4 | 7 | |
5 | 8 | from models import Article |
… |
… |
def custom_create(request):
|
27 | 30 | return create_object(request, |
28 | 31 | post_save_redirect='/views/create_update/view/article/%(slug)s/', |
29 | 32 | form_class=SlugChangingArticleForm) |
| 33 | |
| 34 | def raises(request): |
| 35 | try: |
| 36 | raise Exception |
| 37 | except Exception: |
| 38 | return technical_500_response(request, *sys.exc_info()) |