Edgewall Software

Opened 15 years ago

Last modified 7 years ago

#328 new enhancement

Template file name namespace

Reported by: carsten.klein@… Owned by: cmlenz
Priority: minor Milestone: 0.9
Component: General Version: 0.5.1
Keywords: Cc:

Description

It occurs to me that, actually, all template file names must be unique, regardless of whether they are provided from different locations in the filesystem.

Perhaps this should be revised so, that the system can also disambiguate ambigously named templates?

Example

$OS_PATH/trac/ticket/templates/milestone.html $OS_PATH/my_plugin/templates/milestone.html

It deems to me, that whatever registered first for being a template provider (see trac) will win the race and thus become the governing template provider.

The only solution I would see here is to provide a uuid upon template registration in order to make the ambigously named templates unique, i.e.

trac.ticket registers its milestone template with

UUID-A=milestone.html

and my_plugin would register the same name template using

UUID-B=milestone.html

Thus, when passing things over to genshi's template loader, the loader would get the uuid from the registered file name and would lookup the path associated with that uuid

Another, more simple, solution would be, of course, to always include the path with the template ;)

The most easiest approach, ruling out same name templates in the api documentation, seems to be rather tricky in that all template authors must first come up with rather unique names for their templates. Having stated this, one could always also use uuids as the file names for the templates...

What is your opinion on this?

Change History (3)

comment:1 Changed 14 years ago by cmlenz

  • Milestone changed from 0.6 to 0.7

comment:2 Changed 14 years ago by Carsten Klein <carsten.klein@…>

See also the patch provided in #5 which might actually take care of this, by always using the absolute filepath instead of just the filename when looking up the template cache.

comment:3 Changed 7 years ago by hodgestar

  • Milestone changed from 0.7 to 0.9

Moved to milestone 0.9.

Note: See TracTickets for help on using tickets.