diff options
| author | Adrian Holovaty <adrian@holovaty.com> | 2005-11-01 01:11:36 +0000 |
|---|---|---|
| committer | Adrian Holovaty <adrian@holovaty.com> | 2005-11-01 01:11:36 +0000 |
| commit | cee6faf43ed92c5b276ca4d2e1754a72fbc00ce1 (patch) | |
| tree | ed4f7fdbf5d3d82eedec2995b8eaf525376f09b9 | |
| parent | 7136eb8f3a052afef29e343679e84e93d7e9e0a3 (diff) | |
Fixed #505 -- ssi template tag now displays a message instead of failing silently if DEBUG=True. Thanks, Manuzhai
git-svn-id: http://code.djangoproject.com/svn/django/trunk@1037 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| -rw-r--r-- | django/core/template/defaulttags.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/django/core/template/defaulttags.py b/django/core/template/defaulttags.py index ea21ebafce..535d0b81e1 100644 --- a/django/core/template/defaulttags.py +++ b/django/core/template/defaulttags.py @@ -211,8 +211,12 @@ class SsiNode(Node): self.filepath, self.parsed = filepath, parsed def render(self, context): + from django.conf.settings import DEBUG if not include_is_allowed(self.filepath): - return '' # Fail silently for invalid includes. + if DEBUG: + return "[Didn't have permission to include file]" + else: + return '' # Fail silently for invalid includes. try: fp = open(self.filepath, 'r') output = fp.read() @@ -223,8 +227,11 @@ class SsiNode(Node): try: t = Template(output) return t.render(context) - except TemplateSyntaxError: - return '' # Fail silently for invalid included templates. + except (TemplateSyntaxError, e): + if DEBUG: + return "[Included template had syntax error: %s]" % e + else: + return '' # Fail silently for invalid included templates. return output class LoadNode(Node): |
