Package trac :: Package util :: Module html :: Class FormTokenInjector

Class FormTokenInjector

source code

markupbase.ParserBase --+    
                        |    
    HTMLParser.HTMLParser --+
                            |
                           FormTokenInjector

Identify and protect forms from CSRF attacks.

This filter works by adding a input type=hidden field to POST forms.

Instance Methods
 
__init__(self, form_token, out)
Initialize and reset this instance.
source code
 
handle_starttag(self, tag, attrs) source code
 
handle_startendtag(self, tag, attrs) source code
 
handle_charref(self, name) source code
 
handle_entityref(self, name) source code
 
handle_comment(self, data) source code
 
handle_decl(self, data) source code
 
handle_pi(self, data) source code
 
handle_data(self, data) source code
 
handle_endtag(self, tag) source code

Inherited from HTMLParser.HTMLParser: check_for_whole_start_tag, clear_cdata_mode, close, error, feed, get_starttag_text, goahead, parse_bogus_comment, parse_endtag, parse_html_declaration, parse_pi, parse_starttag, reset, set_cdata_mode, unescape, unknown_decl

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

Class Variables

Inherited from HTMLParser.HTMLParser: CDATA_CONTENT_ELEMENTS, entitydefs

Method Details

__init__(self, form_token, out)
(Constructor)

source code 
Initialize and reset this instance.
Overrides: markupbase.ParserBase.__init__

handle_starttag(self, tag, attrs)

source code 
Overrides: HTMLParser.HTMLParser.handle_starttag

handle_startendtag(self, tag, attrs)

source code 
Overrides: HTMLParser.HTMLParser.handle_startendtag

handle_charref(self, name)

source code 
Overrides: HTMLParser.HTMLParser.handle_charref

handle_entityref(self, name)

source code 
Overrides: HTMLParser.HTMLParser.handle_entityref

handle_comment(self, data)

source code 
Overrides: HTMLParser.HTMLParser.handle_comment

handle_decl(self, data)

source code 
Overrides: HTMLParser.HTMLParser.handle_decl

handle_pi(self, data)

source code 
Overrides: HTMLParser.HTMLParser.handle_pi

handle_data(self, data)

source code 
Overrides: HTMLParser.HTMLParser.handle_data

handle_endtag(self, tag)

source code 
Overrides: HTMLParser.HTMLParser.handle_endtag