iain duncan wrote:
> Two issues: 
> - It doesn't seem to change the output format for any widgets, where
> should I do that? Do I need to do it in every individual widget or is
> there a global flag for that?

The widgets get serialized together with the main template, so the same 
output format should apply. Only if you use the "render()" method of a 
widget, then you can define an individual output format as parameter.

> - The list of noescape_elements behaves strangely. If I set it to an
> empty list, all elements are escaped as I would expect. If I don't set
> it and peek at it, the list has the style and script tag in it, but they
> get escaped anyway. If I add anything to the list, say div, the list
> appears to have ['style', 'script', 'div'], then suddenly *no* html tags
> are escaped. ( They all get through ).

Maybe you misunderstand what noescape_elements is intended for. It is 
actually only about whether the content of a tag is interpreted as cdata 
or pcdata, after the input is already read.

You can see the difference here:

output = kid.HTMLSerializer(doctype='html')
output.noescape_elements.add('a')

print kid.Template("""
<html xmlns:py="http://purl.org/kid/ns#";>
<a>&amp;</a><b>&amp;</b></html>
""").serialize(output=output)

This gives:

<a>&</a><b>&amp;</b>

As you see, the content of the <a> tag is not escaped.

> I suppose the other option is to have something like tidy or beautiful
> soup deal with it, but then I'm not sure how to deal with xml entities
> the best way. Is there someway to test in a validator whether kid's
> XML() function will let the code through? 

I'm not sure what you actually want to accomplish, but if it is about 
user input that may contain html tags, then tidy is a solution. I think 
this has already been discussed several times on the list and there were 
several alternatives.

-- Chris

--~--~---------~--~----~------------~-------~--~----~
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