Package web2py :: Package gluon :: Module sanitizer :: Class XssCleaner
[hide private]
[frames] | no frames]

Class XssCleaner

source code

markupbase.ParserBase --+        
                        |        
       sgmllib.SGMLParser --+    
                            |    
           htmllib.HTMLParser --+
                                |
                               XssCleaner

Instance Methods [hide private]
 
__init__(self, permitted_tags=['a', 'b', 'blockquote', 'br/', 'i', 'li', 'ol', 'ul', 'p', 'c..., allowed_attributes={'a': ['href', 'title'], 'blockquote': ['type'], 'img': ['src'..., fmt=<class formatter.AbstractFormatter at 0xa77cb0>, strip_disallowed=True)
Creates an instance of the HTMLParser class.
source code
 
handle_data(self, data) source code
 
handle_charref(self, ref)
Handle character reference, no need to override.
source code
 
handle_entityref(self, ref)
Handle entity references, no need to override.
source code
 
handle_comment(self, comment) source code
 
handle_starttag(self, tag, method, attrs) source code
 
handle_endtag(self, tag, attrs) source code
 
unknown_starttag(self, tag, attributes) source code
 
unknown_endtag(self, tag) source code
 
url_is_acceptable(self, url)
Accepts relative and absolute urls
source code
 
strip(self, rawstring, escape=True)
Returns the argument stripped of potentially harmful HTML or Javascript code
source code
 
xtags(self)
Returns a printable string informing the user which tags are allowed
source code

Inherited from htmllib.HTMLParser: anchor_bgn, anchor_end, ddpop, do_base, do_br, do_dd, do_dt, do_hr, do_img, do_isindex, do_li, do_link, do_meta, do_nextid, do_p, do_plaintext, end_a, end_address, end_b, end_blockquote, end_body, end_cite, end_code, end_dir, end_dl, end_em, end_h1, end_h2, end_h3, end_h4, end_h5, end_h6, end_head, end_html, end_i, end_kbd, end_listing, end_menu, end_ol, end_pre, end_samp, end_strong, end_title, end_tt, end_ul, end_var, end_xmp, error, handle_image, reset, save_bgn, save_end, start_a, start_address, start_b, start_blockquote, start_body, start_cite, start_code, start_dir, start_dl, start_em, start_h1, start_h2, start_h3, start_h4, start_h5, start_h6, start_head, start_html, start_i, start_kbd, start_listing, start_menu, start_ol, start_pre, start_samp, start_strong, start_title, start_tt, start_ul, start_var, start_xmp

Inherited from sgmllib.SGMLParser: close, convert_charref, convert_codepoint, convert_entityref, feed, finish_endtag, finish_shorttag, finish_starttag, get_starttag_text, goahead, handle_decl, handle_pi, parse_endtag, parse_pi, parse_starttag, report_unbalanced, setliteral, setnomoretags, unknown_charref, unknown_entityref

Inherited from sgmllib.SGMLParser (private): _convert_ref

Inherited from markupbase.ParserBase: getpos, parse_comment, parse_declaration, parse_marked_section, unknown_decl, updatepos

Inherited from markupbase.ParserBase (private): _parse_doctype_attlist, _parse_doctype_element, _parse_doctype_entity, _parse_doctype_notation, _parse_doctype_subset, _scan_name

Class Variables [hide private]

Inherited from sgmllib.SGMLParser: entity_or_charref

Inherited from sgmllib.SGMLParser (private): _decl_otherchars

Method Details [hide private]

__init__(self, permitted_tags=['a', 'b', 'blockquote', 'br/', 'i', 'li', 'ol', 'ul', 'p', 'c..., allowed_attributes={'a': ['href', 'title'], 'blockquote': ['type'], 'img': ['src'..., fmt=<class formatter.AbstractFormatter at 0xa77cb0>, strip_disallowed=True)
(Constructor)

source code 

Creates an instance of the HTMLParser class.

The formatter parameter is the formatter instance associated with the parser.
Overrides: htmllib.HTMLParser.__init__
(inherited documentation)

handle_data(self, data)

source code 
Overrides: htmllib.HTMLParser.handle_data

handle_charref(self, ref)

source code 
Handle character reference, no need to override.
Overrides: sgmllib.SGMLParser.handle_charref
(inherited documentation)

handle_entityref(self, ref)

source code 
Handle entity references, no need to override.
Overrides: sgmllib.SGMLParser.handle_entityref
(inherited documentation)

handle_comment(self, comment)

source code 
Overrides: sgmllib.SGMLParser.handle_comment

handle_starttag(self, tag, method, attrs)

source code 
Overrides: sgmllib.SGMLParser.handle_starttag

handle_endtag(self, tag, attrs)

source code 
Overrides: sgmllib.SGMLParser.handle_endtag

unknown_starttag(self, tag, attributes)

source code 
Overrides: htmllib.HTMLParser.unknown_starttag

unknown_endtag(self, tag)

source code 
Overrides: htmllib.HTMLParser.unknown_endtag

strip(self, rawstring, escape=True)

source code 
Returns the argument stripped of potentially harmful HTML or Javascript code
Parameters:
  • escape (boolean) - If True (default) it escapes the potentially harmful content, otherwise remove it