This file is indexed.

/usr/share/doc/python-flaskext.wtf-doc/html/api.html is in python-flaskext.wtf-doc 0.12-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>Developer Interface &mdash; Flask-WTF 0.9.5 documentation</title>
    
    <link rel="stylesheet" href="_static/flasky.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    './',
        VERSION:     '0.9.5',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/underscore.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <link rel="top" title="Flask-WTF 0.9.5 documentation" href="index.html" />
    <link rel="next" title="Upgrading to Newer Releases" href="upgrade.html" />
    <link rel="prev" title="Configuration" href="config.html" />
   
  
  <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">

  </head>
  <body role="document">
  
  

    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="upgrade.html" title="Upgrading to Newer Releases"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="config.html" title="Configuration"
             accesskey="P">previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="index.html">Flask-WTF 0.9.5 documentation</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <div class="section" id="developer-interface">
<h1>Developer Interface<a class="headerlink" href="#developer-interface" title="Permalink to this headline"></a></h1>
<p>This part of the documentation covers all interfaces of Flask-WTF.</p>
<div class="section" id="module-flask_wtf">
<span id="forms-and-fields"></span><h2>Forms and Fields<a class="headerlink" href="#module-flask_wtf" title="Permalink to this headline"></a></h2>
<dl class="class">
<dt id="flask_wtf.Form">
<em class="property">class </em><code class="descclassname">flask_wtf.</code><code class="descname">Form</code><span class="sig-paren">(</span><em>formdata=&lt;class flask_wtf.form._Auto&gt;</em>, <em>obj=None</em>, <em>prefix=''</em>, <em>csrf_context=None</em>, <em>secret_key=None</em>, <em>csrf_enabled=None</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#flask_wtf.Form" title="Permalink to this definition"></a></dt>
<dd><p>Flask-specific subclass of WTForms <strong>SecureForm</strong> class.</p>
<p>If formdata is not specified, this will use flask.request.form.
Explicitly pass formdata = None to prevent this.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>csrf_context</strong> &#8211; a session or dict-like object to use when making
CSRF tokens. Default: flask.session.</li>
<li><strong>secret_key</strong> &#8211; <p>a secret key for building CSRF tokens. If this isn&#8217;t
specified, the form will take the first of these
that is defined:</p>
<ul>
<li>SECRET_KEY attribute on this class</li>
<li>WTF_CSRF_SECRET_KEY config of flask app</li>
<li>SECRET_KEY config of flask app</li>
<li>session secret key</li>
</ul>
</li>
<li><strong>csrf_enabled</strong> &#8211; whether to use CSRF protection. If False, all
csrf behavior is suppressed.
Default: WTF_CSRF_ENABLED config value</li>
</ul>
</td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="flask_wtf.Form.hidden_tag">
<code class="descname">hidden_tag</code><span class="sig-paren">(</span><em>*fields</em><span class="sig-paren">)</span><a class="headerlink" href="#flask_wtf.Form.hidden_tag" title="Permalink to this definition"></a></dt>
<dd><p>Wraps hidden fields in a hidden DIV tag, in order to keep XHTML
compliance.</p>
<div class="versionadded">
<p><span class="versionmodified">New in version 0.3.</span></p>
</div>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>fields</strong> &#8211; list of hidden field names. If not provided will render
all hidden fields, including the CSRF field.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="flask_wtf.Form.is_submitted">
<code class="descname">is_submitted</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#flask_wtf.Form.is_submitted" title="Permalink to this definition"></a></dt>
<dd><p>Checks if form has been submitted. The default case is if the HTTP
method is <strong>PUT</strong> or <strong>POST</strong>.</p>
</dd></dl>

<dl class="method">
<dt id="flask_wtf.Form.validate_csrf_data">
<code class="descname">validate_csrf_data</code><span class="sig-paren">(</span><em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#flask_wtf.Form.validate_csrf_data" title="Permalink to this definition"></a></dt>
<dd><p>Check if the csrf data is valid.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>data</strong> &#8211; the csrf string to be validated.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="flask_wtf.Form.validate_on_submit">
<code class="descname">validate_on_submit</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#flask_wtf.Form.validate_on_submit" title="Permalink to this definition"></a></dt>
<dd><p>Checks if form has been submitted and if so runs validate. This is
a shortcut, equivalent to <code class="docutils literal"><span class="pre">form.is_submitted()</span> <span class="pre">and</span> <span class="pre">form.validate()</span></code></p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="flask_wtf.RecaptchaField">
<em class="property">class </em><code class="descclassname">flask_wtf.</code><code class="descname">RecaptchaField</code><span class="sig-paren">(</span><em>label=''</em>, <em>validators=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#flask_wtf.RecaptchaField" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="class">
<dt id="flask_wtf.Recaptcha">
<em class="property">class </em><code class="descclassname">flask_wtf.</code><code class="descname">Recaptcha</code><span class="sig-paren">(</span><em>message=None</em><span class="sig-paren">)</span><a class="headerlink" href="#flask_wtf.Recaptcha" title="Permalink to this definition"></a></dt>
<dd><p>Validates a ReCaptcha.</p>
</dd></dl>

<dl class="class">
<dt id="flask_wtf.RecaptchaWidget">
<em class="property">class </em><code class="descclassname">flask_wtf.</code><code class="descname">RecaptchaWidget</code><a class="headerlink" href="#flask_wtf.RecaptchaWidget" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<span class="target" id="module-flask_wtf.file"></span><dl class="class">
<dt id="flask_wtf.file.FileField">
<em class="property">class </em><code class="descclassname">flask_wtf.file.</code><code class="descname">FileField</code><span class="sig-paren">(</span><em>label=None</em>, <em>validators=None</em>, <em>filters=()</em>, <em>description=u''</em>, <em>id=None</em>, <em>default=None</em>, <em>widget=None</em>, <em>render_kw=None</em>, <em>_form=None</em>, <em>_name=None</em>, <em>_prefix=u''</em>, <em>_translations=None</em>, <em>_meta=None</em><span class="sig-paren">)</span><a class="headerlink" href="#flask_wtf.file.FileField" title="Permalink to this definition"></a></dt>
<dd><p>Werkzeug-aware subclass of <strong>wtforms.FileField</strong></p>
<p>Provides a <cite>has_file()</cite> method to check if its data is a FileStorage
instance with an actual file.</p>
<dl class="method">
<dt id="flask_wtf.file.FileField.has_file">
<code class="descname">has_file</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#flask_wtf.file.FileField.has_file" title="Permalink to this definition"></a></dt>
<dd><p>Return True iff self.data is a FileStorage with file data</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="flask_wtf.file.FileAllowed">
<em class="property">class </em><code class="descclassname">flask_wtf.file.</code><code class="descname">FileAllowed</code><span class="sig-paren">(</span><em>upload_set</em>, <em>message=None</em><span class="sig-paren">)</span><a class="headerlink" href="#flask_wtf.file.FileAllowed" title="Permalink to this definition"></a></dt>
<dd><p>Validates that the uploaded file is allowed by the given
Flask-Uploads UploadSet.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>upload_set</strong> &#8211; A list/tuple of extention names or an instance
of <code class="docutils literal"><span class="pre">flask.ext.uploads.UploadSet</span></code></li>
<li><strong>message</strong> &#8211; error message</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>You can also use the synonym <strong>file_allowed</strong>.</p>
</dd></dl>

<dl class="class">
<dt id="flask_wtf.file.FileRequired">
<em class="property">class </em><code class="descclassname">flask_wtf.file.</code><code class="descname">FileRequired</code><span class="sig-paren">(</span><em>message=None</em><span class="sig-paren">)</span><a class="headerlink" href="#flask_wtf.file.FileRequired" title="Permalink to this definition"></a></dt>
<dd><p>Validates that field has a file.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>message</strong> &#8211; error message</td>
</tr>
</tbody>
</table>
<p>You can also use the synonym <strong>file_required</strong>.</p>
</dd></dl>

<span class="target" id="module-flask_wtf.html5"></span><dl class="class">
<dt id="flask_wtf.html5.SearchInput">
<em class="property">class </em><code class="descclassname">flask_wtf.html5.</code><code class="descname">SearchInput</code><span class="sig-paren">(</span><em>input_type=None</em><span class="sig-paren">)</span><a class="headerlink" href="#flask_wtf.html5.SearchInput" title="Permalink to this definition"></a></dt>
<dd><p>Renders an input with type &#8220;search&#8221;.</p>
</dd></dl>

<dl class="class">
<dt id="flask_wtf.html5.SearchField">
<em class="property">class </em><code class="descclassname">flask_wtf.html5.</code><code class="descname">SearchField</code><span class="sig-paren">(</span><em>label=None</em>, <em>validators=None</em>, <em>filters=()</em>, <em>description=u''</em>, <em>id=None</em>, <em>default=None</em>, <em>widget=None</em>, <em>render_kw=None</em>, <em>_form=None</em>, <em>_name=None</em>, <em>_prefix=u''</em>, <em>_translations=None</em>, <em>_meta=None</em><span class="sig-paren">)</span><a class="headerlink" href="#flask_wtf.html5.SearchField" title="Permalink to this definition"></a></dt>
<dd><p>Represents an <code class="docutils literal"><span class="pre">&lt;input</span> <span class="pre">type=&quot;search&quot;&gt;</span></code>.</p>
</dd></dl>

<dl class="class">
<dt id="flask_wtf.html5.URLInput">
<em class="property">class </em><code class="descclassname">flask_wtf.html5.</code><code class="descname">URLInput</code><span class="sig-paren">(</span><em>input_type=None</em><span class="sig-paren">)</span><a class="headerlink" href="#flask_wtf.html5.URLInput" title="Permalink to this definition"></a></dt>
<dd><p>Renders an input with type &#8220;url&#8221;.</p>
</dd></dl>

<dl class="class">
<dt id="flask_wtf.html5.URLField">
<em class="property">class </em><code class="descclassname">flask_wtf.html5.</code><code class="descname">URLField</code><span class="sig-paren">(</span><em>label=None</em>, <em>validators=None</em>, <em>filters=()</em>, <em>description=u''</em>, <em>id=None</em>, <em>default=None</em>, <em>widget=None</em>, <em>render_kw=None</em>, <em>_form=None</em>, <em>_name=None</em>, <em>_prefix=u''</em>, <em>_translations=None</em>, <em>_meta=None</em><span class="sig-paren">)</span><a class="headerlink" href="#flask_wtf.html5.URLField" title="Permalink to this definition"></a></dt>
<dd><p>Represents an <code class="docutils literal"><span class="pre">&lt;input</span> <span class="pre">type=&quot;url&quot;&gt;</span></code>.</p>
</dd></dl>

<dl class="class">
<dt id="flask_wtf.html5.EmailInput">
<em class="property">class </em><code class="descclassname">flask_wtf.html5.</code><code class="descname">EmailInput</code><span class="sig-paren">(</span><em>input_type=None</em><span class="sig-paren">)</span><a class="headerlink" href="#flask_wtf.html5.EmailInput" title="Permalink to this definition"></a></dt>
<dd><p>Renders an input with type &#8220;email&#8221;.</p>
</dd></dl>

<dl class="class">
<dt id="flask_wtf.html5.EmailField">
<em class="property">class </em><code class="descclassname">flask_wtf.html5.</code><code class="descname">EmailField</code><span class="sig-paren">(</span><em>label=None</em>, <em>validators=None</em>, <em>filters=()</em>, <em>description=u''</em>, <em>id=None</em>, <em>default=None</em>, <em>widget=None</em>, <em>render_kw=None</em>, <em>_form=None</em>, <em>_name=None</em>, <em>_prefix=u''</em>, <em>_translations=None</em>, <em>_meta=None</em><span class="sig-paren">)</span><a class="headerlink" href="#flask_wtf.html5.EmailField" title="Permalink to this definition"></a></dt>
<dd><p>Represents an <code class="docutils literal"><span class="pre">&lt;input</span> <span class="pre">type=&quot;email&quot;&gt;</span></code>.</p>
</dd></dl>

<dl class="class">
<dt id="flask_wtf.html5.TelInput">
<em class="property">class </em><code class="descclassname">flask_wtf.html5.</code><code class="descname">TelInput</code><span class="sig-paren">(</span><em>input_type=None</em><span class="sig-paren">)</span><a class="headerlink" href="#flask_wtf.html5.TelInput" title="Permalink to this definition"></a></dt>
<dd><p>Renders an input with type &#8220;tel&#8221;.</p>
</dd></dl>

<dl class="class">
<dt id="flask_wtf.html5.TelField">
<em class="property">class </em><code class="descclassname">flask_wtf.html5.</code><code class="descname">TelField</code><span class="sig-paren">(</span><em>label=None</em>, <em>validators=None</em>, <em>filters=()</em>, <em>description=u''</em>, <em>id=None</em>, <em>default=None</em>, <em>widget=None</em>, <em>render_kw=None</em>, <em>_form=None</em>, <em>_name=None</em>, <em>_prefix=u''</em>, <em>_translations=None</em>, <em>_meta=None</em><span class="sig-paren">)</span><a class="headerlink" href="#flask_wtf.html5.TelField" title="Permalink to this definition"></a></dt>
<dd><p>Represents an <code class="docutils literal"><span class="pre">&lt;input</span> <span class="pre">type=&quot;tel&quot;&gt;</span></code>.</p>
</dd></dl>

<dl class="class">
<dt id="flask_wtf.html5.NumberInput">
<em class="property">class </em><code class="descclassname">flask_wtf.html5.</code><code class="descname">NumberInput</code><span class="sig-paren">(</span><em>step=None</em>, <em>min=None</em>, <em>max=None</em><span class="sig-paren">)</span><a class="headerlink" href="#flask_wtf.html5.NumberInput" title="Permalink to this definition"></a></dt>
<dd><p>Renders an input with type &#8220;number&#8221;.</p>
</dd></dl>

<dl class="class">
<dt id="flask_wtf.html5.IntegerField">
<em class="property">class </em><code class="descclassname">flask_wtf.html5.</code><code class="descname">IntegerField</code><span class="sig-paren">(</span><em>label=None</em>, <em>validators=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#flask_wtf.html5.IntegerField" title="Permalink to this definition"></a></dt>
<dd><p>Represents an <code class="docutils literal"><span class="pre">&lt;input</span> <span class="pre">type=&quot;number&quot;&gt;</span></code>.</p>
</dd></dl>

<dl class="class">
<dt id="flask_wtf.html5.DecimalField">
<em class="property">class </em><code class="descclassname">flask_wtf.html5.</code><code class="descname">DecimalField</code><span class="sig-paren">(</span><em>label=None</em>, <em>validators=None</em>, <em>places=&lt;unset value&gt;</em>, <em>rounding=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#flask_wtf.html5.DecimalField" title="Permalink to this definition"></a></dt>
<dd><p>Represents an <code class="docutils literal"><span class="pre">&lt;input</span> <span class="pre">type=&quot;number&quot;&gt;</span></code>.</p>
</dd></dl>

<dl class="class">
<dt id="flask_wtf.html5.RangeInput">
<em class="property">class </em><code class="descclassname">flask_wtf.html5.</code><code class="descname">RangeInput</code><span class="sig-paren">(</span><em>step=None</em><span class="sig-paren">)</span><a class="headerlink" href="#flask_wtf.html5.RangeInput" title="Permalink to this definition"></a></dt>
<dd><p>Renders an input with type &#8220;range&#8221;.</p>
</dd></dl>

<dl class="class">
<dt id="flask_wtf.html5.IntegerRangeField">
<em class="property">class </em><code class="descclassname">flask_wtf.html5.</code><code class="descname">IntegerRangeField</code><span class="sig-paren">(</span><em>label=None</em>, <em>validators=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#flask_wtf.html5.IntegerRangeField" title="Permalink to this definition"></a></dt>
<dd><p>Represents an <code class="docutils literal"><span class="pre">&lt;input</span> <span class="pre">type=&quot;range&quot;&gt;</span></code>.</p>
</dd></dl>

<dl class="class">
<dt id="flask_wtf.html5.DecimalRangeField">
<em class="property">class </em><code class="descclassname">flask_wtf.html5.</code><code class="descname">DecimalRangeField</code><span class="sig-paren">(</span><em>label=None</em>, <em>validators=None</em>, <em>places=&lt;unset value&gt;</em>, <em>rounding=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#flask_wtf.html5.DecimalRangeField" title="Permalink to this definition"></a></dt>
<dd><p>Represents an <code class="docutils literal"><span class="pre">&lt;input</span> <span class="pre">type=&quot;range&quot;&gt;</span></code>.</p>
</dd></dl>

</div>
<div class="section" id="module-flask_wtf.csrf">
<span id="csrf-protection"></span><h2>CSRF Protection<a class="headerlink" href="#module-flask_wtf.csrf" title="Permalink to this headline"></a></h2>
<dl class="class">
<dt id="flask_wtf.csrf.CsrfProtect">
<em class="property">class </em><code class="descclassname">flask_wtf.csrf.</code><code class="descname">CsrfProtect</code><span class="sig-paren">(</span><em>app=None</em><span class="sig-paren">)</span><a class="headerlink" href="#flask_wtf.csrf.CsrfProtect" title="Permalink to this definition"></a></dt>
<dd><p>Enable csrf protect for Flask.</p>
<p>Register it with:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">app</span> <span class="o">=</span> <span class="n">Flask</span><span class="p">(</span><span class="n">__name__</span><span class="p">)</span>
<span class="n">CsrfProtect</span><span class="p">(</span><span class="n">app</span><span class="p">)</span>
</pre></div>
</div>
<p>And in the templates, add the token input:</p>
<div class="highlight-python"><div class="highlight"><pre>&lt;input type=&quot;hidden&quot; name=&quot;csrf_token&quot; value=&quot;{{ csrf_token() }}&quot;/&gt;
</pre></div>
</div>
<p>If you need to send the token via AJAX, and there is no form:</p>
<div class="highlight-python"><div class="highlight"><pre>&lt;meta name=&quot;csrf_token&quot; content=&quot;{{ csrf_token() }}&quot; /&gt;
</pre></div>
</div>
<p>You can grab the csrf token with JavaScript, and send the token together.</p>
<dl class="method">
<dt id="flask_wtf.csrf.CsrfProtect.error_handler">
<code class="descname">error_handler</code><span class="sig-paren">(</span><em>view</em><span class="sig-paren">)</span><a class="headerlink" href="#flask_wtf.csrf.CsrfProtect.error_handler" title="Permalink to this definition"></a></dt>
<dd><p>A decorator that set the error response handler.</p>
<p>It accepts one parameter <cite>reason</cite>:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="nd">@csrf.error_handler</span>
<span class="k">def</span> <span class="nf">csrf_error</span><span class="p">(</span><span class="n">reason</span><span class="p">):</span>
    <span class="k">return</span> <span class="n">render_template</span><span class="p">(</span><span class="s1">&#39;error.html&#39;</span><span class="p">,</span> <span class="n">reason</span><span class="o">=</span><span class="n">reason</span><span class="p">)</span>
</pre></div>
</div>
<p>By default, it will return a 400 response.</p>
</dd></dl>

<dl class="method">
<dt id="flask_wtf.csrf.CsrfProtect.exempt">
<code class="descname">exempt</code><span class="sig-paren">(</span><em>view</em><span class="sig-paren">)</span><a class="headerlink" href="#flask_wtf.csrf.CsrfProtect.exempt" title="Permalink to this definition"></a></dt>
<dd><p>A decorator that can exclude a view from csrf protection.</p>
<p>Remember to put the decorator above the <cite>route</cite>:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">csrf</span> <span class="o">=</span> <span class="n">CsrfProtect</span><span class="p">(</span><span class="n">app</span><span class="p">)</span>

<span class="nd">@csrf.exempt</span>
<span class="nd">@app.route</span><span class="p">(</span><span class="s1">&#39;/some-view&#39;</span><span class="p">,</span> <span class="n">methods</span><span class="o">=</span><span class="p">[</span><span class="s1">&#39;POST&#39;</span><span class="p">])</span>
<span class="k">def</span> <span class="nf">some_view</span><span class="p">():</span>
    <span class="k">return</span>
</pre></div>
</div>
</dd></dl>

</dd></dl>

<dl class="function">
<dt id="flask_wtf.csrf.generate_csrf">
<code class="descclassname">flask_wtf.csrf.</code><code class="descname">generate_csrf</code><span class="sig-paren">(</span><em>secret_key=None</em>, <em>time_limit=None</em><span class="sig-paren">)</span><a class="headerlink" href="#flask_wtf.csrf.generate_csrf" title="Permalink to this definition"></a></dt>
<dd><p>Generate csrf token code.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>secret_key</strong> &#8211; A secret key for mixing in the token,
default is Flask.secret_key.</li>
<li><strong>time_limit</strong> &#8211; Token valid in the time limit,
default is 3600s.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="flask_wtf.csrf.validate_csrf">
<code class="descclassname">flask_wtf.csrf.</code><code class="descname">validate_csrf</code><span class="sig-paren">(</span><em>data</em>, <em>secret_key=None</em>, <em>time_limit=None</em><span class="sig-paren">)</span><a class="headerlink" href="#flask_wtf.csrf.validate_csrf" title="Permalink to this definition"></a></dt>
<dd><p>Check if the given data is a valid csrf token.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>data</strong> &#8211; The csrf token value to be checked.</li>
<li><strong>secret_key</strong> &#8211; A secret key for mixing in the token,
default is Flask.secret_key.</li>
<li><strong>time_limit</strong> &#8211; Check if the csrf token is expired.
default is True.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
  <h3><a href="index.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">Developer Interface</a><ul>
<li><a class="reference internal" href="#module-flask_wtf">Forms and Fields</a></li>
<li><a class="reference internal" href="#module-flask_wtf.csrf">CSRF Protection</a></li>
</ul>
</li>
</ul>
<h3>Related Topics</h3>
<ul>
  <li><a href="index.html">Documentation overview</a><ul>
      <li>Previous: <a href="config.html" title="previous chapter">Configuration</a></li>
      <li>Next: <a href="upgrade.html" title="next chapter">Upgrading to Newer Releases</a></li>
  </ul></li>
</ul>
  <div role="note" aria-label="source link">
    <h3>This Page</h3>
    <ul class="this-page-menu">
      <li><a href="_sources/api.txt"
            rel="nofollow">Show Source</a></li>
    </ul>
   </div>
<div id="searchbox" style="display: none" role="search">
  <h3>Quick search</h3>
    <form class="search" action="search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
  <div class="footer">
    &copy; Copyright 2010, Dan Jacob.
  </div>
  
  </body>
</html>