Edgewall Software

Opened 14 years ago

Last modified 14 years ago

#421 new defect

TemplateLoader template cache does not properly namespace directories

Reported by: griffin@… Owned by: cmlenz
Priority: major Milestone:
Component: Template processing Version: 0.5.1
Keywords: Cc:

Description

given the following filesystem setup:

dir/

subdir-1/

|base.gst

| `-- target-1.gst `-- subdir-2/

base.gst

`-- target-2.gst

where both "target-1.gst" and "target-2.gst" have the following:

<xi:include href="base.gst"/>

then a TemplateLoader? class cannot be re-used to compile both "target-1.gst" and "target-2.gst", because the content of the first "base.gst" will be cached and used for the second include as well.

the solution is to first evaluate the absolute path of a template before using that as the cache key.

the work-around is to simply create a new TemplateLoader?, but this is obviously less desirable for performance reasons.

cheers, griffin

Change History (2)

comment:1 Changed 14 years ago by griffin@…

fixed formatting of file hierarchy:

  dir/
  |-- subdir-1/
  |   |-- base.gst
  |   `-- target-1.gst
  `-- subdir-2/
      |-- base.gst
      `-- target-2.gst

comment:2 Changed 14 years ago by hodgestar

Genshi does actually appear to do this behaviour provided either you did not specify a search path when creating the TemplateLoader or the parent template filename was not absolute. Could you add a small code snippet showing how you created your TemplateLoader and called .load() to find your two templates?

Note: See TracTickets for help on using tickets.