﻿id,summary,reporter,owner,description,type,status,priority,milestone,component,version,resolution,keywords,cc
367,Permit xi:include references to be search_path relative,db3l.net@…,cmlenz,"I have cases where I have a common set of include templates for a site, but the parent templates are in their own sub-directories for simpler management. For example:

{{{
  <search_path_root>/
      include/layout.xhtml
      actions/
          move/pick_class.xhtml
}}}

Now, inside pick_class.xhtml I have to use a relative include path for xi:include of ""../../include/layout.xhtml"" which makes that file fragile in the presence of re-arranging the template directory structure.

One workaround I've used is to create a context variable containing the target root and pass that to templates, so the include href becomes something like ""${tmpl_root}/include/layout.xhtml"", but that seems clumsy at best and more problematic with multiple search roots.

What I'd like to be able to do is specify the xi:include href in a way such that it was relative to the same search root as the templates.  I've done this locally by patching base.py such that an absolute xi:include path (""/include/layout.xhtml"") becomes a relative load (strip the leading ""/"") but without a relative_to argument so relative to the search path.  I'm not absolutely sure that's the best place for the fix (as opposed to a new parameter or behavior in the !TemplateLoader.load() perhaps).

But it seems that some mechanism to permit nested includes to obey the same search path in the loader as their parent template would help improve the robustness of nested template structures, in some directory layouts, such as mine.

-- David
",enhancement,new,minor,,Template processing,0.5.1,,,
