#NEWLINE# def sanitize( self , value , instance_slug ) : #NEWLINE# #INDENT# frag = html . fromstring ( bleach . clean ( value , tags = self . tags , attributes = self . attributes , styles = self . styles , strip = True ) ) #NEWLINE# frag = self . _trim_paragraphs ( frag ) #NEWLINE# frag = self . _process_images ( frag , instance_slug ) #NEWLINE# frag = self . _process_schema ( frag ) #NEWLINE# frag = self . _restrict_iframe_host ( frag ) #NEWLINE# frag = self . _process_links ( frag ) #NEWLINE# frag = self . _verify_id_namespace ( frag , instance_slug ) #NEWLINE# frag = self . _verify_link_namespace ( frag , instance_slug ) #NEWLINE# if self . classes : #NEWLINE# #INDENT# frag = self . _filter_classes ( frag ) #NEWLINE# #UNINDENT# if ( ( frag . tag == 'div' ) or ( frag . tag == 'body' ) ) : #NEWLINE# #INDENT# value = '' . join ( [ ( frag . text or '' ) , '' . join ( [ tostring ( child , encoding = unicode ) for child in frag . iterchildren ( ) ] ) ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# value = tostring ( frag , encoding = unicode ) #NEWLINE# #UNINDENT# return value