On Sep 3, 9:58 am, Roland <[email protected]> wrote:
> Hi,
>
> I'm having the same problem - did you find any solution?
>
> Roland
>
> On 25 Aug., 17:06, Crusty <[email protected]> wrote:
>
>
>
> > Hello everyone,
>
> > I am having serious trouble with genshi removing ending tags of empty
> > html tags.
> > I want to configure it like so 
> > :http://genshi.edgewall.org/wiki/Documentation/0.5.x/plugin.html#confi...
> > but I simply cannot find the spot where genshi is imported to TG and
> > options are being passed.
>
> > How can I configure it to serialize to XHTML instead of XML?
>
> > Thanks,
>
> > Tom

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
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to