Comment 5 for bug 117784

Revision history for this message
Anand Chitipothu (anandology) wrote :

Genshi has very elegant support for filtering and sanitizing html.

http://genshi.edgewall.org/wiki/Documentation/filters.html

Here is some code that I use for sanitizing user pages in Open Library.

def sanitize(html)
    stream = genshi.HTML(html) | genshi.filters.HTMLSanitizer() | genshi.filters.Transformer("a").attr("rel", "nofollow")
    return stream.render()

Should we just point people to use Genshi for doing sanitization instead of adding something to web.py?