Ticket #9666: ssi-variable.diff

File ssi-variable.diff, 1.2 KB (added by Ulrich Petri, 16 years ago)

fixed ssi variable resolving

  • django/template/defaulttags.py

     
    298298        self.filepath, self.parsed = filepath, parsed
    299299
    300300    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):
    302307            if settings.DEBUG:
    303308                return "[Didn't have permission to include file]"
    304309            else:
    305310                return '' # Fail silently for invalid includes.
    306311        try:
    307             fp = open(self.filepath, 'r')
     312            fp = open(filepath, 'r')
    308313            output = fp.read()
    309314            fp.close()
    310315        except IOError:
    311316            output = ''
    312317        if self.parsed:
    313318            try:
    314                 t = Template(output, name=self.filepath)
     319                t = Template(output, name=filepath)
    315320                return t.render(context)
    316321            except TemplateSyntaxError, e:
    317322                if settings.DEBUG:
Back to Top