#705 closed enhancement (duplicate)
Patch to allow ssi tag to try templates first, then absolute url
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
Component: | Template system | Version: | |
Severity: | normal | Keywords: | tag, ssi, template |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
This patch allows ssi tag to search templates first, then search for the absolute path. This works for i18n branch. Inline bellow.
Index: django/core/template/defaulttags.py =================================================================== --- django/core/template/defaulttags.py (revisão 1015) +++ django/core/template/defaulttags.py (cópia de trabalho) @@ -1,6 +1,6 @@ "Default tags used by the template system, available to all templates." -from django.core.template import Node, NodeList, Template, Context, resolve_variable, resolve_variable_with_filters, get_filters_from_token, registered_filters +from django.core.template import Node, NodeList, Template, Context, resolve_variable, resolve_variable_with_filters, get_filters_from_token, registered_filters, TemplateDoesNotExist from django.core.template import TemplateSyntaxError, VariableDoesNotExist, BLOCK_TAG_START, BLOCK_TAG_END, VARIABLE_TAG_START, VARIABLE_TAG_END, register_tag from django.utils import translation @@ -214,6 +214,12 @@ self.filepath, self.parsed = filepath, parsed def render(self, context): + try: + from django.core.template import loader + t = loader.get_template(self.filepath) + return t.render(context) + except TemplateDoesNotExist: + pass if not include_is_allowed(self.filepath): return '' # Fail silently for invalid includes. try:
Note:
See TracTickets
for help on using tickets.
Another one... please could someone just apply #598 to trunk?