Opened 19 years ago

Closed 19 years ago

Last modified 19 years ago

#705 closed enhancement (duplicate)

Patch to allow ssi tag to try templates first, then absolute url

Reported by: jpaulofarias@… 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:

Change History (2)

comment:1 by rjwittams, 19 years ago

Resolution: duplicate
Status: newclosed

Another one... please could someone just apply #598 to trunk?

comment:2 by anonymous, 19 years ago

Use {% include %} for this.

Note: See TracTickets for help on using tickets.
Back to Top