Package django :: Package contrib :: Package csrf :: Module middleware
[hide private]
[frames] | no frames]

Module middleware

source code

Cross Site Request Forgery Middleware.

This module provides a middleware that implements protection against request forgeries from other sites.

Classes [hide private]
  CsrfMiddleware
Django middleware that adds protection against Cross Site Request Forgeries by adding hidden form fields to POST forms and checking requests for the correct value.
Functions [hide private]
 
_make_token(session_id) source code
Variables [hide private]
  _ERROR_MSG = '<html xmlns="http://www.w3.org/1999/xhtml" xml:l...
  _POST_FORM_RE = re.compile(r'(?i)(<form\W[^>]*\bmethod=(\'|"|)...
  _HTML_TYPES = ('text/html', 'application/xhtml+xml')
Variables Details [hide private]

_ERROR_MSG

Value:
'<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"><body><h1>40\
3 Forbidden</h1><p>Cross Site Request Forgery detected. Request aborte\
d.</p></body></html>'

_POST_FORM_RE

Value:
re.compile(r'(?i)(<form\W[^>]*\bmethod=(\'|"|)POST(\'|"|)\b[^>]*>)')