Assuming you are using TG2, you are running across this issue:
http://trac.turbogears.org/ticket/2287
In my project I've used something similar to the solution presented in
that ticket. My config/environment.py function looks like this:
# -*- coding: utf-8 -*-
"""WSGI environment setup for wicc3."""
import pylons
from wicc3.config.app_cfg import base_config
__all__ = ['load_environment']
#Use base_config to setup the environment loader function
_load_environment = base_config.make_load_environment()
# Make Genshi render HTML rather than XHTML. Unfortunately TG makes
# this very awkward.
def load_environment(*args, **kwargs):
_load_environment(*args, **kwargs)
# This is the signature of the pylons.templating.render_genshi
# function. I'm going to ignore most of the parameters
def render_genshi(template_name, extra_vars=None, cache_key=None,
cache_type=None, cache_expire=None,
method='xhtml'):
globs = extra_vars or {}
globs.update(pylons.templating.pylons_globals())
template = globs['app_globals'].genshi_loader.load
(template_name)
return (template.generate(**globs).render(method='html',
doctype='html',
encoding=None))
base_config.render_functions.genshi = render_genshi
I've had to copy the pylons.templating.render_genshi function because
the original doesn't have any way of passing the 'doctype' parameter.
I'm also ignoring any of the caching features because I don't actually
use them. If you need them, you'll probably want to copy the pylons
version more closely.
It's a shame that this isn't easier to do. I was under the impression
that (at least for "web sites" rather than "web services"), HTML is
preferred over XHTML. In fact, I think the default for TG2 is to serve
XHTML with a content type of text/html, which seems wrong.
Hope that helps,
Simon