diff --git a/django/views/debug.py b/django/views/debug.py
index 490d4bb..b24ff43 100644
a
|
b
|
class ExceptionReporter(object):
|
256 | 256 | 'sys_path' : sys.path, |
257 | 257 | 'template_info': self.template_info, |
258 | 258 | 'template_does_not_exist': self.template_does_not_exist, |
| 259 | 'traceback': self.exception_string(), |
259 | 260 | 'loader_debug_info': self.loader_debug_info, |
260 | 261 | }) |
261 | 262 | # Check whether exception info is available |
… |
… |
class ExceptionReporter(object):
|
375 | 376 | |
376 | 377 | return frames |
377 | 378 | |
| 379 | def exception_string(self): |
| 380 | unicode_fixed = [smart_unicode(f, errors='replace') for f in self.format_exception()] |
| 381 | return "".join([f for f in unicode_fixed]) |
| 382 | |
378 | 383 | def format_exception(self): |
379 | 384 | """ |
380 | 385 | Return the same data as from traceback.format_exception. |
… |
… |
def empty_urlconf(request):
|
431 | 436 | TECHNICAL_500_TEMPLATE = """ |
432 | 437 | <!DOCTYPE html> |
433 | 438 | <html lang="en"> |
| 439 | {% if traceback %} |
| 440 | <!---------- |
| 441 | {{ traceback }} |
| 442 | ----------> |
| 443 | {% endif %} |
434 | 444 | <head> |
435 | 445 | <meta http-equiv="content-type" content="text/html; charset=utf-8"> |
436 | 446 | <meta name="robots" content="NONE,NOARCHIVE"> |
diff --git a/tests/regressiontests/views/tests/debug.py b/tests/regressiontests/views/tests/debug.py
index 1dbaff4..06a56e4 100644
a
|
b
|
class ExceptionReporterTests(TestCase):
|
149 | 149 | self.assertIn('<h2>Request information</h2>', html) |
150 | 150 | self.assertIn('<p>Request data not supplied</p>', html) |
151 | 151 | |
| 152 | def test_raw_traceback(self): |
| 153 | "The raw traceback is provided in a comment." |
| 154 | try: |
| 155 | request = self.rf.get('/test_view/') |
| 156 | raise ValueError("---------->") |
| 157 | except ValueError: |
| 158 | exc_type, exc_value, tb = sys.exc_info() |
| 159 | reporter = ExceptionReporter(request, exc_type, exc_value, tb) |
| 160 | html = reporter.get_traceback_html() |
| 161 | self.assertIn('<!----------', html) |
| 162 | self.assertEquals(1, html.count('---------->')) |
| 163 | self.assertIn('---------->', html) |
| 164 | |
152 | 165 | |
153 | 166 | class ExceptionReporterFilterTests(TestCase): |
154 | 167 | """ |