Opened 10 years ago

Closed 10 years ago

#623 closed enhancement (duplicate)

[patch] Allow ssi tag to use template dirs, making apps that use this feature much more portable

Reported by: L.Plant.98@… Owned by: adrian
Component: Template system Version:
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


The current ssi template tag requires that files be specified using absolute paths. This makes apps much harder to redistribute, and limits the usefulness of this tag. Since a major use of this tag would be to factor out common code in templates, it makes sense to put these includes in template directories, and to allow the tag to search the TEMPLATE_DIRS for files to include.

The patch attached implements this, keeping compatibility with existing code by only looking for a template file if the path specified is relative rather than absolute.

This kind of overlaps with ticket #598, but this one could be added with no side effects for anyone else.

Attachments (1)

django_ticket_623_patch (2.2 KB) - added by L.Plant.98@… 10 years ago.
Patch to implement this ticket

Download all attachments as: .zip

Change History (4)

Changed 10 years ago by L.Plant.98@…

Patch to implement this ticket

comment:1 Changed 10 years ago by hugo

  • Summary changed from Allow ssi tag to use template dirs, making apps that use this feature much more portable to [patch] Allow ssi tag to use template dirs, making apps that use this feature much more portable

comment:2 Changed 10 years ago by rjwittams

This does have a side effect:

If someone is including a template path incorrectly right now, they will get no output.
If this was applied, they would get output.

The side effect of #598:

Someone is using a tag called include without defining it in order to generate a TemplateSyntaxError for an unknown block tag, and is relying on this behaviour.
If #598 is applied, it will either work or generate a different error.

Maybe you thought it would affect people with their own 'include' tag. But register_tag overwrites old definitions.
(Which means that in future, the way tag functions are stored should probably be changed to a nested list of dictionaries, and probably not global either ... but that is another bug.)

Both these side effects are about as ridiculous and unlikely as each other.

comment:3 Changed 10 years ago by anonymous

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

OK, your ticket doesn't have side effects, unless it is going to *replace* ssi, which is the impression I kind of got and what I was thinking of. I implemented this before finding your ticket, and also I didn't realise til reading your actual patch just now that your include tag uses the template system, as that isn't clear in the description.

I'm resolving this as a duplicate, since your ticket/patch seems better thought out -- I'll be putting some comments on that ticket though.

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