py:match and xi:include not working?

26 views
Skip to first unread message

Joshua J. Kugler

unread,
Sep 30, 2009, 7:02:43 PM9/30/09
to gen...@googlegroups.com
Using the tutorial on the Genshi site, I've created a layout template,
as well as a content template. I'm rendering via this call:

MarkupTemplate(open(path_to_file)).generate().render('xhtml',
doctype='html', out=open(os.path.join(path, base_name + '.html'), 'w'))

HTML is output, but it is only the content of the content template.
Nothing from the layout template is included, BUT the

<xi:include href="templates/layout.html" />

is not in the output. The documents say an error will be raised if the
include URL is not found, but if I do something like

<xi:include href="ZZZZZtemplates/layout.html" />

no error is raise, so it appears the include URL is not even being
accessed.

Bug? Or did I miss something obvious?

layout: http://pastebin.com/m5c5d7632
content: http://pastebin.com/m339a2d1f
output: http://pastebin.com/m2581a17d

Thanks!

j

--
Joshua Kugler
Part-Time System Admin/Programmer
http://www.eeinternet.com
PGP Key: http://pgp.mit.edu/  ID 0x14EA086E

Christopher Lenz

unread,
Oct 1, 2009, 5:00:42 AM10/1/09
to gen...@googlegroups.com
On 01.10.2009, at 01:02, Joshua J. Kugler wrote:
> Using the tutorial on the Genshi site, I've created a layout template,
> as well as a content template. I'm rendering via this call:
>
> MarkupTemplate(open(path_to_file)).generate().render('xhtml',
> doctype='html', out=open(os.path.join(path, base_name + '.html'),
> 'w'))
>
> HTML is output, but it is only the content of the content template.
> Nothing from the layout template is included, BUT the
>
> <xi:include href="templates/layout.html" />
>
> is not in the output. The documents say an error will be raised if
> the
> include URL is not found, but if I do something like
>
> <xi:include href="ZZZZZtemplates/layout.html" />
>
> no error is raise, so it appears the include URL is not even being
> accessed.
>
> Bug? Or did I miss something obvious?

You need to use a TemplateLoader for includes to be processed, Genshi
refuses to lookup external files on the file-system without being
explicitly told where to look for them.

Cheers,
--
Christopher Lenz
cmlenz at gmx.de
http://www.cmlenz.net/

Joshua J. Kugler

unread,
Oct 15, 2009, 1:56:09 PM10/15/09
to gen...@googlegroups.com
On Thursday 01 October 2009, Christopher Lenz said something like:

That was it! Thanks for the hint.

Reply all
Reply to author
Forward
0 new messages