Index: django/template/__init__.py
===================================================================
--- django/template/__init__.py	(revision 12623)
+++ django/template/__init__.py	(working copy)
@@ -104,20 +104,7 @@
 invalid_var_format_string = None

 class TemplateSyntaxError(Exception):
-    def __str__(self):
-        try:
-            import cStringIO as StringIO
-        except ImportError:
-            import StringIO
-        output = StringIO.StringIO()
-        output.write(Exception.__str__(self))
-        # Check if we wrapped an exception and print that too.
-        if hasattr(self, 'exc_info'):
-            import traceback
-            output.write('\n\nOriginal ')
-            e = self.exc_info
-            traceback.print_exception(e[0], e[1], e[2], 500, output)
-        return output.getvalue()
+    pass

 class TemplateDoesNotExist(Exception):
     pass
Index: django/template/debug.py
===================================================================
--- django/template/debug.py	(revision 12623)
+++ django/template/debug.py	(working copy)
@@ -79,7 +79,7 @@
             wrapped = TemplateSyntaxError(u'Caught an exception while rendering: %s' % force_unicode(e, errors='replace'))
             wrapped.source = node.source
             wrapped.exc_info = exc_info()
-            raise wrapped
+            raise wrapped, None, wrapped.exc_info[2]
         return result

 class DebugVariableNode(VariableNode):
Index: tests/regressiontests/debug/views.py
===================================================================
--- tests/regressiontests/debug/views.py	(revision 12623)
+++ tests/regressiontests/debug/views.py	(working copy)
@@ -1,3 +1,5 @@
+from django.shortcuts import render_to_response
+
 from regressiontests.debug import BrokenException, except_args

 def view_exception(request, n):
@@ -3,2 +5,5 @@
     raise BrokenException(except_args[int(n)])

+def template_exception(request, n):
+    return render_to_response('debug/template_exception.html',
+        {'arg': except_args[int(n)]})
Index: tests/regressiontests/debug/tests.py
===================================================================
--- tests/regressiontests/debug/tests.py	(revision 12623)
+++ tests/regressiontests/debug/tests.py	(working copy)
@@ -1,6 +1,9 @@
+import inspect
+
 from django.test import TestCase
 from django.conf import settings
 from django.core.urlresolvers import reverse
+from django.template import TemplateSyntaxError

 from regressiontests.debug import BrokenException, except_args

@@ -10,12 +13,24 @@
     def setUp(self):
         self.old_debug = settings.DEBUG
         settings.DEBUG = True
+        self.old_template_debug = settings.TEMPLATE_DEBUG
+        settings.TEMPLATE_DEBUG = True

     def tearDown(self):
         settings.DEBUG = self.old_debug
+        settings.TEMPLATE_DEBUG = self.old_template_debug

     def test_view_exceptions(self):
         for n in range(len(except_args)):
             self.assertRaises(BrokenException, self.client.get,
                 reverse('view_exception', args=(n,)))

+    def test_template_exceptions(self):
+        for n in range(len(except_args)):
+            try:
+                self.client.get(reverse('template_exception', args=(n,)))
+            except TemplateSyntaxError, e:
+                raising_loc = inspect.trace()[-1][-2][0].strip()
+                self.failIf(raising_loc.find('raise BrokenException') == -1,
+                    "Failed to find 'raise BrokenException' in last frame of traceback, instead found: %s" % raising_loc)
+
Index: tests/regressiontests/debug/templatetags/debugtags.py
===================================================================
--- tests/regressiontests/debug/templatetags/debugtags.py	(revision 0)
+++ tests/regressiontests/debug/templatetags/debugtags.py	(revision 0)
@@ -0,0 +1,10 @@
+from django import template
+
+from regressiontests.debug import BrokenException
+
+register = template.Library()
+
+@register.simple_tag
+def go_boom(arg):
+    raise BrokenException(arg)
+

Property changes on: tests\regressiontests\debug\templatetags\debugtags.py
___________________________________________________________________
Added: svn:eol-style
   + native

Index: tests/regressiontests/debug/urls.py
===================================================================
--- tests/regressiontests/debug/urls.py	(revision 12623)
+++ tests/regressiontests/debug/urls.py	(working copy)
@@ -2,4 +2,5 @@

 urlpatterns = patterns('regressiontests.debug.views',
     url(r'view_exception/(?P<n>\d+)/$', 'view_exception', name='view_exception'),
+    url(r'template_exception/(?P<n>\d+)/$', 'template_exception', name='template_exception'),
 )
Index: tests/regressiontests/debug/templates/debug/template_exception.html
===================================================================
--- tests/regressiontests/debug/templates/debug/template_exception.html	(revision 0)
+++ tests/regressiontests/debug/templates/debug/template_exception.html	(revision 0)
@@ -0,0 +1,2 @@
+{% load debugtags %}
+{% go_boom arg %}
Index: tests/regressiontests/debug/templates/__init__.py
===================================================================

Property changes on: tests\regressiontests\debug\templates\__init__.py
___________________________________________________________________
Added: svn:eol-style
   + native

