Hey guys,

So I'm having trouble rendering a Mako widget, containing JavaScript
code, in a Genshi template.

Here is an example widget.

    class TestMakoWidget(Widget):
        engine_name = 'mako'
        template = u"""
            <script type="text/javascript">
                for (var i=0; i < 1; i++) alert(i);
            </script>
        """

In the genshi index.html, I would hope to be able to do something like
this

   ${Markup(tmpl_context.widget())}

However, this renders my '<' characters as '&lt;'.

The only way I was able to get this to work was by doing this in the
template:

    <?python from genshi import unescape ?>
    ${Markup(unescape(Markup(tmpl_context.mako_widget())))}

However, this is unintuitive, and ugly.  There's Got To Be A Better
Way.
Does anyone have any ideas?  Am I doing something horribly wrong?

Cheers,

luke

(ps, the quickstart with this test code can be found here:
http://lmacken.fedorapeople.org/test-tg2-mako.tar.bz2)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears Trunk" 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-trunk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to