Ticket #9666: ssi-variable.diff
File ssi-variable.diff, 1.2 KB (added by , 16 years ago) |
---|
-
django/template/defaulttags.py
298 298 self.filepath, self.parsed = filepath, parsed 299 299 300 300 def render(self, context): 301 if not include_is_allowed(self.filepath): 301 filepath = self.filepath 302 try: 303 filepath = Variable(filepath).resolve(context) 304 except VariableDoesNotExist: 305 pass 306 if not include_is_allowed(filepath): 302 307 if settings.DEBUG: 303 308 return "[Didn't have permission to include file]" 304 309 else: 305 310 return '' # Fail silently for invalid includes. 306 311 try: 307 fp = open( self.filepath, 'r')312 fp = open(filepath, 'r') 308 313 output = fp.read() 309 314 fp.close() 310 315 except IOError: 311 316 output = '' 312 317 if self.parsed: 313 318 try: 314 t = Template(output, name= self.filepath)319 t = Template(output, name=filepath) 315 320 return t.render(context) 316 321 except TemplateSyntaxError, e: 317 322 if settings.DEBUG: