On Friday 09 March 2007 02:15, iain duncan wrote:
> On Thu, 2007-08-03 at 20:18 -0300, Jorge Godoy wrote:
> > iain duncan <[EMAIL PROTECTED]> writes:
> > > Problem is that now we are choking on the ampersand character. What is
> > > the recommended way of handling special characters in input that is
> > > destined to be included through something like:
> > >
> > > ${XML(rendered_widget)}
> >
> > Escape them. '&' becomes '&', so you might end up with '&amp;'
> > to generate an '&' output.
>
> Do you do that manually or is there a tg standard way of escaping
> special chars? ( I had been under the impression that the XML() function
> did just that, but I guess I'm wrong! )
You certainly are, XML takes a well-formed XML-document and creates an element
tree out of it, for template inclusion.
So you must be generating not-wellformed XML. Use xml.sax.saxutils.escape()
and xml.sax.saxutils.quoteattr() to generate it.
And I've been puzzling over how to generate recursive XML using KID myself,
would be nice if someone had an example...
Diez
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---