Hi all,

I was experimenting with XHTML support in Genshi+TurboGears 1.1 when I
discovered a IMHO serious limitation in the current implementation of
Buffet. I have to go into some detail to explain this.

To fix ticket 1963 I changed view.load_engines to set
'genshi.default_doctype' to "html". Now I discovered that this is no
good because then the Genshi Buffet plugin will always output a HTML DTD
even if the template output format is XHTML [1]. This means that if you
do this:

    @expose('mypkg.templates.blah", format="xhtml")

you will get an invalid template output with a HTML doctype but a XHTML
 document. Unfortunately, it doesn't help to set
'genshi.default_doctype' to None, because then Genshi will always output

Apparently there is no way to change the doctype (or any other template
engine option besides 'format' and 'fragment') for two reasons:

1) According to the Buffet API, template engine options can only be set
when they are instantiated. In TG template engines are instantiated [2]
on TG startup [3] and then never changed again.

2) The 'expose' decorator accepts a 'mapping' keyword arg, for which the
docstring says:

"mapping with options that are sent to the template engine"

but this arg is thrown away by turbogears.util.adapt_call() [4]  and
would not be supported by the Buffet API anyway, so it is entirely useless!

So my questions are:

- Should the Genshi Buffet plugin determine the doctype from the
template format? Should this be reported as a bug to the Genshi project?

- Is there any way to pass additional options to a Buffet engine after
it has been instantiated, or do we need to change the Buffet API to
allow this?


[1] genshi.template.plugin.MarkupTemplateEnginePlugin._get_render_options()
[2] turbogears.view.load_engines()
[3] turbogears.startupstartTurboGears()
[4] turbogears.view.render()

You received this message because you are subscribed to the Google Groups 
"TurboGears Trunk" group.
To post to this group, send email to turbogears-trunk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 

Reply via email to