Edgewall Software

Opened 16 years ago

Closed 16 years ago

#207 closed defect (fixed)

loading a template twice fails when using prefix

Reported by: Waldemar Kornewald <wkornewald@…> Owned by: cmlenz
Priority: major Milestone: 0.5
Component: Template processing Version: devel
Keywords: Cc:

Description

The filepath is not formed correctly when using prefixes because the filename is simply appended to the dirname, resulting in paths like '.../app/templates/app/bla.html' instead of '.../app/templates/bla.html'. A possible solution would be to use a full filepath instead of a dirname which will get os.path.join()ed with the filename in the template class, anyway.

Attachments (2)

quick-fix.diff (7.8 KB) - added by Waldemar Kornewald <wkornewald@…> 16 years ago.
quick fix that adds support for filepath
removed-basedir.diff (12.5 KB) - added by Waldemar Kornewald <wkornewald@…> 16 years ago.
alternatively, replaced basedir with filepath

Download all attachments as: .zip

Change History (11)

Changed 16 years ago by Waldemar Kornewald <wkornewald@…>

quick fix that adds support for filepath

comment:1 Changed 16 years ago by Waldemar Kornewald <wkornewald@…>

Is it possible to simply replace the basedir parameter with the filepath? Looks like it's used in several places.

comment:2 Changed 16 years ago by Waldemar Kornewald <wkornewald@…>

Ouch, my code isn't backwards-compatible because I always pass the filepath to the template class. :(

Changed 16 years ago by Waldemar Kornewald <wkornewald@…>

alternatively, replaced basedir with filepath

comment:3 Changed 16 years ago by Waldemar Kornewald <wkornewald@…>

Well, since the previous patch wasn't backwards-compatible here is a patch that fully breaks basedir support and replaces that feature with a full filepath as it should be.

comment:4 Changed 16 years ago by cmlenz

I cannot reproduce this and would really really like to see a test case before applying such a sweeping change as this.

comment:5 Changed 16 years ago by cmlenz

Okay, I think I can reproduce some error in this respect, but a test case would still have been nice.

comment:6 Changed 16 years ago by cmlenz

  • Component changed from General to Template processing
  • Status changed from new to assigned

A much better description from IRC:

you can reproduce the bug by loading the same template twice. the cache code will try to access mtime for tmpl.filepath, but filepath points to an non-existent path

comment:7 Changed 16 years ago by cmlenz

  • Version changed from 0.4.4 to devel

comment:8 Changed 16 years ago by Waldemar Kornewald <wkornewald@…>

Sorry for the bad description in this ticket. Any ideas how to fix it without breaking backwards compatibility? I can only come up with hacky workarounds (like the loader setting tmpl.filepath manually after creating a new template instance). :(

comment:9 Changed 16 years ago by cmlenz

  • Resolution set to fixed
  • Status changed from assigned to closed

Applied in [830]. Thanks!

Note: See TracTickets for help on using tickets.