diff --git a/django/views/debug.py b/django/views/debug.py
index f2288cf173..650aebae10 100644
--- a/django/views/debug.py
+++ b/django/views/debug.py
@@ -611,6 +611,28 @@ Exception Value: {{ exception_value|escape }}
{% else %}
No POST data
{% endif %}
+ FILES
+ {% if request.FILES %}
+
+
+
+ Variable |
+ Value |
+
+
+
+ {% for var in request.FILES.items %}
+
+ {{ var.0 }} |
+ {{ var.1|pprint }} |
+
+ {% endfor %}
+
+
+ {% else %}
+ No FILES data
+ {% endif %}
+
COOKIES
{% if request.COOKIES %}
diff --git a/tests/regressiontests/views/tests/__init__.py b/tests/regressiontests/views/tests/__init__.py
index 9964cd5833..9c363b3f09 100644
--- a/tests/regressiontests/views/tests/__init__.py
+++ b/tests/regressiontests/views/tests/__init__.py
@@ -3,3 +3,4 @@ from i18n import *
from static import *
from generic.date_based import *
from generic.create_update import *
+from debug import *
diff --git a/tests/regressiontests/views/tests/debug.py b/tests/regressiontests/views/tests/debug.py
new file mode 100644
index 0000000000..0c0b62f51f
--- /dev/null
+++ b/tests/regressiontests/views/tests/debug.py
@@ -0,0 +1,21 @@
+from django.conf import settings
+from django.core.files.uploadedfile import SimpleUploadedFile
+from django.test import TestCase
+
+class DebugViewTests(TestCase):
+ def setUp(self):
+ settings.DEBUG = True
+
+ def tearDown(self):
+ settings.DEBUG = False
+
+ def test_files(self):
+ response = self.client.get('/views/raises/')
+ self.assertEquals(response.status_code, 500)
+
+ data = {
+ 'file_data.txt': SimpleUploadedFile('file_data.txt', 'haha'),
+ }
+ response = self.client.post('/views/raises/', data)
+ self.failUnless('file_data.txt' in response.content)
+ self.failIf('haha' in response.content)
diff --git a/tests/regressiontests/views/urls.py b/tests/regressiontests/views/urls.py
index 6403ab3a39..b6a269f9f4 100644
--- a/tests/regressiontests/views/urls.py
+++ b/tests/regressiontests/views/urls.py
@@ -82,3 +82,8 @@ urlpatterns += patterns('django.views.generic.create_update',
(r'^create_update/no_url/update/article/(?P[-\w]+)/$',
'update_object', dict(slug_field='slug', model=UrlArticle)),
)
+
+# a view that raises an exception for the debug view
+urlpatterns += patterns('',
+ (r'^raises/$', views.raises)
+)
diff --git a/tests/regressiontests/views/views.py b/tests/regressiontests/views/views.py
index b90852189c..969d760d8e 100644
--- a/tests/regressiontests/views/views.py
+++ b/tests/regressiontests/views/views.py
@@ -1,5 +1,8 @@
+import sys
+
from django.http import HttpResponse
from django import forms
+from django.views.debug import technical_500_response
from django.views.generic.create_update import create_object
from models import Article
@@ -27,3 +30,9 @@ def custom_create(request):
return create_object(request,
post_save_redirect='/views/create_update/view/article/%(slug)s/',
form_class=SlugChangingArticleForm)
+
+def raises(request):
+ try:
+ raise Exception
+ except Exception:
+ return technical_500_response(request, *sys.exc_info())