Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #505 -- ssi template tag now displays a message instead of fail…

…ing silently if DEBUG=True. Thanks, Manuzhai

git-svn-id: http://code.djangoproject.com/svn/django/trunk@1037 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit cee6faf43ed92c5b276ca4d2e1754a72fbc00ce1 1 parent 7136eb8
Adrian Holovaty authored November 01, 2005

Showing 1 changed file with 10 additions and 3 deletions. Show diff stats Hide diff stats

  1. 13  django/core/template/defaulttags.py
13  django/core/template/defaulttags.py
@@ -211,8 +211,12 @@ def __init__(self, filepath, parsed):
211 211
         self.filepath, self.parsed = filepath, parsed
212 212
 
213 213
     def render(self, context):
  214
+        from django.conf.settings import DEBUG
214 215
         if not include_is_allowed(self.filepath):
215  
-            return '' # Fail silently for invalid includes.
  216
+            if DEBUG:
  217
+                return "[Didn't have permission to include file]"
  218
+            else:
  219
+                return '' # Fail silently for invalid includes.
216 220
         try:
217 221
             fp = open(self.filepath, 'r')
218 222
             output = fp.read()
@@ -223,8 +227,11 @@ def render(self, context):
223 227
             try:
224 228
                 t = Template(output)
225 229
                 return t.render(context)
226  
-            except TemplateSyntaxError:
227  
-                return '' # Fail silently for invalid included templates.
  230
+            except (TemplateSyntaxError, e):
  231
+                if DEBUG:
  232
+                    return "[Included template had syntax error: %s]" % e
  233
+                else:
  234
+                    return '' # Fail silently for invalid included templates.
228 235
         return output
229 236
 
230 237
 class LoadNode(Node):

0 notes on commit cee6faf

Please sign in to comment.
Something went wrong with that request. Please try again.