Ticket #17199: #17199-template_loader_origin.diff

File #17199-template_loader_origin.diff, 1.5 KB (added by Kronuz, 4 years ago)
  • django/template/loader.py

     
    4646        origin = make_origin(display_name, self.load_template_source, template_name, template_dirs)
    4747        try:
    4848            template = get_template_from_string(source, origin, template_name)
    49             return template, None
     49            return template, origin and origin.name
    5050        except TemplateDoesNotExist:
    5151            # If compiling the template we found raises TemplateDoesNotExist, back off to
    5252            # returning the source and display name for the template we were asked to load.
  • django/template/loaders/cached.py

     
    5050                    # back off to returning the source and display name for the template
    5151                    # we were asked to load. This allows for correct identification (later)
    5252                    # of the actual template that does not exist.
    53                     return template, origin
    54             self.template_cache[key] = template
    55         return self.template_cache[key], None
     53                    return template, origin and origin.name
     54            self.template_cache[key] = (template, origin and origin.name)
     55        return self.template_cache[key]
    5656
    5757    def reset(self):
    5858        "Empty the template cache."
Back to Top