Skip to content
Browse files

Fixed #1852 -- Improved TemplateSyntaxError to display the original e…

…xception if str() of the exception raises an exception in itself. Thanks,

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
adrianholovaty committed May 15, 2006
1 parent 51f6a94 commit 55c9e98d86e717a3da832fc309947d70a68ffdb0
Showing with 15 additions and 1 deletion.
  1. +1 −0 AUTHORS
  2. +14 −1 django/template/
@@ -88,6 +88,7 @@ answer newbie questions, and generally made Django that much better:
Robin Munn <>
Nebojša Dorđević
Sam Newman <>
Neal Norwitz <>
oggie rob <>
phaedo <>
@@ -91,7 +91,20 @@
builtins = []

class TemplateSyntaxError(Exception):
def __str__(self):
import cStringIO as StringIO
except ImportError:
import StringIO
output = StringIO.StringIO()
# 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()

class TemplateDoesNotExist(Exception):

0 comments on commit 55c9e98

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.