# -*- coding: utf-8 -*- #-------------------------------- #$Date$ #$Author$ #$Revision$ #-------------------------------- #Copyright (C) 2007 Alexander Koshelev (daevaorn@gmail.com) from BeautifulSoup import BeautifulSoup UNTRUSTED_TAGS = ( "script", "form", "iframe","frame","input","select", ) def filter_untrusted( html, tags=[] ): soup = BeautifulSoup(html) for tag in tags: t = getattr( soup, tag ) t.replaceWith( "" ) return unicode( soup )