librelist archives

« back to archive

path to global template subdir under genshi

path to global template subdir under genshi

From:
Eli Stevens (Gmail)
Date:
2011-12-05 @ 19:26
Hello,

I have a directory structure set up like this:

webapp/templates/boilerplate/header.xml
webapp/
   myblueprint/
       templates/
           foo.xml
       controller.py


I'm using the flask-genshi plugin.  Inside of foo.xml I'm trying to:

   <xi:include href="boilerplate/header.xml"></xi:include>

But I keep getting this error, no matter how I spell it:

 File "build/bdist.macosx-10.6-intel/egg/genshi/template/loader.py",
line 246, in load
   raise TemplateNotFound(filename, search_path)
TemplateNotFound: Template "/boilerplate/header.xml" not found

At the top of the controller in question, I have the following code:

   for x in app.genshi_instance.template_loader.search_path:
       try:
           print x
           print x('boilerplate/header.xml')
       except Exception, e:
           print e
           pass

Which produces:

<function _load_from_directory at 0x104b492a8>
('/.../webapp/templates/boilerplate/header.xml',
'boilerplate/header.xml', <open file
'/.../webapp/templates/boilerplate/header.xml', mode 'U' at
0x104b27a50>, <function _uptodate at 0x104b49488>)
<function _dispatch_by_prefix at 0x104b49410>
Template "boilerplate/header.xml" not found

Which implies that _load_from_directory can find the template, so I'm
at a loss as to how I need to spell it for the xi:include.  :(  Can
anyone shed some light on what I should be doing?

Thanks,
Eli

Re: path to global template subdir under genshi

From:
Eli Stevens (Gmail)
Date:
2011-12-07 @ 20:10
As a followup, trying to access 'otherblueprint/something.xml'
correctly finds webapp/otherblueprint/templates/something.xml from the
controller, but not from the xi:include in the template.

I've logged an issue here:

https://github.com/dag/flask-genshi/issues/14

Does anyone know if the flask-genshi author is actively maintaining
the project and/or is on this list?  The most recent commits on the
project seem to be September.

Eli

On Mon, Dec 5, 2011 at 11:26 AM, Eli Stevens (Gmail)
<wickedgrey@gmail.com> wrote:
> Hello,
>
> I have a directory structure set up like this:
>
> webapp/templates/boilerplate/header.xml
> webapp/
>    myblueprint/
>        templates/
>            foo.xml
>        controller.py
>
>
> I'm using the flask-genshi plugin.  Inside of foo.xml I'm trying to:
>
>    <xi:include href="boilerplate/header.xml"></xi:include>
>
> But I keep getting this error, no matter how I spell it:
>
>  File "build/bdist.macosx-10.6-intel/egg/genshi/template/loader.py",
> line 246, in load
>    raise TemplateNotFound(filename, search_path)
> TemplateNotFound: Template "/boilerplate/header.xml" not found
>
> At the top of the controller in question, I have the following code:
>
>    for x in app.genshi_instance.template_loader.search_path:
>        try:
>            print x
>            print x('boilerplate/header.xml')
>        except Exception, e:
>            print e
>            pass
>
> Which produces:
>
> <function _load_from_directory at 0x104b492a8>
> ('/.../webapp/templates/boilerplate/header.xml',
> 'boilerplate/header.xml', <open file
> '/.../webapp/templates/boilerplate/header.xml', mode 'U' at
> 0x104b27a50>, <function _uptodate at 0x104b49488>)
> <function _dispatch_by_prefix at 0x104b49410>
> Template "boilerplate/header.xml" not found
>
> Which implies that _load_from_directory can find the template, so I'm
> at a loss as to how I need to spell it for the xi:include.  :(  Can
> anyone shed some light on what I should be doing?
>
> Thanks,
> Eli