summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--AUTHORS1
-rw-r--r--django/template/__init__.py15
2 files changed, 15 insertions, 1 deletions
diff --git a/AUTHORS b/AUTHORS
index 5864c7107f..6c1a9070fe 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -88,6 +88,7 @@ answer newbie questions, and generally made Django that much better:
Robin Munn <http://www.geekforgod.com/>
Nebojša Dorđević
Sam Newman <http://www.magpiebrain.com/>
+ Neal Norwitz <nnorwitz@google.com>
oggie rob <oz.robharvey@gmail.com>
pgross@thoughtworks.com
phaedo <http://phaedo.cx/>
diff --git a/django/template/__init__.py b/django/template/__init__.py
index e32200cccb..18dceff45c 100644
--- a/django/template/__init__.py
+++ b/django/template/__init__.py
@@ -91,7 +91,20 @@ libraries = {}
builtins = []
class TemplateSyntaxError(Exception):
- pass
+ 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()
class TemplateDoesNotExist(Exception):
pass