George
=======================================================
I'm running TG with Genshi (0.3.6) and for some reason the attributes
with namespaces are removed. For instance "foo:bar" is stripped off
from the generated html for the following template:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:foo="http://www.foo.net/">
<body foo:bar="frob"/>
</html>
On the other hand, if I load the template, generate the stream and
render it manually it shows up correctly. In other words:
# This works
@tg.expose()
def tmp(self):
from genshi.template import TemplateLoader
loader = TemplateLoader([templates_dir])
tmpl = loader.load('template_path')
return tmpl.generate().render()
# This doesn't
@tg.expose(template='genshi:path.to.template')
def tmp2(self):
return {}
Any ideas ?
George
That reminds me of:
http://groups.google.com/group/genshi/browse_frm/thread/733964c568e34e01
Best Regards,
-jj
Are you by any chance using HTML serialization (the default)? It
intentionally strips all namespace information, since HTML doesn't
support namespaces.
You'll need to use XHTML serialization to make namespace info show up
in the generated output. See:
<http://genshi.edgewall.org/wiki/Documentation/plugin.html#usage>
<http://genshi.edgewall.org/wiki/Documentation/plugin.html#genshi-
default-format>
Cheers,
Chris
--
Christopher Lenz
cmlenz at gmx.de
http://www.cmlenz.net/
Ah, that was it! Genshi renders XML by default, tg.expose() does HTML.
Now I have to find out how to change the default rather than setting
format='xhtml' everywhere.
Thanks a lot,
George
I'll take another stab at trying to be useful ;)
Changing the default format is something that the Buffet plugin is
supposed to take care of. However, the last time I checked, it wasn't
possible. You might want to check to see if this is still the case.
Mike Orr has been working on updating the Buffet spec to handle things
like this.
Thanks for trying :)
> Changing the default format is something that the Buffet plugin is
> supposed to take care of. However, the last time I checked, it wasn't
> possible. You might want to check to see if this is still the case.
> Mike Orr has been working on updating the Buffet spec to handle things
> like this.
I didn't check but I found how to do it in Turbogears; just add
genshi.outputformat = "xhtml"
in /your_app/config/app.cfg and that's it.
Best,
George