Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#705 closed enhancement (duplicate)

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

Reported by: jpaulofarias@… Owned by: adrian
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: UI/UX:

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 Changed 10 years ago by rjwittams

  • Resolution set to duplicate
  • Status changed from new to closed

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

comment:2 Changed 10 years ago by anonymous

Use {% include %} for this.

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