Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/app/static/doc/flask-docs
diff options
context:
space:
mode:
Diffstat (limited to 'app/static/doc/flask-docs')
-rw-r--r--app/static/doc/flask-docs/.buildinfo4
-rw-r--r--app/static/doc/flask-docs/_images/debugger.pngbin0 -> 123545 bytes
-rw-r--r--app/static/doc/flask-docs/_images/debugger1.pngbin0 -> 123545 bytes
-rw-r--r--app/static/doc/flask-docs/_images/debugger2.pngbin0 -> 123545 bytes
-rw-r--r--app/static/doc/flask-docs/_images/debugger3.pngbin0 -> 123545 bytes
-rw-r--r--app/static/doc/flask-docs/_images/debugger4.pngbin0 -> 123545 bytes
-rw-r--r--app/static/doc/flask-docs/_images/debugger5.pngbin0 -> 123545 bytes
-rw-r--r--app/static/doc/flask-docs/_images/flaskr.pngbin0 -> 53571 bytes
-rw-r--r--app/static/doc/flask-docs/_images/logo-full.pngbin0 -> 20806 bytes
-rw-r--r--app/static/doc/flask-docs/_images/logo-full1.pngbin0 -> 20806 bytes
-rw-r--r--app/static/doc/flask-docs/_images/logo-full2.pngbin0 -> 20806 bytes
-rw-r--r--app/static/doc/flask-docs/_images/no.pngbin0 -> 317 bytes
-rw-r--r--app/static/doc/flask-docs/_images/yes.pngbin0 -> 277 bytes
-rw-r--r--app/static/doc/flask-docs/_sources/api.txt624
-rw-r--r--app/static/doc/flask-docs/_sources/becomingbig.txt88
-rw-r--r--app/static/doc/flask-docs/_sources/blueprints.txt203
-rw-r--r--app/static/doc/flask-docs/_sources/changelog.txt1
-rw-r--r--app/static/doc/flask-docs/_sources/config.txt384
-rw-r--r--app/static/doc/flask-docs/_sources/deploying/cgi.txt46
-rw-r--r--app/static/doc/flask-docs/_sources/deploying/fastcgi.txt164
-rw-r--r--app/static/doc/flask-docs/_sources/deploying/index.txt23
-rw-r--r--app/static/doc/flask-docs/_sources/deploying/mod_wsgi.txt167
-rw-r--r--app/static/doc/flask-docs/_sources/deploying/others.txt102
-rw-r--r--app/static/doc/flask-docs/_sources/deploying/uwsgi.txt68
-rw-r--r--app/static/doc/flask-docs/_sources/design.txt191
-rw-r--r--app/static/doc/flask-docs/_sources/errorhandling.txt237
-rw-r--r--app/static/doc/flask-docs/_sources/extensiondev.txt387
-rw-r--r--app/static/doc/flask-docs/_sources/extensions.txt48
-rw-r--r--app/static/doc/flask-docs/_sources/foreword.txt100
-rw-r--r--app/static/doc/flask-docs/_sources/htmlfaq.txt207
-rw-r--r--app/static/doc/flask-docs/_sources/index.txt30
-rw-r--r--app/static/doc/flask-docs/_sources/installation.txt175
-rw-r--r--app/static/doc/flask-docs/_sources/latexindex.txt6
-rw-r--r--app/static/doc/flask-docs/_sources/license.txt48
-rw-r--r--app/static/doc/flask-docs/_sources/patterns/appdispatch.txt170
-rw-r--r--app/static/doc/flask-docs/_sources/patterns/appfactories.txt75
-rw-r--r--app/static/doc/flask-docs/_sources/patterns/caching.txt69
-rw-r--r--app/static/doc/flask-docs/_sources/patterns/deferredcallbacks.txt73
-rw-r--r--app/static/doc/flask-docs/_sources/patterns/distribute.txt166
-rw-r--r--app/static/doc/flask-docs/_sources/patterns/errorpages.txt77
-rw-r--r--app/static/doc/flask-docs/_sources/patterns/fabric.txt196
-rw-r--r--app/static/doc/flask-docs/_sources/patterns/favicon.txt53
-rw-r--r--app/static/doc/flask-docs/_sources/patterns/fileuploads.txt181
-rw-r--r--app/static/doc/flask-docs/_sources/patterns/flashing.txt119
-rw-r--r--app/static/doc/flask-docs/_sources/patterns/index.txt39
-rw-r--r--app/static/doc/flask-docs/_sources/patterns/jquery.txt167
-rw-r--r--app/static/doc/flask-docs/_sources/patterns/lazyloading.txt104
-rw-r--r--app/static/doc/flask-docs/_sources/patterns/mongokit.txt144
-rw-r--r--app/static/doc/flask-docs/_sources/patterns/packages.txt115
-rw-r--r--app/static/doc/flask-docs/_sources/patterns/sqlalchemy.txt214
-rw-r--r--app/static/doc/flask-docs/_sources/patterns/sqlite3.txt119
-rw-r--r--app/static/doc/flask-docs/_sources/patterns/streaming.txt61
-rw-r--r--app/static/doc/flask-docs/_sources/patterns/templateinheritance.txt69
-rw-r--r--app/static/doc/flask-docs/_sources/patterns/urlprocessors.txt126
-rw-r--r--app/static/doc/flask-docs/_sources/patterns/viewdecorators.txt168
-rw-r--r--app/static/doc/flask-docs/_sources/patterns/wtforms.txt124
-rw-r--r--app/static/doc/flask-docs/_sources/quickstart.txt824
-rw-r--r--app/static/doc/flask-docs/_sources/reqcontext.txt239
-rw-r--r--app/static/doc/flask-docs/_sources/security.txt175
-rw-r--r--app/static/doc/flask-docs/_sources/shell.txt93
-rw-r--r--app/static/doc/flask-docs/_sources/signals.txt255
-rw-r--r--app/static/doc/flask-docs/_sources/styleguide.txt200
-rw-r--r--app/static/doc/flask-docs/_sources/templating.txt188
-rw-r--r--app/static/doc/flask-docs/_sources/testing.txt307
-rw-r--r--app/static/doc/flask-docs/_sources/tutorial/css.txt31
-rw-r--r--app/static/doc/flask-docs/_sources/tutorial/dbcon.txt57
-rw-r--r--app/static/doc/flask-docs/_sources/tutorial/dbinit.txt67
-rw-r--r--app/static/doc/flask-docs/_sources/tutorial/folders.txt23
-rw-r--r--app/static/doc/flask-docs/_sources/tutorial/index.txt32
-rw-r--r--app/static/doc/flask-docs/_sources/tutorial/introduction.txt33
-rw-r--r--app/static/doc/flask-docs/_sources/tutorial/schema.txt25
-rw-r--r--app/static/doc/flask-docs/_sources/tutorial/setup.txt90
-rw-r--r--app/static/doc/flask-docs/_sources/tutorial/templates.txt111
-rw-r--r--app/static/doc/flask-docs/_sources/tutorial/testing.txt10
-rw-r--r--app/static/doc/flask-docs/_sources/tutorial/views.txt98
-rw-r--r--app/static/doc/flask-docs/_sources/unicode.txt107
-rw-r--r--app/static/doc/flask-docs/_sources/upgrading.txt324
-rw-r--r--app/static/doc/flask-docs/_sources/views.txt227
-rw-r--r--app/static/doc/flask-docs/_static/ajax-loader.gifbin0 -> 673 bytes
-rw-r--r--app/static/doc/flask-docs/_static/basic.css540
-rw-r--r--app/static/doc/flask-docs/_static/comment-bright.pngbin0 -> 3500 bytes
-rw-r--r--app/static/doc/flask-docs/_static/comment-close.pngbin0 -> 3578 bytes
-rw-r--r--app/static/doc/flask-docs/_static/comment.pngbin0 -> 3445 bytes
-rw-r--r--app/static/doc/flask-docs/_static/debugger.pngbin0 -> 123545 bytes
-rw-r--r--app/static/doc/flask-docs/_static/doctools.js247
-rw-r--r--app/static/doc/flask-docs/_static/down-pressed.pngbin0 -> 368 bytes
-rw-r--r--app/static/doc/flask-docs/_static/down.pngbin0 -> 363 bytes
-rw-r--r--app/static/doc/flask-docs/_static/file.pngbin0 -> 392 bytes
-rw-r--r--app/static/doc/flask-docs/_static/flask.pngbin0 -> 9925 bytes
-rw-r--r--app/static/doc/flask-docs/_static/flaskr.pngbin0 -> 53571 bytes
-rw-r--r--app/static/doc/flask-docs/_static/flasky.css387
-rw-r--r--app/static/doc/flask-docs/_static/jquery.js154
-rw-r--r--app/static/doc/flask-docs/_static/logo-full.pngbin0 -> 20806 bytes
-rw-r--r--app/static/doc/flask-docs/_static/minus.pngbin0 -> 199 bytes
-rw-r--r--app/static/doc/flask-docs/_static/no.pngbin0 -> 317 bytes
-rw-r--r--app/static/doc/flask-docs/_static/plus.pngbin0 -> 199 bytes
-rw-r--r--app/static/doc/flask-docs/_static/pygments.css70
-rw-r--r--app/static/doc/flask-docs/_static/searchtools.js556
-rw-r--r--app/static/doc/flask-docs/_static/small_flask.css70
-rw-r--r--app/static/doc/flask-docs/_static/touch-icon.pngbin0 -> 3624 bytes
-rw-r--r--app/static/doc/flask-docs/_static/underscore.js23
-rw-r--r--app/static/doc/flask-docs/_static/up-pressed.pngbin0 -> 372 bytes
-rw-r--r--app/static/doc/flask-docs/_static/up.pngbin0 -> 363 bytes
-rw-r--r--app/static/doc/flask-docs/_static/websupport.js808
-rw-r--r--app/static/doc/flask-docs/_static/yes.pngbin0 -> 277 bytes
-rw-r--r--app/static/doc/flask-docs/api.html3475
-rw-r--r--app/static/doc/flask-docs/becomingbig.html187
-rw-r--r--app/static/doc/flask-docs/blueprints.html306
-rw-r--r--app/static/doc/flask-docs/changelog.html418
-rw-r--r--app/static/doc/flask-docs/config.html505
-rw-r--r--app/static/doc/flask-docs/deploying/cgi.html153
-rw-r--r--app/static/doc/flask-docs/deploying/fastcgi.html259
-rw-r--r--app/static/doc/flask-docs/deploying/index.html150
-rw-r--r--app/static/doc/flask-docs/deploying/mod_wsgi.html255
-rw-r--r--app/static/doc/flask-docs/deploying/others.html200
-rw-r--r--app/static/doc/flask-docs/deploying/uwsgi.html167
-rw-r--r--app/static/doc/flask-docs/design.html276
-rw-r--r--app/static/doc/flask-docs/errorhandling.html347
-rw-r--r--app/static/doc/flask-docs/extensiondev.html475
-rw-r--r--app/static/doc/flask-docs/extensions.html153
-rw-r--r--app/static/doc/flask-docs/foreword.html198
-rw-r--r--app/static/doc/flask-docs/genindex.html1287
-rw-r--r--app/static/doc/flask-docs/htmlfaq.html357
-rw-r--r--app/static/doc/flask-docs/index.html426
-rw-r--r--app/static/doc/flask-docs/installation.html249
-rw-r--r--app/static/doc/flask-docs/latexindex.html406
-rw-r--r--app/static/doc/flask-docs/license.html220
-rw-r--r--app/static/doc/flask-docs/objects.invbin0 -> 3272 bytes
-rw-r--r--app/static/doc/flask-docs/patterns/appdispatch.html273
-rw-r--r--app/static/doc/flask-docs/patterns/appfactories.html186
-rw-r--r--app/static/doc/flask-docs/patterns/caching.html178
-rw-r--r--app/static/doc/flask-docs/patterns/deferredcallbacks.html180
-rw-r--r--app/static/doc/flask-docs/patterns/distribute.html254
-rw-r--r--app/static/doc/flask-docs/patterns/errorpages.html182
-rw-r--r--app/static/doc/flask-docs/patterns/fabric.html298
-rw-r--r--app/static/doc/flask-docs/patterns/favicon.html162
-rw-r--r--app/static/doc/flask-docs/patterns/fileuploads.html283
-rw-r--r--app/static/doc/flask-docs/patterns/flashing.html221
-rw-r--r--app/static/doc/flask-docs/patterns/index.html240
-rw-r--r--app/static/doc/flask-docs/patterns/jquery.html261
-rw-r--r--app/static/doc/flask-docs/patterns/lazyloading.html214
-rw-r--r--app/static/doc/flask-docs/patterns/mongokit.html241
-rw-r--r--app/static/doc/flask-docs/patterns/packages.html219
-rw-r--r--app/static/doc/flask-docs/patterns/sqlalchemy.html310
-rw-r--r--app/static/doc/flask-docs/patterns/sqlite3.html226
-rw-r--r--app/static/doc/flask-docs/patterns/streaming.html172
-rw-r--r--app/static/doc/flask-docs/patterns/templateinheritance.html173
-rw-r--r--app/static/doc/flask-docs/patterns/urlprocessors.html237
-rw-r--r--app/static/doc/flask-docs/patterns/viewdecorators.html274
-rw-r--r--app/static/doc/flask-docs/patterns/wtforms.html224
-rw-r--r--app/static/doc/flask-docs/quickstart.html875
-rw-r--r--app/static/doc/flask-docs/reqcontext.html330
-rw-r--r--app/static/doc/flask-docs/search.html101
-rw-r--r--app/static/doc/flask-docs/searchindex.js1
-rw-r--r--app/static/doc/flask-docs/security.html260
-rw-r--r--app/static/doc/flask-docs/shell.html194
-rw-r--r--app/static/doc/flask-docs/signals.html358
-rw-r--r--app/static/doc/flask-docs/styleguide.html321
-rw-r--r--app/static/doc/flask-docs/templating.html293
-rw-r--r--app/static/doc/flask-docs/testing.html391
-rw-r--r--app/static/doc/flask-docs/tutorial/css.html132
-rw-r--r--app/static/doc/flask-docs/tutorial/dbcon.html154
-rw-r--r--app/static/doc/flask-docs/tutorial/dbinit.html166
-rw-r--r--app/static/doc/flask-docs/tutorial/folders.html122
-rw-r--r--app/static/doc/flask-docs/tutorial/index.html137
-rw-r--r--app/static/doc/flask-docs/tutorial/introduction.html128
-rw-r--r--app/static/doc/flask-docs/tutorial/schema.html125
-rw-r--r--app/static/doc/flask-docs/tutorial/setup.html183
-rw-r--r--app/static/doc/flask-docs/tutorial/templates.html212
-rw-r--r--app/static/doc/flask-docs/tutorial/testing.html113
-rw-r--r--app/static/doc/flask-docs/tutorial/views.html206
-rw-r--r--app/static/doc/flask-docs/unicode.html215
-rw-r--r--app/static/doc/flask-docs/upgrading.html421
-rw-r--r--app/static/doc/flask-docs/views.html355
174 files changed, 33573 insertions, 0 deletions
diff --git a/app/static/doc/flask-docs/.buildinfo b/app/static/doc/flask-docs/.buildinfo
new file mode 100644
index 0000000..ad0796f
--- /dev/null
+++ b/app/static/doc/flask-docs/.buildinfo
@@ -0,0 +1,4 @@
+# Sphinx build info version 1
+# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
+config: 39b2407f81d28483972c20d3689be37c
+tags: fbb0d17656682115ca4d033fb2f83ba1
diff --git a/app/static/doc/flask-docs/_images/debugger.png b/app/static/doc/flask-docs/_images/debugger.png
new file mode 100644
index 0000000..4f47229
--- /dev/null
+++ b/app/static/doc/flask-docs/_images/debugger.png
Binary files differ
diff --git a/app/static/doc/flask-docs/_images/debugger1.png b/app/static/doc/flask-docs/_images/debugger1.png
new file mode 100644
index 0000000..4f47229
--- /dev/null
+++ b/app/static/doc/flask-docs/_images/debugger1.png
Binary files differ
diff --git a/app/static/doc/flask-docs/_images/debugger2.png b/app/static/doc/flask-docs/_images/debugger2.png
new file mode 100644
index 0000000..4f47229
--- /dev/null
+++ b/app/static/doc/flask-docs/_images/debugger2.png
Binary files differ
diff --git a/app/static/doc/flask-docs/_images/debugger3.png b/app/static/doc/flask-docs/_images/debugger3.png
new file mode 100644
index 0000000..4f47229
--- /dev/null
+++ b/app/static/doc/flask-docs/_images/debugger3.png
Binary files differ
diff --git a/app/static/doc/flask-docs/_images/debugger4.png b/app/static/doc/flask-docs/_images/debugger4.png
new file mode 100644
index 0000000..4f47229
--- /dev/null
+++ b/app/static/doc/flask-docs/_images/debugger4.png
Binary files differ
diff --git a/app/static/doc/flask-docs/_images/debugger5.png b/app/static/doc/flask-docs/_images/debugger5.png
new file mode 100644
index 0000000..4f47229
--- /dev/null
+++ b/app/static/doc/flask-docs/_images/debugger5.png
Binary files differ
diff --git a/app/static/doc/flask-docs/_images/flaskr.png b/app/static/doc/flask-docs/_images/flaskr.png
new file mode 100644
index 0000000..07d027d
--- /dev/null
+++ b/app/static/doc/flask-docs/_images/flaskr.png
Binary files differ
diff --git a/app/static/doc/flask-docs/_images/logo-full.png b/app/static/doc/flask-docs/_images/logo-full.png
new file mode 100644
index 0000000..5deaf1b
--- /dev/null
+++ b/app/static/doc/flask-docs/_images/logo-full.png
Binary files differ
diff --git a/app/static/doc/flask-docs/_images/logo-full1.png b/app/static/doc/flask-docs/_images/logo-full1.png
new file mode 100644
index 0000000..5deaf1b
--- /dev/null
+++ b/app/static/doc/flask-docs/_images/logo-full1.png
Binary files differ
diff --git a/app/static/doc/flask-docs/_images/logo-full2.png b/app/static/doc/flask-docs/_images/logo-full2.png
new file mode 100644
index 0000000..5deaf1b
--- /dev/null
+++ b/app/static/doc/flask-docs/_images/logo-full2.png
Binary files differ
diff --git a/app/static/doc/flask-docs/_images/no.png b/app/static/doc/flask-docs/_images/no.png
new file mode 100644
index 0000000..4ac1083
--- /dev/null
+++ b/app/static/doc/flask-docs/_images/no.png
Binary files differ
diff --git a/app/static/doc/flask-docs/_images/yes.png b/app/static/doc/flask-docs/_images/yes.png
new file mode 100644
index 0000000..ac27c4e
--- /dev/null
+++ b/app/static/doc/flask-docs/_images/yes.png
Binary files differ
diff --git a/app/static/doc/flask-docs/_sources/api.txt b/app/static/doc/flask-docs/_sources/api.txt
new file mode 100644
index 0000000..7695788
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/api.txt
@@ -0,0 +1,624 @@
+.. _api:
+
+API
+===
+
+.. module:: flask
+
+This part of the documentation covers all the interfaces of Flask. For
+parts where Flask depends on external libraries, we document the most
+important right here and provide links to the canonical documentation.
+
+
+Application Object
+------------------
+
+.. autoclass:: Flask
+ :members:
+ :inherited-members:
+
+
+Blueprint Objects
+-----------------
+
+.. autoclass:: Blueprint
+ :members:
+ :inherited-members:
+
+Incoming Request Data
+---------------------
+
+.. autoclass:: Request
+ :members:
+
+ .. attribute:: form
+
+ A :class:`~werkzeug.datastructures.MultiDict` with the parsed form data from `POST`
+ or `PUT` requests. Please keep in mind that file uploads will not
+ end up here, but instead in the :attr:`files` attribute.
+
+ .. attribute:: args
+
+ A :class:`~werkzeug.datastructures.MultiDict` with the parsed contents of the query
+ string. (The part in the URL after the question mark).
+
+ .. attribute:: values
+
+ A :class:`~werkzeug.datastructures.CombinedMultiDict` with the contents of both
+ :attr:`form` and :attr:`args`.
+
+ .. attribute:: cookies
+
+ A :class:`dict` with the contents of all cookies transmitted with
+ the request.
+
+ .. attribute:: stream
+
+ If the incoming form data was not encoded with a known mimetype
+ the data is stored unmodified in this stream for consumption. Most
+ of the time it is a better idea to use :attr:`data` which will give
+ you that data as a string. The stream only returns the data once.
+
+ .. attribute:: headers
+
+ The incoming request headers as a dictionary like object.
+
+ .. attribute:: data
+
+ Contains the incoming request data as string in case it came with
+ a mimetype Flask does not handle.
+
+ .. attribute:: files
+
+ A :class:`~werkzeug.datastructures.MultiDict` with files uploaded as part of a
+ `POST` or `PUT` request. Each file is stored as
+ :class:`~werkzeug.datastructures.FileStorage` object. It basically behaves like a
+ standard file object you know from Python, with the difference that
+ it also has a :meth:`~werkzeug.datastructures.FileStorage.save` function that can
+ store the file on the filesystem.
+
+ .. attribute:: environ
+
+ The underlying WSGI environment.
+
+ .. attribute:: method
+
+ The current request method (``POST``, ``GET`` etc.)
+
+ .. attribute:: path
+ .. attribute:: script_root
+ .. attribute:: url
+ .. attribute:: base_url
+ .. attribute:: url_root
+
+ Provides different ways to look at the current URL. Imagine your
+ application is listening on the following URL::
+
+ http://www.example.com/myapplication
+
+ And a user requests the following URL::
+
+ http://www.example.com/myapplication/page.html?x=y
+
+ In this case the values of the above mentioned attributes would be
+ the following:
+
+ ============= ======================================================
+ `path` ``/page.html``
+ `script_root` ``/myapplication``
+ `base_url` ``http://www.example.com/myapplication/page.html``
+ `url` ``http://www.example.com/myapplication/page.html?x=y``
+ `url_root` ``http://www.example.com/myapplication/``
+ ============= ======================================================
+
+ .. attribute:: is_xhr
+
+ `True` if the request was triggered via a JavaScript
+ `XMLHttpRequest`. This only works with libraries that support the
+ ``X-Requested-With`` header and set it to `XMLHttpRequest`.
+ Libraries that do that are prototype, jQuery and Mochikit and
+ probably some more.
+
+.. class:: request
+
+ To access incoming request data, you can use the global `request`
+ object. Flask parses incoming request data for you and gives you
+ access to it through that global object. Internally Flask makes
+ sure that you always get the correct data for the active thread if you
+ are in a multithreaded environment.
+
+ This is a proxy. See :ref:`notes-on-proxies` for more information.
+
+ The request object is an instance of a :class:`~werkzeug.wrappers.Request`
+ subclass and provides all of the attributes Werkzeug defines. This
+ just shows a quick overview of the most important ones.
+
+
+Response Objects
+----------------
+
+.. autoclass:: flask.Response
+ :members: set_cookie, data, mimetype
+
+ .. attribute:: headers
+
+ A :class:`Headers` object representing the response headers.
+
+ .. attribute:: status_code
+
+ The response status as integer.
+
+
+Sessions
+--------
+
+If you have the :attr:`Flask.secret_key` set you can use sessions in Flask
+applications. A session basically makes it possible to remember
+information from one request to another. The way Flask does this is by
+using a signed cookie. So the user can look at the session contents, but
+not modify it unless they know the secret key, so make sure to set that
+to something complex and unguessable.
+
+To access the current session you can use the :class:`session` object:
+
+.. class:: session
+
+ The session object works pretty much like an ordinary dict, with the
+ difference that it keeps track on modifications.
+
+ This is a proxy. See :ref:`notes-on-proxies` for more information.
+
+ The following attributes are interesting:
+
+ .. attribute:: new
+
+ `True` if the session is new, `False` otherwise.
+
+ .. attribute:: modified
+
+ `True` if the session object detected a modification. Be advised
+ that modifications on mutable structures are not picked up
+ automatically, in that situation you have to explicitly set the
+ attribute to `True` yourself. Here an example::
+
+ # this change is not picked up because a mutable object (here
+ # a list) is changed.
+ session['objects'].append(42)
+ # so mark it as modified yourself
+ session.modified = True
+
+ .. attribute:: permanent
+
+ If set to `True` the session lives for
+ :attr:`~flask.Flask.permanent_session_lifetime` seconds. The
+ default is 31 days. If set to `False` (which is the default) the
+ session will be deleted when the user closes the browser.
+
+
+Session Interface
+-----------------
+
+.. versionadded:: 0.8
+
+The session interface provides a simple way to replace the session
+implementation that Flask is using.
+
+.. currentmodule:: flask.sessions
+
+.. autoclass:: SessionInterface
+ :members:
+
+.. autoclass:: SecureCookieSessionInterface
+ :members:
+
+.. autoclass:: NullSession
+ :members:
+
+.. autoclass:: SessionMixin
+ :members:
+
+.. admonition:: Notice
+
+ The ``PERMANENT_SESSION_LIFETIME`` config key can also be an integer
+ starting with Flask 0.8. Either catch this down yourself or use
+ the :attr:`~flask.Flask.permanent_session_lifetime` attribute on the
+ app which converts the result to an integer automatically.
+
+
+Test Client
+-----------
+
+.. currentmodule:: flask.testing
+
+.. autoclass:: FlaskClient
+ :members:
+
+
+Application Globals
+-------------------
+
+.. currentmodule:: flask
+
+To share data that is valid for one request only from one function to
+another, a global variable is not good enough because it would break in
+threaded environments. Flask provides you with a special object that
+ensures it is only valid for the active request and that will return
+different values for each request. In a nutshell: it does the right
+thing, like it does for :class:`request` and :class:`session`.
+
+.. data:: g
+
+ Just store on this whatever you want. For example a database
+ connection or the user that is currently logged in.
+
+ This is a proxy. See :ref:`notes-on-proxies` for more information.
+
+
+Useful Functions and Classes
+----------------------------
+
+.. data:: current_app
+
+ Points to the application handling the request. This is useful for
+ extensions that want to support multiple applications running side
+ by side.
+
+ This is a proxy. See :ref:`notes-on-proxies` for more information.
+
+.. autofunction:: has_request_context
+
+.. autofunction:: url_for
+
+.. function:: abort(code)
+
+ Raises an :exc:`~werkzeug.exceptions.HTTPException` for the given
+ status code. For example to abort request handling with a page not
+ found exception, you would call ``abort(404)``.
+
+ :param code: the HTTP error code.
+
+.. autofunction:: redirect
+
+.. autofunction:: make_response
+
+.. autofunction:: send_file
+
+.. autofunction:: send_from_directory
+
+.. autofunction:: safe_join
+
+.. autofunction:: escape
+
+.. autoclass:: Markup
+ :members: escape, unescape, striptags
+
+Message Flashing
+----------------
+
+.. autofunction:: flash
+
+.. autofunction:: get_flashed_messages
+
+Returning JSON
+--------------
+
+.. autofunction:: jsonify
+
+.. data:: json
+
+ If JSON support is picked up, this will be the module that Flask is
+ using to parse and serialize JSON. So instead of doing this yourself::
+
+ try:
+ import simplejson as json
+ except ImportError:
+ import json
+
+ You can instead just do this::
+
+ from flask import json
+
+ For usage examples, read the :mod:`json` documentation.
+
+ The :func:`~json.dumps` function of this json module is also available
+ as filter called ``|tojson`` in Jinja2. Note that inside `script`
+ tags no escaping must take place, so make sure to disable escaping
+ with ``|safe`` if you intend to use it inside `script` tags:
+
+ .. sourcecode:: html+jinja
+
+ <script type=text/javascript>
+ doSomethingWith({{ user.username|tojson|safe }});
+ </script>
+
+ Note that the ``|tojson`` filter escapes forward slashes properly.
+
+Template Rendering
+------------------
+
+.. autofunction:: render_template
+
+.. autofunction:: render_template_string
+
+.. autofunction:: get_template_attribute
+
+Configuration
+-------------
+
+.. autoclass:: Config
+ :members:
+
+Extensions
+----------
+
+.. data:: flask.ext
+
+ This module acts as redirect import module to Flask extensions. It was
+ added in 0.8 as the canonical way to import Flask extensions and makes
+ it possible for us to have more flexibility in how we distribute
+ extensions.
+
+ If you want to use an extension named “Flask-Foo” you would import it
+ from :data:`~flask.ext` as follows::
+
+ from flask.ext import foo
+
+ .. versionadded:: 0.8
+
+Useful Internals
+----------------
+
+.. autoclass:: flask.ctx.RequestContext
+ :members:
+
+.. data:: _request_ctx_stack
+
+ The internal :class:`~werkzeug.local.LocalStack` that is used to implement
+ all the context local objects used in Flask. This is a documented
+ instance and can be used by extensions and application code but the
+ use is discouraged in general.
+
+ The following attributes are always present on each layer of the
+ stack:
+
+ `app`
+ the active Flask application.
+
+ `url_adapter`
+ the URL adapter that was used to match the request.
+
+ `request`
+ the current request object.
+
+ `session`
+ the active session object.
+
+ `g`
+ an object with all the attributes of the :data:`flask.g` object.
+
+ `flashes`
+ an internal cache for the flashed messages.
+
+ Example usage::
+
+ from flask import _request_ctx_stack
+
+ def get_session():
+ ctx = _request_ctx_stack.top
+ if ctx is not None:
+ return ctx.session
+
+.. autoclass:: flask.blueprints.BlueprintSetupState
+ :members:
+
+Signals
+-------
+
+.. when modifying this list, also update the one in signals.rst
+
+.. versionadded:: 0.6
+
+.. data:: signals_available
+
+ `True` if the signalling system is available. This is the case
+ when `blinker`_ is installed.
+
+.. data:: template_rendered
+
+ This signal is sent when a template was successfully rendered. The
+ signal is invoked with the instance of the template as `template`
+ and the context as dictionary (named `context`).
+
+.. data:: request_started
+
+ This signal is sent before any request processing started but when the
+ request context was set up. Because the request context is already
+ bound, the subscriber can access the request with the standard global
+ proxies such as :class:`~flask.request`.
+
+.. data:: request_finished
+
+ This signal is sent right before the response is sent to the client.
+ It is passed the response to be sent named `response`.
+
+.. data:: got_request_exception
+
+ This signal is sent when an exception happens during request processing.
+ It is sent *before* the standard exception handling kicks in and even
+ in debug mode, where no exception handling happens. The exception
+ itself is passed to the subscriber as `exception`.
+
+.. data:: request_tearing_down
+
+ This signal is sent when the application is tearing down the request.
+ This is always called, even if an error happened. No arguments are
+ provided.
+
+.. currentmodule:: None
+
+.. class:: flask.signals.Namespace
+
+ An alias for :class:`blinker.base.Namespace` if blinker is available,
+ otherwise a dummy class that creates fake signals. This class is
+ available for Flask extensions that want to provide the same fallback
+ system as Flask itself.
+
+ .. method:: signal(name, doc=None)
+
+ Creates a new signal for this namespace if blinker is available,
+ otherwise returns a fake signal that has a send method that will
+ do nothing but will fail with a :exc:`RuntimeError` for all other
+ operations, including connecting.
+
+.. _blinker: http://pypi.python.org/pypi/blinker
+
+Class Based Views
+-----------------
+
+.. versionadded:: 0.7
+
+.. currentmodule:: None
+
+.. autoclass:: flask.views.View
+ :members:
+
+.. autoclass:: flask.views.MethodView
+ :members:
+
+.. _url-route-registrations:
+
+URL Route Registrations
+-----------------------
+
+Generally there are three ways to define rules for the routing system:
+
+1. You can use the :meth:`flask.Flask.route` decorator.
+2. You can use the :meth:`flask.Flask.add_url_rule` function.
+3. You can directly access the underlying Werkzeug routing system
+ which is exposed as :attr:`flask.Flask.url_map`.
+
+Variable parts in the route can be specified with angular brackets
+(``/user/<username>``). By default a variable part in the URL accepts any
+string without a slash however a different converter can be specified as
+well by using ``<converter:name>``.
+
+Variable parts are passed to the view function as keyword arguments.
+
+The following converters are available:
+
+=========== ===============================================
+`unicode` accepts any text without a slash (the default)
+`int` accepts integers
+`float` like `int` but for floating point values
+`path` like the default but also accepts slashes
+=========== ===============================================
+
+Here are some examples::
+
+ @app.route('/')
+ def index():
+ pass
+
+ @app.route('/<username>')
+ def show_user(username):
+ pass
+
+ @app.route('/post/<int:post_id>')
+ def show_post(post_id):
+ pass
+
+An important detail to keep in mind is how Flask deals with trailing
+slashes. The idea is to keep each URL unique so the following rules
+apply:
+
+1. If a rule ends with a slash and is requested without a slash by the
+ user, the user is automatically redirected to the same page with a
+ trailing slash attached.
+2. If a rule does not end with a trailing slash and the user requests the
+ page with a trailing slash, a 404 not found is raised.
+
+This is consistent with how web servers deal with static files. This
+also makes it possible to use relative link targets safely.
+
+You can also define multiple rules for the same function. They have to be
+unique however. Defaults can also be specified. Here for example is a
+definition for a URL that accepts an optional page::
+
+ @app.route('/users/', defaults={'page': 1})
+ @app.route('/users/page/<int:page>')
+ def show_users(page):
+ pass
+
+This specifies that ``/users/`` will be the URL for page one and
+``/users/page/N`` will be the URL for page `N`.
+
+Here are the parameters that :meth:`~flask.Flask.route` and
+:meth:`~flask.Flask.add_url_rule` accept. The only difference is that
+with the route parameter the view function is defined with the decorator
+instead of the `view_func` parameter.
+
+=============== ==========================================================
+`rule` the URL roule as string
+`endpoint` the endpoint for the registered URL rule. Flask itself
+ assumes that the name of the view function is the name
+ of the endpoint if not explicitly stated.
+`view_func` the function to call when serving a request to the
+ provided endpoint. If this is not provided one can
+ specify the function later by storing it in the
+ :attr:`~flask.Flask.view_functions` dictionary with the
+ endpoint as key.
+`defaults` A dictionary with defaults for this rule. See the
+ example above for how defaults work.
+`subdomain` specifies the rule for the subdomain in case subdomain
+ matching is in use. If not specified the default
+ subdomain is assumed.
+`**options` the options to be forwarded to the underlying
+ :class:`~werkzeug.routing.Rule` object. A change to
+ Werkzeug is handling of method options. methods is a list
+ of methods this rule should be limited to (`GET`, `POST`
+ etc.). By default a rule just listens for `GET` (and
+ implicitly `HEAD`). Starting with Flask 0.6, `OPTIONS` is
+ implicitly added and handled by the standard request
+ handling. They have to be specified as keyword arguments.
+=============== ==========================================================
+
+.. _view-func-options:
+
+View Function Options
+---------------------
+
+For internal usage the view functions can have some attributes attached to
+customize behavior the view function would normally not have control over.
+The following attributes can be provided optionally to either override
+some defaults to :meth:`~flask.Flask.add_url_rule` or general behavior:
+
+- `__name__`: The name of a function is by default used as endpoint. If
+ endpoint is provided explicitly this value is used. Additionally this
+ will be prefixed with the name of the blueprint by default which
+ cannot be customized from the function itself.
+
+- `methods`: If methods are not provided when the URL rule is added,
+ Flask will look on the view function object itself is an `methods`
+ attribute exists. If it does, it will pull the information for the
+ methods from there.
+
+- `provide_automatic_options`: if this attribute is set Flask will
+ either force enable or disable the automatic implementation of the
+ HTTP `OPTIONS` response. This can be useful when working with
+ decorators that want to customize the `OPTIONS` response on a per-view
+ basis.
+
+Full example::
+
+ def index():
+ if request.method == 'OPTIONS':
+ # custom options handling here
+ ...
+ return 'Hello World!'
+ index.provide_automatic_options = False
+ index.methods = ['GET', 'OPTIONS']
+
+ app.add_url_rule('/', index)
+
+.. versionadded:: 0.8
+ The `provide_automatic_options` functionality was added.
diff --git a/app/static/doc/flask-docs/_sources/becomingbig.txt b/app/static/doc/flask-docs/_sources/becomingbig.txt
new file mode 100644
index 0000000..20a0186
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/becomingbig.txt
@@ -0,0 +1,88 @@
+.. _becomingbig:
+
+Becoming Big
+============
+
+Your application is becoming more and more complex? If you suddenly
+realize that Flask does things in a way that does not work out for your
+application there are ways to deal with that.
+
+Flask is powered by Werkzeug and Jinja2, two libraries that are in use at
+a number of large websites out there and all Flask does is bring those
+two together. Being a microframework Flask does not do much more than
+combining existing libraries - there is not a lot of code involved.
+What that means for large applications is that it's very easy to take the
+code from Flask and put it into a new module within the applications and
+expand on that.
+
+Flask is designed to be extended and modified in a couple of different
+ways:
+
+- Flask extensions. For a lot of reusable functionality you can create
+ extensions. For extensions a number of hooks exist throughout Flask
+ with signals and callback functions.
+
+- Subclassing. The majority of functionality can be changed by creating
+ a new subclass of the :class:`~flask.Flask` class and overriding
+ methods provided for this exact purpose.
+
+- Forking. If nothing else works out you can just take the Flask
+ codebase at a given point and copy/paste it into your application
+ and change it. Flask is designed with that in mind and makes this
+ incredible easy. You just have to take the package and copy it
+ into your application's code and rename it (for example to
+ `framework`). Then you can start modifying the code in there.
+
+Why consider Forking?
+---------------------
+
+The majority of code of Flask is within Werkzeug and Jinja2. These
+libraries do the majority of the work. Flask is just the paste that glues
+those together. For every project there is the point where the underlying
+framework gets in the way (due to assumptions the original developers
+had). This is natural because if this would not be the case, the
+framework would be a very complex system to begin with which causes a
+steep learning curve and a lot of user frustration.
+
+This is not unique to Flask. Many people use patched and modified
+versions of their framework to counter shortcomings. This idea is also
+reflected in the license of Flask. You don't have to contribute any
+changes back if you decide to modify the framework.
+
+The downside of forking is of course that Flask extensions will most
+likely break because the new framework has a different import name.
+Furthermore integrating upstream changes can be a complex process,
+depending on the number of changes. Because of that, forking should be
+the very last resort.
+
+Scaling like a Pro
+------------------
+
+For many web applications the complexity of the code is less an issue than
+the scaling for the number of users or data entries expected. Flask by
+itself is only limited in terms of scaling by your application code, the
+data store you want to use and the Python implementation and webserver you
+are running on.
+
+Scaling well means for example that if you double the amount of servers
+you get about twice the performance. Scaling bad means that if you add a
+new server the application won't perform any better or would not even
+support a second server.
+
+There is only one limiting factor regarding scaling in Flask which are
+the context local proxies. They depend on context which in Flask is
+defined as being either a thread, process or greenlet. If your server
+uses some kind of concurrency that is not based on threads or greenlets,
+Flask will no longer be able to support these global proxies. However the
+majority of servers are using either threads, greenlets or separate
+processes to achieve concurrency which are all methods well supported by
+the underlying Werkzeug library.
+
+Dialogue with the Community
+---------------------------
+
+The Flask developers are very interested to keep everybody happy, so as
+soon as you find an obstacle in your way, caused by Flask, don't hesitate
+to contact the developers on the mailinglist or IRC channel. The best way
+for the Flask and Flask-extension developers to improve it for larger
+applications is getting feedback from users.
diff --git a/app/static/doc/flask-docs/_sources/blueprints.txt b/app/static/doc/flask-docs/_sources/blueprints.txt
new file mode 100644
index 0000000..9422fd0
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/blueprints.txt
@@ -0,0 +1,203 @@
+.. _blueprints:
+
+Modular Applications with Blueprints
+====================================
+
+.. versionadded:: 0.7
+
+Flask uses a concept of *blueprints* for making application components and
+supporting common patterns within an application or across applications.
+Blueprints can greatly simplify how large applications work and provide a
+central means for Flask extensions to register operations on applications.
+A :class:`Blueprint` object works similarly to a :class:`Flask`
+application object, but it is not actually an application. Rather it is a
+*blueprint* of how to construct or extend an application.
+
+Why Blueprints?
+---------------
+
+Blueprints in Flask are intended for these cases:
+
+* Factor an application into a set of blueprints. This is ideal for
+ larger applications; a project could instantiate an application object,
+ initialize several extensions, and register a collection of blueprints.
+* Register a blueprint on an application at a URL prefix and/or subdomain.
+ Parameters in the URL prefix/subdomain become common view arguments
+ (with defaults) across all view functions in the blueprint.
+* Register a blueprint multiple times on an application with different URL
+ rules.
+* Provide template filters, static files, templates, and other utilities
+ through blueprints. A blueprint does not have to implement applications
+ or view functions.
+* Register a blueprint on an application for any of these cases when
+ initializing a Flask extension.
+
+A blueprint in Flask is not a pluggable app because it is not actually an
+application -- it's a set of operations which can be registered on an
+application, even multiple times. Why not have multiple application
+objects? You can do that (see :ref:`app-dispatch`), but your applications
+will have separate configs and will be managed at the WSGI layer.
+
+Blueprints instead provide separation at the Flask level, share
+application config, and can change an application object as necessary with
+being registered. The downside is that you cannot unregister a blueprint
+once an application was created without having to destroy the whole
+application object.
+
+The Concept of Blueprints
+-------------------------
+
+The basic concept of blueprints is that they record operations to execute
+when registered on an application. Flask associates view functions with
+blueprints when dispatching requests and generating URLs from one endpoint
+to another.
+
+My First Blueprint
+------------------
+
+This is what a very basic blueprint looks like. In this case we want to
+implement a blueprint that does simple rendering of static templates::
+
+ from flask import Blueprint, render_template, abort
+ from jinja2 import TemplateNotFound
+
+ simple_page = Blueprint('simple_page', __name__)
+
+ @simple_page.route('/', defaults={'page': 'index'})
+ @simple_page.route('/<page>')
+ def show(page):
+ try:
+ return render_template('pages/%s.html' % page)
+ except TemplateNotFound:
+ abort(404)
+
+When you bind a function with the help of the ``@simple_page.route``
+decorator the blueprint will record the intention of registering the
+function `show` on the application when it's later registered.
+Additionally it will prefix the endpoint of the function with the
+name of the blueprint which was given to the :class:`Blueprint`
+constructor (in this case also ``simple_page``).
+
+Registering Blueprints
+----------------------
+
+So how do you register that blueprint? Like this::
+
+ from flask import Flask
+ from yourapplication.simple_page import simple_page
+
+ app = Flask(__name__)
+ app.register_blueprint(simple_page)
+
+If you check the rules registered on the application, you will find
+these::
+
+ [<Rule '/static/<filename>' (HEAD, OPTIONS, GET) -> static>,
+ <Rule '/<page>' (HEAD, OPTIONS, GET) -> simple_page.show>,
+ <Rule '/' (HEAD, OPTIONS, GET) -> simple_page.show>]
+
+The first one is obviously from the application ifself for the static
+files. The other two are for the `show` function of the ``simple_page``
+blueprint. As you can see, they are also prefixed with the name of the
+blueprint and separated by a dot (``.``).
+
+Blueprints however can also be mounted at different locations::
+
+ app.register_blueprint(simple_page, url_prefix='/pages')
+
+And sure enough, these are the generated rules::
+
+ [<Rule '/static/<filename>' (HEAD, OPTIONS, GET) -> static>,
+ <Rule '/pages/<page>' (HEAD, OPTIONS, GET) -> simple_page.show>,
+ <Rule '/pages/' (HEAD, OPTIONS, GET) -> simple_page.show>]
+
+On top of that you can register blueprints multiple times though not every
+blueprint might respond properly to that. In fact it depends on how the
+blueprint is implemented if it can be mounted more than once.
+
+Blueprint Resources
+-------------------
+
+Blueprints can provide resources as well. Sometimes you might want to
+introduce a blueprint only for the resources it provides.
+
+Blueprint Resource Folder
+`````````````````````````
+
+Like for regular applications, blueprints are considered to be contained
+in a folder. While multiple blueprints can originate from the same folder,
+it does not have to be the case and it's usually not recommended.
+
+The folder is inferred from the second argument to :class:`Blueprint` which
+is usually `__name__`. This argument specifies what logical Python
+module or package corresponds to the blueprint. If it points to an actual
+Python package that package (which is a folder on the filesystem) is the
+resource folder. If it's a module, the package the module is contained in
+will be the resource folder. You can access the
+:attr:`Blueprint.root_path` property to see what the resource folder is::
+
+ >>> simple_page.root_path
+ '/Users/username/TestProject/yourapplication'
+
+To quickly open sources from this folder you can use the
+:meth:`~Blueprint.open_resource` function::
+
+ with simple_page.open_resource('static/style.css') as f:
+ code = f.read()
+
+Static Files
+````````````
+
+A blueprint can expose a folder with static files by providing a path to a
+folder on the filesystem via the `static_folder` keyword argument. It can
+either be an absolute path or one relative to the folder of the
+blueprint::
+
+ admin = Blueprint('admin', __name__, static_folder='static')
+
+By default the rightmost part of the path is where it is exposed on the
+web. Because the folder is called ``static`` here it will be available at
+the location of the blueprint + ``/static``. Say the blueprint is
+registered for ``/admin`` the static folder will be at ``/admin/static``.
+
+The endpoint is named `blueprint_name.static` so you can generate URLs to
+it like you would do to the static folder of the application::
+
+ url_for('admin.static', filename='style.css')
+
+Templates
+`````````
+
+If you want the blueprint to expose templates you can do that by providing
+the `template_folder` parameter to the :class:`Blueprint` constructor::
+
+ admin = Blueprint('admin', __name__, template_folder='templates')
+
+As for static files, the path can be absolute or relative to the blueprint
+resource folder. The template folder is added to the searchpath of
+templates but with a lower priority than the actual application's template
+folder. That way you can easily override templates that a blueprint
+provides in the actual application.
+
+So if you have a blueprint in the folder ``yourapplication/admin`` and you
+want to render the template ``'admin/index.html'`` and you have provided
+``templates`` as a `template_folder` you will have to create a file like
+this: ``yourapplication/admin/templates/admin/index.html``.
+
+Building URLs
+-------------
+
+If you want to link from one page to another you can use the
+:func:`url_for` function just like you normally would do just that you
+prefix the URL endpoint with the name of the blueprint and a dot (``.``)::
+
+ url_for('admin.index')
+
+Additionally if you are in a view function of a blueprint or a rendered
+template and you want to link to another endpoint of the same blueprint,
+you can use relative redirects by prefixing the endpoint with a dot only::
+
+ url_for('.index')
+
+This will link to ``admin.index`` for instance in case the current request
+was dispatched to any other admin blueprint endpoint.
diff --git a/app/static/doc/flask-docs/_sources/changelog.txt b/app/static/doc/flask-docs/_sources/changelog.txt
new file mode 100644
index 0000000..d6c5f48
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/changelog.txt
@@ -0,0 +1 @@
+.. include:: ../CHANGES
diff --git a/app/static/doc/flask-docs/_sources/config.txt b/app/static/doc/flask-docs/_sources/config.txt
new file mode 100644
index 0000000..ca724dc
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/config.txt
@@ -0,0 +1,384 @@
+.. _config:
+
+Configuration Handling
+======================
+
+.. versionadded:: 0.3
+
+Applications need some kind of configuration. There are different settings
+you might want to change depending on the application environment like
+toggling the debug mode, setting the secret key, and other such
+environment-specific things.
+
+The way Flask is designed usually requires the configuration to be
+available when the application starts up. You can hardcode the
+configuration in the code, which for many small applications is not
+actually that bad, but there are better ways.
+
+Independent of how you load your config, there is a config object
+available which holds the loaded configuration values:
+The :attr:`~flask.Flask.config` attribute of the :class:`~flask.Flask`
+object. This is the place where Flask itself puts certain configuration
+values and also where extensions can put their configuration values. But
+this is also where you can have your own configuration.
+
+Configuration Basics
+--------------------
+
+The :attr:`~flask.Flask.config` is actually a subclass of a dictionary and
+can be modified just like any dictionary::
+
+ app = Flask(__name__)
+ app.config['DEBUG'] = True
+
+Certain configuration values are also forwarded to the
+:attr:`~flask.Flask` object so you can read and write them from there::
+
+ app.debug = True
+
+To update multiple keys at once you can use the :meth:`dict.update`
+method::
+
+ app.config.update(
+ DEBUG=True,
+ SECRET_KEY='...'
+ )
+
+Builtin Configuration Values
+----------------------------
+
+The following configuration values are used internally by Flask:
+
+.. tabularcolumns:: |p{6.5cm}|p{8.5cm}|
+
+================================= =========================================
+``DEBUG`` enable/disable debug mode
+``TESTING`` enable/disable testing mode
+``PROPAGATE_EXCEPTIONS`` explicitly enable or disable the
+ propagation of exceptions. If not set or
+ explicitly set to `None` this is
+ implicitly true if either `TESTING` or
+ `DEBUG` is true.
+``PRESERVE_CONTEXT_ON_EXCEPTION`` By default if the application is in
+ debug mode the request context is not
+ popped on exceptions to enable debuggers
+ to introspect the data. This can be
+ disabled by this key. You can also use
+ this setting to force-enable it for non
+ debug execution which might be useful to
+ debug production applications (but also
+ very risky).
+``SECRET_KEY`` the secret key
+``SESSION_COOKIE_NAME`` the name of the session cookie
+``SESSION_COOKIE_DOMAIN`` the domain for the session cookie. If
+ this is not set, the cookie will be
+ valid for all subdomains of
+ ``SERVER_NAME``.
+``SESSION_COOKIE_PATH`` the path for the session cookie. If
+ this is not set the cookie will be valid
+ for all of ``APPLICATION_ROOT`` or if
+ that is not set for ``'/'``.
+``SESSION_COOKIE_HTTPONLY`` controls if the cookie should be set
+ with the httponly flag. Defaults to
+ `True`.
+``SESSION_COOKIE_SECURE`` controls if the cookie should be set
+ with the secure flag. Defaults to
+ `False`.
+``PERMANENT_SESSION_LIFETIME`` the lifetime of a permanent session as
+ :class:`datetime.timedelta` object.
+ Starting with Flask 0.8 this can also be
+ an integer representing seconds.
+``USE_X_SENDFILE`` enable/disable x-sendfile
+``LOGGER_NAME`` the name of the logger
+``SERVER_NAME`` the name and port number of the server.
+ Required for subdomain support (e.g.:
+ ``'myapp.dev:5000'``) Note that
+ localhost does not support subdomains so
+ setting this to “localhost” does not
+ help.
+``APPLICATION_ROOT`` If the application does not occupy
+ a whole domain or subdomain this can
+ be set to the path where the application
+ is configured to live. This is for
+ session cookie as path value. If
+ domains are used, this should be
+ ``None``.
+``MAX_CONTENT_LENGTH`` If set to a value in bytes, Flask will
+ reject incoming requests with a
+ content length greater than this by
+ returning a 413 status code.
+``TRAP_HTTP_EXCEPTIONS`` If this is set to ``True`` Flask will
+ not execute the error handlers of HTTP
+ exceptions but instead treat the
+ exception like any other and bubble it
+ through the exception stack. This is
+ helpful for hairy debugging situations
+ where you have to find out where an HTTP
+ exception is coming from.
+``TRAP_BAD_REQUEST_ERRORS`` Werkzeug's internal data structures that
+ deal with request specific data will
+ raise special key errors that are also
+ bad request exceptions. Likewise many
+ operations can implicitly fail with a
+ BadRequest exception for consistency.
+ Since it's nice for debugging to know
+ why exactly it failed this flag can be
+ used to debug those situations. If this
+ config is set to ``True`` you will get
+ a regular traceback instead.
+================================= =========================================
+
+.. admonition:: More on ``SERVER_NAME``
+
+ The ``SERVER_NAME`` key is used for the subdomain support. Because
+ Flask cannot guess the subdomain part without the knowledge of the
+ actual server name, this is required if you want to work with
+ subdomains. This is also used for the session cookie.
+
+ Please keep in mind that not only Flask has the problem of not knowing
+ what subdomains are, your web browser does as well. Most modern web
+ browsers will not allow cross-subdomain cookies to be set on a
+ server name without dots in it. So if your server name is
+ ``'localhost'`` you will not be able to set a cookie for
+ ``'localhost'`` and every subdomain of it. Please chose a different
+ server name in that case, like ``'myapplication.local'`` and add
+ this name + the subdomains you want to use into your host config
+ or setup a local `bind`_.
+
+.. _bind: https://www.isc.org/software/bind
+
+.. versionadded:: 0.4
+ ``LOGGER_NAME``
+
+.. versionadded:: 0.5
+ ``SERVER_NAME``
+
+.. versionadded:: 0.6
+ ``MAX_CONTENT_LENGTH``
+
+.. versionadded:: 0.7
+ ``PROPAGATE_EXCEPTIONS``, ``PRESERVE_CONTEXT_ON_EXCEPTION``
+
+.. versionadded:: 0.8
+ ``TRAP_BAD_REQUEST_ERRORS``, ``TRAP_HTTP_EXCEPTIONS``,
+ ``APPLICATION_ROOT``, ``SESSION_COOKIE_DOMAIN``,
+ ``SESSION_COOKIE_PATH``, ``SESSION_COOKIE_HTTPONLY``,
+ ``SESSION_COOKIE_SECURE``
+
+Configuring from Files
+----------------------
+
+Configuration becomes more useful if you can store it in a separate file,
+ideally located outside the actual application package. This makes
+packaging and distributing your application possible via various package
+handling tools (:ref:`distribute-deployment`) and finally modifying the
+configuration file afterwards.
+
+So a common pattern is this::
+
+ app = Flask(__name__)
+ app.config.from_object('yourapplication.default_settings')
+ app.config.from_envvar('YOURAPPLICATION_SETTINGS')
+
+This first loads the configuration from the
+`yourapplication.default_settings` module and then overrides the values
+with the contents of the file the :envvar:`YOURAPPLICATION_SETTINGS`
+environment variable points to. This environment variable can be set on
+Linux or OS X with the export command in the shell before starting the
+server::
+
+ $ export YOURAPPLICATION_SETTINGS=/path/to/settings.cfg
+ $ python run-app.py
+ * Running on http://127.0.0.1:5000/
+ * Restarting with reloader...
+
+On Windows systems use the `set` builtin instead::
+
+ >set YOURAPPLICATION_SETTINGS=\path\to\settings.cfg
+
+The configuration files themselves are actual Python files. Only values
+in uppercase are actually stored in the config object later on. So make
+sure to use uppercase letters for your config keys.
+
+Here is an example of a configuration file::
+
+ # Example configuration
+ DEBUG = False
+ SECRET_KEY = '?\xbf,\xb4\x8d\xa3"<\x9c\xb0@\x0f5\xab,w\xee\x8d$0\x13\x8b83'
+
+Make sure to load the configuration very early on, so that extensions have
+the ability to access the configuration when starting up. There are other
+methods on the config object as well to load from individual files. For a
+complete reference, read the :class:`~flask.Config` object's
+documentation.
+
+
+Configuration Best Practices
+----------------------------
+
+The downside with the approach mentioned earlier is that it makes testing
+a little harder. There is no single 100% solution for this problem in
+general, but there are a couple of things you can keep in mind to improve
+that experience:
+
+1. create your application in a function and register blueprints on it.
+ That way you can create multiple instances of your application with
+ different configurations attached which makes unittesting a lot
+ easier. You can use this to pass in configuration as needed.
+
+2. Do not write code that needs the configuration at import time. If you
+ limit yourself to request-only accesses to the configuration you can
+ reconfigure the object later on as needed.
+
+
+Development / Production
+------------------------
+
+Most applications need more than one configuration. There should be at
+least separate configurations for the production server and the one used
+during development. The easiest way to handle this is to use a default
+configuration that is always loaded and part of the version control, and a
+separate configuration that overrides the values as necessary as mentioned
+in the example above::
+
+ app = Flask(__name__)
+ app.config.from_object('yourapplication.default_settings')
+ app.config.from_envvar('YOURAPPLICATION_SETTINGS')
+
+Then you just have to add a separate `config.py` file and export
+``YOURAPPLICATION_SETTINGS=/path/to/config.py`` and you are done. However
+there are alternative ways as well. For example you could use imports or
+subclassing.
+
+What is very popular in the Django world is to make the import explicit in
+the config file by adding an ``from yourapplication.default_settings
+import *`` to the top of the file and then overriding the changes by hand.
+You could also inspect an environment variable like
+``YOURAPPLICATION_MODE`` and set that to `production`, `development` etc
+and import different hardcoded files based on that.
+
+An interesting pattern is also to use classes and inheritance for
+configuration::
+
+ class Config(object):
+ DEBUG = False
+ TESTING = False
+ DATABASE_URI = 'sqlite://:memory:'
+
+ class ProductionConfig(Config):
+ DATABASE_URI = 'mysql://user@localhost/foo'
+
+ class DevelopmentConfig(Config):
+ DEBUG = True
+
+ class TestingConfig(Config):
+ TESTING = True
+
+To enable such a config you just have to call into
+:meth:`~flask.Config.from_object`::
+
+ app.config.from_object('configmodule.ProductionConfig')
+
+There are many different ways and it's up to you how you want to manage
+your configuration files. However here a list of good recommendations:
+
+- keep a default configuration in version control. Either populate the
+ config with this default configuration or import it in your own
+ configuration files before overriding values.
+- use an environment variable to switch between the configurations.
+ This can be done from outside the Python interpreter and makes
+ development and deployment much easier because you can quickly and
+ easily switch between different configs without having to touch the
+ code at all. If you are working often on different projects you can
+ even create your own script for sourcing that activates a virtualenv
+ and exports the development configuration for you.
+- Use a tool like `fabric`_ in production to push code and
+ configurations separately to the production server(s). For some
+ details about how to do that, head over to the
+ :ref:`fabric-deployment` pattern.
+
+.. _fabric: http://fabfile.org/
+
+
+.. _instance-folders:
+
+Instance Folders
+----------------
+
+.. versionadded:: 0.8
+
+Flask 0.8 introduces instance folders. Flask for a long time made it
+possible to refer to paths relative to the application's folder directly
+(via :attr:`Flask.root_path`). This was also how many developers loaded
+configurations stored next to the application. Unfortunately however this
+only works well if applications are not packages in which case the root
+path refers to the contents of the package.
+
+With Flask 0.8 a new attribute was introduced:
+:attr:`Flask.instance_path`. It refers to a new concept called the
+“instance folder”. The instance folder is designed to not be under
+version control and be deployment specific. It's the perfect place to
+drop things that either change at runtime or configuration files.
+
+You can either explicitly provide the path of the instance folder when
+creating the Flask application or you can let Flask autodetect the
+instance folder. For explicit configuration use the `instance_path`
+parameter::
+
+ app = Flask(__name__, instance_path='/path/to/instance/folder')
+
+Please keep in mind that this path *must* be absolute when provided.
+
+If the `instance_path` parameter is not provided the following default
+locations are used:
+
+- Uninstalled module::
+
+ /myapp.py
+ /instance
+
+- Uninstalled package::
+
+ /myapp
+ /__init__.py
+ /instance
+
+- Installed module or package::
+
+ $PREFIX/lib/python2.X/site-packages/myapp
+ $PREFIX/var/myapp-instance
+
+ ``$PREFIX`` is the prefix of your Python installation. This can be
+ ``/usr`` or the path to your virtualenv. You can print the value of
+ ``sys.prefix`` to see what the prefix is set to.
+
+Since the config object provided loading of configuration files from
+relative filenames we made it possible to change the loading via filenames
+to be relative to the instance path if wanted. The behavior of relative
+paths in config files can be flipped between “relative to the application
+root” (the default) to “relative to instance folder” via the
+`instance_relative_config` switch to the application constructor::
+
+ app = Flask(__name__, instance_relative_config=True)
+
+Here is a full example of how to configure Flask to preload the config
+from a module and then override the config from a file in the config
+folder if it exists::
+
+ app = Flask(__name__, instance_relative_config=True)
+ app.config.from_object('yourapplication.default_settings')
+ app.config.from_pyfile('application.cfg', silent=True)
+
+The path to the instance folder can be found via the
+:attr:`Flask.instance_path`. Flask also provides a shortcut to open a
+file from the instance folder with :meth:`Flask.open_instance_resource`.
+
+Example usage for both::
+
+ filename = os.path.join(app.instance_root, 'application.cfg')
+ with open(filename) as f:
+ config = f.read()
+
+ # or via open_instance_resource:
+ with app.open_instance_resource('application.cfg') as f:
+ config = f.read()
diff --git a/app/static/doc/flask-docs/_sources/deploying/cgi.txt b/app/static/doc/flask-docs/_sources/deploying/cgi.txt
new file mode 100644
index 0000000..a2fba90
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/deploying/cgi.txt
@@ -0,0 +1,46 @@
+CGI
+===
+
+If all other deployment methods do not work, CGI will work for sure.
+CGI is supported by all major servers but usually has a sub-optimal
+performance.
+
+This is also the way you can use a Flask application on Google's `App
+Engine`_, where execution happens in a CGI-like environment.
+
+.. admonition:: Watch Out
+
+ Please make sure in advance that any ``app.run()`` calls you might
+ have in your application file are inside an ``if __name__ ==
+ '__main__':`` block or moved to a separate file. Just make sure it's
+ not called because this will always start a local WSGI server which
+ we do not want if we deploy that application to CGI / app engine.
+
+Creating a `.cgi` file
+----------------------
+
+First you need to create the CGI application file. Let's call it
+`yourapplication.cgi`::
+
+ #!/usr/bin/python
+ from wsgiref.handlers import CGIHandler
+ from yourapplication import app
+
+ CGIHandler().run(app)
+
+Server Setup
+------------
+
+Usually there are two ways to configure the server. Either just copy the
+`.cgi` into a `cgi-bin` (and use `mod_rewrite` or something similar to
+rewrite the URL) or let the server point to the file directly.
+
+In Apache for example you can put a like like this into the config:
+
+.. sourcecode:: apache
+
+ ScriptAlias /app /path/to/the/application.cgi
+
+For more information consult the documentation of your webserver.
+
+.. _App Engine: http://code.google.com/appengine/
diff --git a/app/static/doc/flask-docs/_sources/deploying/fastcgi.txt b/app/static/doc/flask-docs/_sources/deploying/fastcgi.txt
new file mode 100644
index 0000000..6dace1a
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/deploying/fastcgi.txt
@@ -0,0 +1,164 @@
+.. _deploying-fastcgi:
+
+FastCGI
+=======
+
+FastCGI is a deployment option on servers like `nginx`_, `lighttpd`_,
+and `cherokee`_; see :ref:`deploying-uwsgi` and
+:ref:`deploying-other-servers` for other options. To use your WSGI
+application with any of them you will need a FastCGI server first. The
+most popular one is `flup`_ which we will use for this guide. Make sure
+to have it installed to follow along.
+
+.. admonition:: Watch Out
+
+ Please make sure in advance that any ``app.run()`` calls you might
+ have in your application file are inside an ``if __name__ ==
+ '__main__':`` block or moved to a separate file. Just make sure it's
+ not called because this will always start a local WSGI server which
+ we do not want if we deploy that application to FastCGI.
+
+Creating a `.fcgi` file
+-----------------------
+
+First you need to create the FastCGI server file. Let's call it
+`yourapplication.fcgi`::
+
+ #!/usr/bin/python
+ from flup.server.fcgi import WSGIServer
+ from yourapplication import app
+
+ if __name__ == '__main__':
+ WSGIServer(app).run()
+
+This is enough for Apache to work, however nginx and older versions of
+lighttpd need a socket to be explicitly passed to communicate with the
+FastCGI server. For that to work you need to pass the path to the
+socket to the :class:`~flup.server.fcgi.WSGIServer`::
+
+ WSGIServer(application, bindAddress='/path/to/fcgi.sock').run()
+
+The path has to be the exact same path you define in the server
+config.
+
+Save the `yourapplication.fcgi` file somewhere you will find it again.
+It makes sense to have that in `/var/www/yourapplication` or something
+similar.
+
+Make sure to set the executable bit on that file so that the servers
+can execute it:
+
+.. sourcecode:: text
+
+ # chmod +x /var/www/yourapplication/yourapplication.fcgi
+
+Configuring lighttpd
+--------------------
+
+A basic FastCGI configuration for lighttpd looks like that::
+
+ fastcgi.server = ("/yourapplication.fcgi" =>
+ ((
+ "socket" => "/tmp/yourapplication-fcgi.sock",
+ "bin-path" => "/var/www/yourapplication/yourapplication.fcgi",
+ "check-local" => "disable",
+ "max-procs" => 1
+ ))
+ )
+
+ alias.url = (
+ "/static/" => "/path/to/your/static"
+ )
+
+ url.rewrite-once = (
+ "^(/static.*)$" => "$1",
+ "^(/.*)$" => "/yourapplication.fcgi$1"
+
+Remember to enable the FastCGI, alias and rewrite modules. This
+configuration binds the application to `/yourapplication`. If you want
+the application to work in the URL root you have to work around a
+lighttpd bug with the
+:class:`~werkzeug.contrib.fixers.LighttpdCGIRootFix` middleware.
+
+Make sure to apply it only if you are mounting the application the URL
+root. Also, see the Lighty docs for more information on `FastCGI and
+Python <http://redmine.lighttpd.net/wiki/lighttpd/Docs:ModFastCGI>`_
+(note that explicitly passing a socket to run() is no longer necessary).
+
+
+Configuring nginx
+-----------------
+
+Installing FastCGI applications on nginx is a bit different because by
+default no FastCGI parameters are forwarded.
+
+A basic flask FastCGI configuration for nginx looks like this::
+
+ location = /yourapplication { rewrite ^ /yourapplication/ last; }
+ location /yourapplication { try_files $uri @yourapplication; }
+ location @yourapplication {
+ include fastcgi_params;
+ fastcgi_split_path_info ^(/yourapplication)(.*)$;
+ fastcgi_param PATH_INFO $fastcgi_path_info;
+ fastcgi_param SCRIPT_NAME $fastcgi_script_name;
+ fastcgi_pass unix:/tmp/yourapplication-fcgi.sock;
+ }
+
+This configuration binds the application to `/yourapplication`. If you
+want to have it in the URL root it's a bit simpler because you don't
+have to figure out how to calculate `PATH_INFO` and `SCRIPT_NAME`::
+
+ location / { try_files $uri @yourapplication; }
+ location @yourapplication {
+ include fastcgi_params;
+ fastcgi_param PATH_INFO $fastcgi_script_name;
+ fastcgi_param SCRIPT_NAME "";
+ fastcgi_pass unix:/tmp/yourapplication-fcgi.sock;
+ }
+
+Running FastCGI Processes
+-------------------------
+
+Since Nginx and others do not load FastCGI apps, you have to do it by
+yourself. `Supervisor can manage FastCGI processes.
+<http://supervisord.org/configuration.html#fcgi-program-x-section-settings>`_
+You can look around for other FastCGI process managers or write a script
+to run your `.fcgi` file at boot, e.g. using a SysV ``init.d`` script.
+For a temporary solution, you can always run the ``.fcgi`` script inside
+GNU screen. See ``man screen`` for details, and note that this is a
+manual solution which does not persist across system restart::
+
+ $ screen
+ $ /var/www/yourapplication/yourapplication.fcgi
+
+Debugging
+---------
+
+FastCGI deployments tend to be hard to debug on most webservers. Very
+often the only thing the server log tells you is something along the
+lines of "premature end of headers". In order to debug the application
+the only thing that can really give you ideas why it breaks is switching
+to the correct user and executing the application by hand.
+
+This example assumes your application is called `application.fcgi` and
+that your webserver user is `www-data`::
+
+ $ su www-data
+ $ cd /var/www/yourapplication
+ $ python application.fcgi
+ Traceback (most recent call last):
+ File "yourapplication.fcgi", line 4, in <module>
+ ImportError: No module named yourapplication
+
+In this case the error seems to be "yourapplication" not being on the
+python path. Common problems are:
+
+- Relative paths being used. Don't rely on the current working directory
+- The code depending on environment variables that are not set by the
+ web server.
+- Different python interpreters being used.
+
+.. _nginx: http://nginx.org/
+.. _lighttpd: http://www.lighttpd.net/
+.. _cherokee: http://www.cherokee-project.com/
+.. _flup: http://trac.saddi.com/flup
diff --git a/app/static/doc/flask-docs/_sources/deploying/index.txt b/app/static/doc/flask-docs/_sources/deploying/index.txt
new file mode 100644
index 0000000..d258df8
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/deploying/index.txt
@@ -0,0 +1,23 @@
+.. _deployment:
+
+Deployment Options
+==================
+
+Depending on what you have available there are multiple ways to run
+Flask applications. You can use the builtin server during development,
+but you should use a full deployment option for production applications.
+(Do not use the builtin development server in production.) Several
+options are available and documented here.
+
+If you have a different WSGI server look up the server documentation
+about how to use a WSGI app with it. Just remember that your
+:class:`Flask` application object is the actual WSGI application.
+
+.. toctree::
+ :maxdepth: 2
+
+ mod_wsgi
+ cgi
+ fastcgi
+ uwsgi
+ others
diff --git a/app/static/doc/flask-docs/_sources/deploying/mod_wsgi.txt b/app/static/doc/flask-docs/_sources/deploying/mod_wsgi.txt
new file mode 100644
index 0000000..c85ed64
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/deploying/mod_wsgi.txt
@@ -0,0 +1,167 @@
+.. _mod_wsgi-deployment:
+
+mod_wsgi (Apache)
+=================
+
+If you are using the `Apache`_ webserver, consider using `mod_wsgi`_.
+
+.. admonition:: Watch Out
+
+ Please make sure in advance that any ``app.run()`` calls you might
+ have in your application file are inside an ``if __name__ ==
+ '__main__':`` block or moved to a separate file. Just make sure it's
+ not called because this will always start a local WSGI server which
+ we do not want if we deploy that application to mod_wsgi.
+
+.. _Apache: http://httpd.apache.org/
+
+Installing `mod_wsgi`
+---------------------
+
+If you don't have `mod_wsgi` installed yet you have to either install it
+using a package manager or compile it yourself. The mod_wsgi
+`installation instructions`_ cover source installations on UNIX systems.
+
+If you are using Ubuntu/Debian you can apt-get it and activate it as
+follows:
+
+.. sourcecode:: text
+
+ # apt-get install libapache2-mod-wsgi
+
+On FreeBSD install `mod_wsgi` by compiling the `www/mod_wsgi` port or by
+using pkg_add:
+
+.. sourcecode:: text
+
+ # pkg_add -r mod_wsgi
+
+If you are using pkgsrc you can install `mod_wsgi` by compiling the
+`www/ap2-wsgi` package.
+
+If you encounter segfaulting child processes after the first apache
+reload you can safely ignore them. Just restart the server.
+
+Creating a `.wsgi` file
+-----------------------
+
+To run your application you need a `yourapplication.wsgi` file. This file
+contains the code `mod_wsgi` is executing on startup to get the application
+object. The object called `application` in that file is then used as
+application.
+
+For most applications the following file should be sufficient::
+
+ from yourapplication import app as application
+
+If you don't have a factory function for application creation but a singleton
+instance you can directly import that one as `application`.
+
+Store that file somewhere that you will find it again (e.g.:
+`/var/www/yourapplication`) and make sure that `yourapplication` and all
+the libraries that are in use are on the python load path. If you don't
+want to install it system wide consider using a `virtual python`_
+instance.
+
+Configuring Apache
+------------------
+
+The last thing you have to do is to create an Apache configuration file
+for your application. In this example we are telling `mod_wsgi` to
+execute the application under a different user for security reasons:
+
+.. sourcecode:: apache
+
+ <VirtualHost *>
+ ServerName example.com
+
+ WSGIDaemonProcess yourapplication user=user1 group=group1 threads=5
+ WSGIScriptAlias / /var/www/yourapplication/yourapplication.wsgi
+
+ <Directory /var/www/yourapplication>
+ WSGIProcessGroup yourapplication
+ WSGIApplicationGroup %{GLOBAL}
+ Order deny,allow
+ Allow from all
+ </Directory>
+ </VirtualHost>
+
+For more information consult the `mod_wsgi wiki`_.
+
+.. _mod_wsgi: http://code.google.com/p/modwsgi/
+.. _installation instructions: http://code.google.com/p/modwsgi/wiki/QuickInstallationGuide
+.. _virtual python: http://pypi.python.org/pypi/virtualenv
+.. _mod_wsgi wiki: http://code.google.com/p/modwsgi/wiki/
+
+Troubleshooting
+---------------
+
+If your application does not run, follow this guide to troubleshoot:
+
+**Problem:** application does not run, errorlog shows SystemExit ignored
+ You have a ``app.run()`` call in your application file that is not
+ guarded by an ``if __name__ == '__main__':`` condition. Either
+ remove that :meth:`~flask.Flask.run` call from the file and move it
+ into a separate `run.py` file or put it into such an if block.
+
+**Problem:** application gives permission errors
+ Probably caused by your application running as the wrong user. Make
+ sure the folders the application needs access to have the proper
+ privileges set and the application runs as the correct user
+ (``user`` and ``group`` parameter to the `WSGIDaemonProcess`
+ directive)
+
+**Problem:** application dies with an error on print
+ Keep in mind that mod_wsgi disallows doing anything with
+ :data:`sys.stdout` and :data:`sys.stderr`. You can disable this
+ protection from the config by setting the `WSGIRestrictStdout` to
+ ``off``:
+
+ .. sourcecode:: apache
+
+ WSGIRestrictStdout Off
+
+ Alternatively you can also replace the standard out in the .wsgi file
+ with a different stream::
+
+ import sys
+ sys.stdout = sys.stderr
+
+**Problem:** accessing resources gives IO errors
+ Your application probably is a single .py file you symlinked into
+ the site-packages folder. Please be aware that this does not work,
+ instead you either have to put the folder into the pythonpath the
+ file is stored in, or convert your application into a package.
+
+ The reason for this is that for non-installed packages, the module
+ filename is used to locate the resources and for symlinks the wrong
+ filename is picked up.
+
+Support for Automatic Reloading
+-------------------------------
+
+To help deployment tools you can activate support for automatic
+reloading. Whenever something changes the `.wsgi` file, `mod_wsgi` will
+reload all the daemon processes for us.
+
+For that, just add the following directive to your `Directory` section:
+
+.. sourcecode:: apache
+
+ WSGIScriptReloading On
+
+Working with Virtual Environments
+---------------------------------
+
+Virtual environments have the advantage that they never install the
+required dependencies system wide so you have a better control over what
+is used where. If you want to use a virtual environment with mod_wsgi
+you have to modify your `.wsgi` file slightly.
+
+Add the following lines to the top of your `.wsgi` file::
+
+ activate_this = '/path/to/env/bin/activate_this.py'
+ execfile(activate_this, dict(__file__=activate_this))
+
+This sets up the load paths according to the settings of the virtual
+environment. Keep in mind that the path has to be absolute.
diff --git a/app/static/doc/flask-docs/_sources/deploying/others.txt b/app/static/doc/flask-docs/_sources/deploying/others.txt
new file mode 100644
index 0000000..6f3e5cc
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/deploying/others.txt
@@ -0,0 +1,102 @@
+.. _deploying-other-servers:
+
+Other Servers
+=============
+
+There are popular servers written in Python that allow the execution of WSGI
+applications as well. These servers stand alone when they run; you can proxy
+to them from your web server.
+
+Tornado
+--------
+
+`Tornado`_ is an open source version of the scalable, non-blocking web
+server and tools that power `FriendFeed`_. Because it is non-blocking and
+uses epoll, it can handle thousands of simultaneous standing connections,
+which means it is ideal for real-time web services. Integrating this
+service with Flask is a trivial task::
+
+ from tornado.wsgi import WSGIContainer
+ from tornado.httpserver import HTTPServer
+ from tornado.ioloop import IOLoop
+ from yourapplication import app
+
+ http_server = HTTPServer(WSGIContainer(app))
+ http_server.listen(5000)
+ IOLoop.instance().start()
+
+
+.. _Tornado: http://www.tornadoweb.org/
+.. _FriendFeed: http://friendfeed.com/
+
+Gevent
+-------
+
+`Gevent`_ is a coroutine-based Python networking library that uses
+`greenlet`_ to provide a high-level synchronous API on top of `libevent`_
+event loop::
+
+ from gevent.wsgi import WSGIServer
+ from yourapplication import app
+
+ http_server = WSGIServer(('', 5000), app)
+ http_server.serve_forever()
+
+.. _Gevent: http://www.gevent.org/
+.. _greenlet: http://codespeak.net/py/0.9.2/greenlet.html
+.. _libevent: http://monkey.org/~provos/libevent/
+
+Gunicorn
+--------
+
+`Gunicorn`_ 'Green Unicorn' is a WSGI HTTP Server for UNIX. It's a pre-fork
+worker model ported from Ruby's Unicorn project. It supports both `eventlet`_
+and `greenlet`_. Running a Flask application on this server is quite simple::
+
+ gunicorn myproject:app
+
+`Gunicorn`_ provides many command-line options -- see ``gunicorn -h``.
+For example, to run a Flask application with 4 worker processes (``-w
+4``) binding to localhost port 4000 (``-b 127.0.0.1:4000``)::
+
+ gunicorn -w 4 -b 127.0.0.1:4000 myproject:app
+
+.. _Gunicorn: http://gunicorn.org/
+.. _eventlet: http://eventlet.net/
+.. _greenlet: http://codespeak.net/py/0.9.2/greenlet.html
+
+Proxy Setups
+------------
+
+If you deploy your application using one of these servers behind an HTTP
+proxy you will need to rewrite a few headers in order for the
+application to work. The two problematic values in the WSGI environment
+usually are `REMOTE_ADDR` and `HTTP_HOST`. Werkzeug ships a fixer that
+will solve some common setups, but you might want to write your own WSGI
+middleware for specific setups.
+
+The most common setup invokes the host being set from `X-Forwarded-Host`
+and the remote address from `X-Forwarded-For`::
+
+ from werkzeug.contrib.fixers import ProxyFix
+ app.wsgi_app = ProxyFix(app.wsgi_app)
+
+Please keep in mind that it is a security issue to use such a middleware
+in a non-proxy setup because it will blindly trust the incoming
+headers which might be forged by malicious clients.
+
+If you want to rewrite the headers from another header, you might want to
+use a fixer like this::
+
+ class CustomProxyFix(object):
+
+ def __init__(self, app):
+ self.app = app
+
+ def __call__(self, environ, start_response):
+ host = environ.get('HTTP_X_FHOST', '')
+ if host:
+ environ['HTTP_HOST'] = host
+ return self.app(environ, start_response)
+
+ app.wsgi_app = CustomProxyFix(app.wsgi_app)
diff --git a/app/static/doc/flask-docs/_sources/deploying/uwsgi.txt b/app/static/doc/flask-docs/_sources/deploying/uwsgi.txt
new file mode 100644
index 0000000..bdee15b
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/deploying/uwsgi.txt
@@ -0,0 +1,68 @@
+.. _deploying-uwsgi:
+
+uWSGI
+=====
+
+uWSGI is a deployment option on servers like `nginx`_, `lighttpd`_, and
+`cherokee`_; see :ref:`deploying-fastcgi` and
+:ref:`deploying-other-servers` for other options. To use your WSGI
+application with uWSGI protocol you will need a uWSGI server
+first. uWSGI is both a protocol and an application server; the
+application server can serve uWSGI, FastCGI, and HTTP protocols.
+
+The most popular uWSGI server is `uwsgi`_, which we will use for this
+guide. Make sure to have it installed to follow along.
+
+.. admonition:: Watch Out
+
+ Please make sure in advance that any ``app.run()`` calls you might
+ have in your application file are inside an ``if __name__ ==
+ '__main__':`` block or moved to a separate file. Just make sure it's
+ not called because this will always start a local WSGI server which
+ we do not want if we deploy that application to uWSGI.
+
+Starting your app with uwsgi
+----------------------------
+
+`uwsgi` is designed to operate on WSGI callables found in python modules.
+
+Given a flask application in myapp.py, use the following command:
+
+.. sourcecode:: text
+
+ $ uwsgi -s /tmp/uwsgi.sock --module myapp --callable app
+
+Or, if you prefer:
+
+.. sourcecode:: text
+
+ $ uwsgi -s /tmp/uwsgi.sock -w myapp:app
+
+Configuring nginx
+-----------------
+
+A basic flask uWSGI configuration for nginx looks like this::
+
+ location = /yourapplication { rewrite ^ /yourapplication/; }
+ location /yourapplication { try_files $uri @yourapplication; }
+ location @yourapplication {
+ include uwsgi_params;
+ uwsgi_param SCRIPT_NAME /yourapplication;
+ uwsgi_modifier1 30;
+ uwsgi_pass unix:/tmp/uwsgi.sock;
+ }
+
+This configuration binds the application to `/yourapplication`. If you want
+to have it in the URL root it's a bit simpler because you don't have to tell
+it the WSGI `SCRIPT_NAME` or set the uwsgi modifier to make use of it::
+
+ location / { try_files $uri @yourapplication; }
+ location @yourapplication {
+ include uwsgi_params;
+ uwsgi_pass unix:/tmp/uwsgi.sock;
+ }
+
+.. _nginx: http://nginx.org/
+.. _lighttpd: http://www.lighttpd.net/
+.. _cherokee: http://www.cherokee-project.com/
+.. _uwsgi: http://projects.unbit.it/uwsgi/
diff --git a/app/static/doc/flask-docs/_sources/design.txt b/app/static/doc/flask-docs/_sources/design.txt
new file mode 100644
index 0000000..6ca363a
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/design.txt
@@ -0,0 +1,191 @@
+.. _design:
+
+Design Decisions in Flask
+=========================
+
+If you are curious why Flask does certain things the way it does and not
+differently, this section is for you. This should give you an idea about
+some of the design decisions that may appear arbitrary and surprising at
+first, especially in direct comparison with other frameworks.
+
+
+The Explicit Application Object
+-------------------------------
+
+A Python web application based on WSGI has to have one central callable
+object that implements the actual application. In Flask this is an
+instance of the :class:`~flask.Flask` class. Each Flask application has
+to create an instance of this class itself and pass it the name of the
+module, but why can't Flask do that itself?
+
+Without such an explicit application object the following code::
+
+ from flask import Flask
+ app = Flask(__name__)
+
+ @app.route('/')
+ def index():
+ return 'Hello World!'
+
+Would look like this instead::
+
+ from hypothetical_flask import route
+
+ @route('/')
+ def index():
+ return 'Hello World!'
+
+There are three major reasons for this. The most important one is that
+implicit application objects require that there may only be one instance at
+the time. There are ways to fake multiple applications with a single
+application object, like maintaining a stack of applications, but this
+causes some problems I won't outline here in detail. Now the question is:
+when does a microframework need more than one application at the same
+time? A good example for this is unittesting. When you want to test
+something it can be very helpful to create a minimal application to test
+specific behavior. When the application object is deleted everything it
+allocated will be freed again.
+
+Another thing that becomes possible when you have an explicit object lying
+around in your code is that you can subclass the base class
+(:class:`~flask.Flask`) to alter specific behaviour. This would not be
+possible without hacks if the object were created ahead of time for you
+based on a class that is not exposed to you.
+
+But there is another very important reason why Flask depends on an
+explicit instantiation of that class: the package name. Whenever you
+create a Flask instance you usually pass it `__name__` as package name.
+Flask depends on that information to properly load resources relative
+to your module. With Python's outstanding support for reflection it can
+then access the package to figure out where the templates and static files
+are stored (see :meth:`~flask.Flask.open_resource`). Now obviously there
+are frameworks around that do not need any configuration and will still be
+able to load templates relative to your application module. But they have
+to use the current working directory for that, which is a very unreliable
+way to determine where the application is. The current working directory
+is process-wide and if you are running multiple applications in one
+process (which could happen in a webserver without you knowing) the paths
+will be off. Worse: many webservers do not set the working directory to
+the directory of your application but to the document root which does not
+have to be the same folder.
+
+The third reason is "explicit is better than implicit". That object is
+your WSGI application, you don't have to remember anything else. If you
+want to apply a WSGI middleware, just wrap it and you're done (though
+there are better ways to do that so that you do not lose the reference
+to the application object :meth:`~flask.Flask.wsgi_app`).
+
+Furthermore this design makes it possible to use a factory function to
+create the application which is very helpful for unittesting and similar
+things (:ref:`app-factories`).
+
+The Routing System
+------------------
+
+Flask uses the Werkzeug routing system which has was designed to
+automatically order routes by complexity. This means that you can declare
+routes in arbitrary order and they will still work as expected. This is a
+requirement if you want to properly implement decorator based routing
+since decorators could be fired in undefined order when the application is
+split into multiple modules.
+
+Another design decision with the Werkzeug routing system is that routes
+in Werkzeug try to ensure that there is that URLs are unique. Werkzeug
+will go quite far with that in that it will automatically redirect to a
+canonical URL if a route is ambiguous.
+
+
+One Template Engine
+-------------------
+
+Flask decides on one template engine: Jinja2. Why doesn't Flask have a
+pluggable template engine interface? You can obviously use a different
+template engine, but Flask will still configure Jinja2 for you. While
+that limitation that Jinja2 is *always* configured will probably go away,
+the decision to bundle one template engine and use that will not.
+
+Template engines are like programming languages and each of those engines
+has a certain understanding about how things work. On the surface they
+all work the same: you tell the engine to evaluate a template with a set
+of variables and take the return value as string.
+
+But that's about where similarities end. Jinja2 for example has an
+extensive filter system, a certain way to do template inheritance, support
+for reusable blocks (macros) that can be used from inside templates and
+also from Python code, uses Unicode for all operations, supports
+iterative template rendering, configurable syntax and more. On the other
+hand an engine like Genshi is based on XML stream evaluation, template
+inheritance by taking the availability of XPath into account and more.
+Mako on the other hand treats templates similar to Python modules.
+
+When it comes to connecting a template engine with an application or
+framework there is more than just rendering templates. For instance,
+Flask uses Jinja2's extensive autoescaping support. Also it provides
+ways to access macros from Jinja2 templates.
+
+A template abstraction layer that would not take the unique features of
+the template engines away is a science on its own and a too large
+undertaking for a microframework like Flask.
+
+Furthermore extensions can then easily depend on one template language
+being present. You can easily use your own templating language, but an
+extension could still depend on Jinja itself.
+
+
+Micro with Dependencies
+-----------------------
+
+Why does Flask call itself a microframework and yet it depends on two
+libraries (namely Werkzeug and Jinja2). Why shouldn't it? If we look
+over to the Ruby side of web development there we have a protocol very
+similar to WSGI. Just that it's called Rack there, but besides that it
+looks very much like a WSGI rendition for Ruby. But nearly all
+applications in Ruby land do not work with Rack directly, but on top of a
+library with the same name. This Rack library has two equivalents in
+Python: WebOb (formerly Paste) and Werkzeug. Paste is still around but
+from my understanding it's sort of deprecated in favour of WebOb. The
+development of WebOb and Werkzeug started side by side with similar ideas
+in mind: be a good implementation of WSGI for other applications to take
+advantage.
+
+Flask is a framework that takes advantage of the work already done by
+Werkzeug to properly interface WSGI (which can be a complex task at
+times). Thanks to recent developments in the Python package
+infrastructure, packages with dependencies are no longer an issue and
+there are very few reasons against having libraries that depend on others.
+
+
+Thread Locals
+-------------
+
+Flask uses thread local objects (context local objects in fact, they
+support greenlet contexts as well) for request, session and an extra
+object you can put your own things on (:data:`~flask.g`). Why is that and
+isn't that a bad idea?
+
+Yes it is usually not such a bright idea to use thread locals. They cause
+troubles for servers that are not based on the concept of threads and make
+large applications harder to maintain. However Flask is just not designed
+for large applications or asynchronous servers. Flask wants to make it
+quick and easy to write a traditional web application.
+
+Also see the :ref:`becomingbig` section of the documentation for some
+inspiration for larger applications based on Flask.
+
+
+What Flask is, What Flask is Not
+--------------------------------
+
+Flask will never have a database layer. It will not have a form library
+or anything else in that direction. Flask itself just bridges to Werkzeug
+to implement a proper WSGI application and to Jinja2 to handle templating.
+It also binds to a few common standard library packages such as logging.
+Everything else is up for extensions.
+
+Why is this the case? Because people have different preferences and
+requirements and Flask could not meet those if it would force any of this
+into the core. The majority of web applications will need a template
+engine in some sort. However not every application needs a SQL database.
+
+The idea of Flask is to build a good foundation for all applications.
+Everything else is up to you or extensions.
diff --git a/app/static/doc/flask-docs/_sources/errorhandling.txt b/app/static/doc/flask-docs/_sources/errorhandling.txt
new file mode 100644
index 0000000..debb9d7
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/errorhandling.txt
@@ -0,0 +1,237 @@
+.. _application-errors:
+
+Handling Application Errors
+===========================
+
+.. versionadded:: 0.3
+
+Applications fail, servers fail. Sooner or later you will see an exception
+in production. Even if your code is 100% correct, you will still see
+exceptions from time to time. Why? Because everything else involved will
+fail. Here some situations where perfectly fine code can lead to server
+errors:
+
+- the client terminated the request early and the application was still
+ reading from the incoming data.
+- the database server was overloaded and could not handle the query.
+- a filesystem is full
+- a harddrive crashed
+- a backend server overloaded
+- a programming error in a library you are using
+- network connection of the server to another system failed.
+
+And that's just a small sample of issues you could be facing. So how do we
+deal with that sort of problem? By default if your application runs in
+production mode, Flask will display a very simple page for you and log the
+exception to the :attr:`~flask.Flask.logger`.
+
+But there is more you can do, and we will cover some better setups to deal
+with errors.
+
+Error Mails
+-----------
+
+If the application runs in production mode (which it will do on your
+server) you won't see any log messages by default. Why is that? Flask
+tries to be a zero-configuration framework. Where should it drop the logs
+for you if there is no configuration? Guessing is not a good idea because
+chances are, the place it guessed is not the place where the user has
+permission to create a logfile. Also, for most small applications nobody
+will look at the logs anyways.
+
+In fact, I promise you right now that if you configure a logfile for the
+application errors you will never look at it except for debugging an issue
+when a user reported it for you. What you want instead is a mail the
+second the exception happened. Then you get an alert and you can do
+something about it.
+
+Flask uses the Python builtin logging system, and it can actually send
+you mails for errors which is probably what you want. Here is how you can
+configure the Flask logger to send you mails for exceptions::
+
+ ADMINS = ['yourname@example.com']
+ if not app.debug:
+ import logging
+ from logging.handlers import SMTPHandler
+ mail_handler = SMTPHandler('127.0.0.1',
+ 'server-error@example.com',
+ ADMINS, 'YourApplication Failed')
+ mail_handler.setLevel(logging.ERROR)
+ app.logger.addHandler(mail_handler)
+
+So what just happened? We created a new
+:class:`~logging.handlers.SMTPHandler` that will send mails with the mail
+server listening on ``127.0.0.1`` to all the `ADMINS` from the address
+*server-error@example.com* with the subject "YourApplication Failed". If
+your mail server requires credentials, these can also be provided. For
+that check out the documentation for the
+:class:`~logging.handlers.SMTPHandler`.
+
+We also tell the handler to only send errors and more critical messages.
+Because we certainly don't want to get a mail for warnings or other
+useless logs that might happen during request handling.
+
+Before you run that in production, please also look at :ref:`logformat` to
+put more information into that error mail. That will save you from a lot
+of frustration.
+
+
+Logging to a File
+-----------------
+
+Even if you get mails, you probably also want to log warnings. It's a
+good idea to keep as much information around that might be required to
+debug a problem. Please note that Flask itself will not issue any
+warnings in the core system, so it's your responsibility to warn in the
+code if something seems odd.
+
+There are a couple of handlers provided by the logging system out of the
+box but not all of them are useful for basic error logging. The most
+interesting are probably the following:
+
+- :class:`~logging.FileHandler` - logs messages to a file on the
+ filesystem.
+- :class:`~logging.handlers.RotatingFileHandler` - logs messages to a file
+ on the filesystem and will rotate after a certain number of messages.
+- :class:`~logging.handlers.NTEventLogHandler` - will log to the system
+ event log of a Windows system. If you are deploying on a Windows box,
+ this is what you want to use.
+- :class:`~logging.handlers.SysLogHandler` - sends logs to a UNIX
+ syslog.
+
+Once you picked your log handler, do like you did with the SMTP handler
+above, just make sure to use a lower setting (I would recommend
+`WARNING`)::
+
+ if not app.debug:
+ import logging
+ from themodule import TheHandlerYouWant
+ file_handler = TheHandlerYouWant(...)
+ file_handler.setLevel(logging.WARNING)
+ app.logger.addHandler(file_handler)
+
+.. _logformat:
+
+Controlling the Log Format
+--------------------------
+
+By default a handler will only write the message string into a file or
+send you that message as mail. A log record stores more information,
+and it makes a lot of sense to configure your logger to also contain that
+information so that you have a better idea of why that error happened, and
+more importantly, where it did.
+
+A formatter can be instantiated with a format string. Note that
+tracebacks are appended to the log entry automatically. You don't have to
+do that in the log formatter format string.
+
+Here some example setups:
+
+Email
+`````
+
+::
+
+ from logging import Formatter
+ mail_handler.setFormatter(Formatter('''
+ Message type: %(levelname)s
+ Location: %(pathname)s:%(lineno)d
+ Module: %(module)s
+ Function: %(funcName)s
+ Time: %(asctime)s
+
+ Message:
+
+ %(message)s
+ '''))
+
+File logging
+````````````
+
+::
+
+ from logging import Formatter
+ file_handler.setFormatter(Formatter(
+ '%(asctime)s %(levelname)s: %(message)s '
+ '[in %(pathname)s:%(lineno)d]'
+ ))
+
+
+Complex Log Formatting
+``````````````````````
+
+Here is a list of useful formatting variables for the format string. Note
+that this list is not complete, consult the official documentation of the
+:mod:`logging` package for a full list.
+
+.. tabularcolumns:: |p{3cm}|p{12cm}|
+
++------------------+----------------------------------------------------+
+| Format | Description |
++==================+====================================================+
+| ``%(levelname)s``| Text logging level for the message |
+| | (``'DEBUG'``, ``'INFO'``, ``'WARNING'``, |
+| | ``'ERROR'``, ``'CRITICAL'``). |
++------------------+----------------------------------------------------+
+| ``%(pathname)s`` | Full pathname of the source file where the |
+| | logging call was issued (if available). |
++------------------+----------------------------------------------------+
+| ``%(filename)s`` | Filename portion of pathname. |
++------------------+----------------------------------------------------+
+| ``%(module)s`` | Module (name portion of filename). |
++------------------+----------------------------------------------------+
+| ``%(funcName)s`` | Name of function containing the logging call. |
++------------------+----------------------------------------------------+
+| ``%(lineno)d`` | Source line number where the logging call was |
+| | issued (if available). |
++------------------+----------------------------------------------------+
+| ``%(asctime)s`` | Human-readable time when the LogRecord` was |
+| | created. By default this is of the form |
+| | ``"2003-07-08 16:49:45,896"`` (the numbers after |
+| | the comma are millisecond portion of the time). |
+| | This can be changed by subclassing the formatter |
+| | and overriding the |
+| | :meth:`~logging.Formatter.formatTime` method. |
++------------------+----------------------------------------------------+
+| ``%(message)s`` | The logged message, computed as ``msg % args`` |
++------------------+----------------------------------------------------+
+
+If you want to further customize the formatting, you can subclass the
+formatter. The formatter has three interesting methods:
+
+:meth:`~logging.Formatter.format`:
+ handles the actual formatting. It is passed a
+ :class:`~logging.LogRecord` object and has to return the formatted
+ string.
+:meth:`~logging.Formatter.formatTime`:
+ called for `asctime` formatting. If you want a different time format
+ you can override this method.
+:meth:`~logging.Formatter.formatException`
+ called for exception formatting. It is passed an :attr:`~sys.exc_info`
+ tuple and has to return a string. The default is usually fine, you
+ don't have to override it.
+
+For more information, head over to the official documentation.
+
+
+Other Libraries
+---------------
+
+So far we only configured the logger your application created itself.
+Other libraries might log themselves as well. For example, SQLAlchemy uses
+logging heavily in its core. While there is a method to configure all
+loggers at once in the :mod:`logging` package, I would not recommend using
+it. There might be a situation in which you want to have multiple
+separate applications running side by side in the same Python interpreter
+and then it becomes impossible to have different logging setups for those.
+
+Instead, I would recommend figuring out which loggers you are interested
+in, getting the loggers with the :func:`~logging.getLogger` function and
+iterating over them to attach handlers::
+
+ from logging import getLogger
+ loggers = [app.logger, getLogger('sqlalchemy'),
+ getLogger('otherlibrary')]
+ for logger in loggers:
+ logger.addHandler(mail_handler)
+ logger.addHandler(file_handler)
diff --git a/app/static/doc/flask-docs/_sources/extensiondev.txt b/app/static/doc/flask-docs/_sources/extensiondev.txt
new file mode 100644
index 0000000..ee0d5e6
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/extensiondev.txt
@@ -0,0 +1,387 @@
+Flask Extension Development
+===========================
+
+Flask, being a microframework, often requires some repetitive steps to get
+a third party library working. Because very often these steps could be
+abstracted to support multiple projects the `Flask Extension Registry`_
+was created.
+
+If you want to create your own Flask extension for something that does not
+exist yet, this guide to extension development will help you get your
+extension running in no time and to feel like users would expect your
+extension to behave.
+
+.. _Flask Extension Registry: http://flask.pocoo.org/extensions/
+
+Anatomy of an Extension
+-----------------------
+
+Extensions are all located in a package called ``flask_something``
+where "something" is the name of the library you want to bridge. So for
+example if you plan to add support for a library named `simplexml` to
+Flask, you would name your extension's package ``flask_simplexml``.
+
+The name of the actual extension (the human readable name) however would
+be something like "Flask-SimpleXML". Make sure to include the name
+"Flask" somewhere in that name and that you check the capitalization.
+This is how users can then register dependencies to your extension in
+their `setup.py` files.
+
+Flask sets up a redirect package called :data:`flask.ext` where users
+should import the extensions from. If you for instance have a package
+called ``flask_something`` users would import it as
+``flask.ext.something``. This is done to transition from the old
+namespace packages. See :ref:`ext-import-transition` for more details.
+
+But how do extensions look like themselves? An extension has to ensure
+that it works with multiple Flask application instances at once. This is
+a requirement because many people will use patterns like the
+:ref:`app-factories` pattern to create their application as needed to aid
+unittests and to support multiple configurations. Because of that it is
+crucial that your application supports that kind of behaviour.
+
+Most importantly the extension must be shipped with a `setup.py` file and
+registered on PyPI. Also the development checkout link should work so
+that people can easily install the development version into their
+virtualenv without having to download the library by hand.
+
+Flask extensions must be licensed as BSD or MIT or a more liberal license
+to be enlisted on the Flask Extension Registry. Keep in mind that the
+Flask Extension Registry is a moderated place and libraries will be
+reviewed upfront if they behave as required.
+
+"Hello Flaskext!"
+-----------------
+
+So let's get started with creating such a Flask extension. The extension
+we want to create here will provide very basic support for SQLite3.
+
+First we create the following folder structure::
+
+ flask-sqlite3/
+ flask_sqlite3.py
+ LICENSE
+ README
+
+Here's the contents of the most important files:
+
+setup.py
+````````
+
+The next file that is absolutely required is the `setup.py` file which is
+used to install your Flask extension. The following contents are
+something you can work with::
+
+ """
+ Flask-SQLite3
+ -------------
+
+ This is the description for that library
+ """
+ from setuptools import setup
+
+
+ setup(
+ name='Flask-SQLite3',
+ version='1.0',
+ url='http://example.com/flask-sqlite3/',
+ license='BSD',
+ author='Your Name',
+ author_email='your-email@example.com',
+ description='Very short description',
+ long_description=__doc__,
+ py_modules=['flask_sqlite3'],
+ # if you would be using a package instead use packages instead
+ # of py_modules:
+ # packages=['flask_sqlite3'],
+ zip_safe=False,
+ include_package_data=True,
+ platforms='any',
+ install_requires=[
+ 'Flask'
+ ],
+ classifiers=[
+ 'Environment :: Web Environment',
+ 'Intended Audience :: Developers',
+ 'License :: OSI Approved :: BSD License',
+ 'Operating System :: OS Independent',
+ 'Programming Language :: Python',
+ 'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
+ 'Topic :: Software Development :: Libraries :: Python Modules'
+ ]
+ )
+
+That's a lot of code but you can really just copy/paste that from existing
+extensions and adapt.
+
+flask_sqlite3.py
+````````````````
+
+Now this is where your extension code goes. But how exactly should such
+an extension look like? What are the best practices? Continue reading
+for some insight.
+
+Initializing Extensions
+-----------------------
+
+Many extensions will need some kind of initialization step. For example,
+consider your application is currently connecting to SQLite like the
+documentation suggests (:ref:`sqlite3`) you will need to provide a few
+functions and before / after request handlers. So how does the extension
+know the name of the application object?
+
+Quite simple: you pass it to it.
+
+There are two recommended ways for an extension to initialize:
+
+initialization functions:
+ If your extension is called `helloworld` you might have a function
+ called ``init_helloworld(app[, extra_args])`` that initializes the
+ extension for that application. It could attach before / after
+ handlers etc.
+
+classes:
+ Classes work mostly like initialization functions but can later be
+ used to further change the behaviour. For an example look at how the
+ `OAuth extension`_ works: there is an `OAuth` object that provides
+ some helper functions like `OAuth.remote_app` to create a reference to
+ a remote application that uses OAuth.
+
+What to use depends on what you have in mind. For the SQLite 3 extension
+we will use the class based approach because it will provide users with a
+manager object that handles opening and closing database connections.
+
+The Extension Code
+------------------
+
+Here's the contents of the `flask_sqlite3.py` for copy/paste::
+
+ from __future__ import absolute_import
+ import sqlite3
+
+ from flask import _request_ctx_stack
+
+ class SQLite3(object):
+
+ def __init__(self, app):
+ self.app = app
+ self.app.config.setdefault('SQLITE3_DATABASE', ':memory:')
+ self.app.teardown_request(self.teardown_request)
+ self.app.before_request(self.before_request)
+
+ def connect(self):
+ return sqlite3.connect(self.app.config['SQLITE3_DATABASE'])
+
+ def before_request(self):
+ ctx = _request_ctx_stack.top
+ ctx.sqlite3_db = self.connect()
+
+ def teardown_request(self, exception):
+ ctx = _request_ctx_stack.top
+ ctx.sqlite3_db.close()
+
+ def get_db(self):
+ ctx = _request_ctx_stack.top
+ if ctx is not None:
+ return ctx.sqlite3_db
+
+So here's what these lines of code do:
+
+1. The ``__future__`` import is necessary to activate absolute imports.
+ Otherwise we could not call our module `sqlite3.py` and import the
+ top-level `sqlite3` module which actually implements the connection to
+ SQLite.
+2. We create a class for our extension that requires a supplied `app` object,
+ sets a configuration for the database if it's not there
+ (:meth:`dict.setdefault`), and attaches `before_request` and
+ `teardown_request` handlers.
+3. Next, we define a `connect` function that opens a database connection.
+4. Then we set up the request handlers we bound to the app above. Note here
+ that we're attaching our database connection to the top request context via
+ `_request_ctx_stack.top`. Extensions should use the top context and not the
+ `g` object to store things like database connections.
+5. Finally, we add a `get_db` function that simplifies access to the context's
+ database.
+
+So why did we decide on a class based approach here? Because using our
+extension looks something like this::
+
+ from flask import Flask
+ from flask_sqlite3 import SQLite3
+
+ app = Flask(__name__)
+ app.config.from_pyfile('the-config.cfg')
+ manager = SQLite3(app)
+ db = manager.get_db()
+
+You can then use the database from views like this::
+
+ @app.route('/')
+ def show_all():
+ cur = db.cursor()
+ cur.execute(...)
+
+Opening a database connection from outside a view function is simple.
+
+>>> from yourapplication import db
+>>> cur = db.cursor()
+>>> cur.execute(...)
+
+Adding an `init_app` Function
+-----------------------------
+
+In practice, you'll almost always want to permit users to initialize your
+extension and provide an app object after the fact. This can help avoid
+circular import problems when a user is breaking their app into multiple files.
+Our extension could add an `init_app` function as follows::
+
+ class SQLite3(object):
+
+ def __init__(self, app=None):
+ if app is not None:
+ self.app = app
+ self.init_app(self.app)
+ else:
+ self.app = None
+
+ def init_app(self, app):
+ self.app = app
+ self.app.config.setdefault('SQLITE3_DATABASE', ':memory:')
+ self.app.teardown_request(self.teardown_request)
+ self.app.before_request(self.before_request)
+
+ def connect(self):
+ return sqlite3.connect(app.config['SQLITE3_DATABASE'])
+
+ def before_request(self):
+ ctx = _request_ctx_stack.top
+ ctx.sqlite3_db = self.connect()
+
+ def teardown_request(self, exception):
+ ctx = _request_ctx_stack.top
+ ctx.sqlite3_db.close()
+
+ def get_db(self):
+ ctx = _request_ctx_stack.top
+ if ctx is not None:
+ return ctx.sqlite3_db
+
+The user could then initialize the extension in one file::
+
+ manager = SQLite3()
+
+and bind their app to the extension in another file::
+
+ manager.init_app(app)
+
+End-Of-Request Behavior
+-----------------------
+
+Due to the change in Flask 0.7 regarding functions that are run at the end
+of the request your extension will have to be extra careful there if it
+wants to continue to support older versions of Flask. The following
+pattern is a good way to support both::
+
+ def close_connection(response):
+ ctx = _request_ctx_stack.top
+ ctx.sqlite3_db.close()
+ return response
+
+ if hasattr(app, 'teardown_request'):
+ app.teardown_request(close_connection)
+ else:
+ app.after_request(close_connection)
+
+Strictly speaking the above code is wrong, because teardown functions are
+passed the exception and typically don't return anything. However because
+the return value is discarded this will just work assuming that the code
+in between does not touch the passed parameter.
+
+Learn from Others
+-----------------
+
+This documentation only touches the bare minimum for extension
+development. If you want to learn more, it's a very good idea to check
+out existing extensions on the `Flask Extension Registry`_. If you feel
+lost there is still the `mailinglist`_ and the `IRC channel`_ to get some
+ideas for nice looking APIs. Especially if you do something nobody before
+you did, it might be a very good idea to get some more input. This not
+only to get an idea about what people might want to have from an
+extension, but also to avoid having multiple developers working on pretty
+much the same side by side.
+
+Remember: good API design is hard, so introduce your project on the
+mailinglist, and let other developers give you a helping hand with
+designing the API.
+
+The best Flask extensions are extensions that share common idioms for the
+API. And this can only work if collaboration happens early.
+
+Approved Extensions
+-------------------
+
+Flask also has the concept of approved extensions. Approved extensions
+are tested as part of Flask itself to ensure extensions do not break on
+new releases. These approved extensions are listed on the `Flask
+Extension Registry`_ and marked appropriately. If you want your own
+extension to be approved you have to follow these guidelines:
+
+1. An approved Flask extension must provide exactly one package or module
+ named ``flask_extensionname``. They might also reside inside a
+ ``flaskext`` namespace packages though this is discouraged now.
+2. It must ship a testing suite that can either be invoked with ``make test``
+ or ``python setup.py test``. For test suites invoked with ``make
+ test`` the extension has to ensure that all dependencies for the test
+ are installed automatically, in case of ``python setup.py test``
+ dependencies for tests alone can be specified in the `setup.py`
+ file. The test suite also has to be part of the distribution.
+3. APIs of approved extensions will be checked for the following
+ characteristics:
+
+ - an approved extension has to support multiple applications
+ running in the same Python process.
+ - it must be possible to use the factory pattern for creating
+ applications.
+
+4. The license must be BSD/MIT/WTFPL licensed.
+5. The naming scheme for official extensions is *Flask-ExtensionName* or
+ *ExtensionName-Flask*.
+6. Approved extensions must define all their dependencies in the
+ `setup.py` file unless a dependency cannot be met because it is not
+ available on PyPI.
+7. The extension must have documentation that uses one of the two Flask
+ themes for Sphinx documentation.
+8. The setup.py description (and thus the PyPI description) has to
+ link to the documentation, website (if there is one) and there
+ must be a link to automatically install the development version
+ (``PackageName==dev``).
+9. The ``zip_safe`` flag in the setup script must be set to ``False``,
+ even if the extension would be safe for zipping.
+10. An extension currently has to support Python 2.5, 2.6 as well as
+ Python 2.7
+
+
+.. _ext-import-transition:
+
+Extension Import Transition
+---------------------------
+
+For a while we recommended using namespace packages for Flask extensions.
+This turned out to be problematic in practice because many different
+competing namespace package systems exist and pip would automatically
+switch between different systems and this caused a lot of problems for
+users.
+
+Instead we now recommend naming packages ``flask_foo`` instead of the now
+deprecated ``flaskext.foo``. Flask 0.8 introduces a redirect import
+system that lets uses import from ``flask.ext.foo`` and it will try
+``flask_foo`` first and if that fails ``flaskext.foo``.
+
+Flask extensions should urge users to import from ``flask.ext.foo``
+instead of ``flask_foo`` or ``flaskext_foo`` so that extensions can
+transition to the new package name without affecting users.
+
+
+.. _OAuth extension: http://packages.python.org/Flask-OAuth/
+.. _mailinglist: http://flask.pocoo.org/mailinglist/
+.. _IRC channel: http://flask.pocoo.org/community/irc/
diff --git a/app/static/doc/flask-docs/_sources/extensions.txt b/app/static/doc/flask-docs/_sources/extensions.txt
new file mode 100644
index 0000000..53dca56
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/extensions.txt
@@ -0,0 +1,48 @@
+Flask Extensions
+================
+
+Flask extensions extend the functionality of Flask in various different
+ways. For instance they add support for databases and other common tasks.
+
+Finding Extensions
+------------------
+
+Flask extensions are listed on the `Flask Extension Registry`_ and can be
+downloaded with ``easy_install`` or ``pip``. If you add a Flask extension
+as dependency to your ``requirements.rst`` or ``setup.py`` file they are
+usually installed with a simple command or when your application installs.
+
+Using Extensions
+----------------
+
+Extensions typically have documentation that goes along that shows how to
+use it. There are no general rules in how extensions are supposed to
+behave but they are imported from common locations. If you have an
+extension called ``Flask-Foo`` or ``Foo-Flask`` it will be always
+importable from ``flask.ext.foo``::
+
+ from flask.ext import foo
+
+Flask Before 0.8
+----------------
+
+If you are using Flask 0.7 or earlier the :data:`flask.ext` package will not
+exist, instead you have to import from ``flaskext.foo`` or ``flask_foo``
+depending on how the extension is distributed. If you want to develop an
+application that supports Flask 0.7 or earlier you should still import
+from the :data:`flask.ext` package. We provide you with a compatibility
+module that provides this package for older versions of Flask. You can
+download it from github: `flaskext_compat.py`_
+
+And here is how you can use it::
+
+ import flaskext_compat
+ flaskext_compat.activate()
+
+ from flask.ext import foo
+
+Once the ``flaskext_compat`` module is activated the :data:`flask.ext` will
+exist and you can start importing from there.
+
+.. _Flask Extension Registry: http://flask.pocoo.org/extensions/
+.. _flaskext_compat.py: https://github.com/mitsuhiko/flask/raw/master/scripts/flaskext_compat.py
diff --git a/app/static/doc/flask-docs/_sources/foreword.txt b/app/static/doc/flask-docs/_sources/foreword.txt
new file mode 100644
index 0000000..10b886b
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/foreword.txt
@@ -0,0 +1,100 @@
+Foreword
+========
+
+Read this before you get started with Flask. This hopefully answers some
+questions about the purpose and goals of the project, and when you
+should or should not be using it.
+
+What does "micro" mean?
+-----------------------
+
+To me, the "micro" in microframework refers not only to the simplicity and
+small size of the framework, but also the fact that it does not make much
+decisions for you. While Flask does pick a templating engine for you, we
+won't make such decisions for your datastore or other parts.
+
+For us however the term “micro” does not mean that the whole implementation
+has to fit into a single Python file.
+
+One of the design decisions with Flask was that simple tasks should be
+simple and not take up a lot of code and yet not limit yourself. Because
+of that we took a few design choices that some people might find
+surprising or unorthodox. For example, Flask uses thread-local objects
+internally so that you don't have to pass objects around from function to
+function within a request in order to stay threadsafe. While this is a
+really easy approach and saves you a lot of time, it might also cause some
+troubles for very large applications because changes on these thread-local
+objects can happen anywhere in the same thread. In order to solve these
+problems we don't hide the thread locals for you but instead embrace them
+and provide you with a lot of tools to make it as pleasant as possible to
+work with them.
+
+Flask is also based on convention over configuration, which means that
+many things are preconfigured. For example, by convention, templates and
+static files are in subdirectories within the Python source tree of the
+application. While this can be changed you usually don't have to.
+
+The main reason however why Flask is called a "microframework" is the idea
+to keep the core simple but extensible. There is no database abstraction
+layer, no form validation or anything else where different libraries
+already exist that can handle that. However Flask knows the concept of
+extensions that can add this functionality into your application as if it
+was implemented in Flask itself. There are currently extensions for
+object relational mappers, form validation, upload handling, various open
+authentication technologies and more.
+
+Since Flask is based on a very solid foundation there is not a lot of code
+in Flask itself. As such it's easy to adapt even for lage applications
+and we are making sure that you can either configure it as much as
+possible by subclassing things or by forking the entire codebase. If you
+are interested in that, check out the :ref:`becomingbig` chapter.
+
+If you are curious about the Flask design principles, head over to the
+section about :ref:`design`.
+
+Web Development is Dangerous
+----------------------------
+
+I'm not joking. Well, maybe a little. If you write a web
+application, you are probably allowing users to register and leave their
+data on your server. The users are entrusting you with data. And even if
+you are the only user that might leave data in your application, you still
+want that data to be stored securely.
+
+Unfortunately, there are many ways the security of a web application can be
+compromised. Flask protects you against one of the most common security
+problems of modern web applications: cross-site scripting (XSS). Unless
+you deliberately mark insecure HTML as secure, Flask and the underlying
+Jinja2 template engine have you covered. But there are many more ways to
+cause security problems.
+
+The documentation will warn you about aspects of web development that
+require attention to security. Some of these security concerns
+are far more complex than one might think, and we all sometimes underestimate
+the likelihood that a vulnerability will be exploited, until a clever
+attacker figures out a way to exploit our applications. And don't think
+that your application is not important enough to attract an attacker.
+Depending on the kind of attack, chances are that automated bots are
+probing for ways to fill your database with spam, links to malicious
+software, and the like.
+
+So always keep security in mind when doing web development.
+
+The Status of Python 3
+----------------------
+
+Currently the Python community is in the process of improving libraries to
+support the new iteration of the Python programming language. While the
+situation is greatly improving there are still some issues that make it
+hard for us to switch over to Python 3 just now. These problems are
+partially caused by changes in the language that went unreviewed for too
+long, partially also because we have not quite worked out how the lower
+level API should change for the unicode differences in Python3.
+
+Werkzeug and Flask will be ported to Python 3 as soon as a solution for
+the changes is found, and we will provide helpful tips how to upgrade
+existing applications to Python 3. Until then, we strongly recommend
+using Python 2.6 and 2.7 with activated Python 3 warnings during
+development. If you plan on upgrading to Python 3 in the near future we
+strongly recommend that you read `How to write forwards compatible
+Python code <http://lucumr.pocoo.org/2011/1/22/forwards-compatible-python/>`_.
diff --git a/app/static/doc/flask-docs/_sources/htmlfaq.txt b/app/static/doc/flask-docs/_sources/htmlfaq.txt
new file mode 100644
index 0000000..1da25f3
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/htmlfaq.txt
@@ -0,0 +1,207 @@
+HTML/XHTML FAQ
+==============
+
+The Flask documentation and example applications are using HTML5. You
+may notice that in many situations, when end tags are optional they are
+not used, so that the HTML is cleaner and faster to load. Because there
+is much confusion about HTML and XHTML among developers, this document tries
+to answer some of the major questions.
+
+
+History of XHTML
+----------------
+
+For a while, it appeared that HTML was about to be replaced by XHTML.
+However, barely any websites on the Internet are actual XHTML (which is
+HTML processed using XML rules). There are a couple of major reasons
+why this is the case. One of them is Internet Explorer's lack of proper
+XHTML support. The XHTML spec states that XHTML must be served with the MIME
+type `application/xhtml+xml`, but Internet Explorer refuses to read files
+with that MIME type.
+While it is relatively easy to configure Web servers to serve XHTML properly,
+few people do. This is likely because properly using XHTML can be quite
+painful.
+
+One of the most important causes of pain is XML's draconian (strict and
+ruthless) error handling. When an XML parsing error is encountered,
+the browser is supposed to show the user an ugly error message, instead
+of attempting to recover from the error and display what it can. Most of
+the (X)HTML generation on the web is based on non-XML template engines
+(such as Jinja, the one used in Flask) which do not protect you from
+accidentally creating invalid XHTML. There are XML based template engines,
+such as Kid and the popular Genshi, but they often come with a larger
+runtime overhead and, are not as straightforward to use because they have
+to obey XML rules.
+
+The majority of users, however, assumed they were properly using XHTML.
+They wrote an XHTML doctype at the top of the document and self-closed all
+the necessary tags (``<br>`` becomes ``<br/>`` or ``<br></br>`` in XHTML).
+However, even if the document properly validates as XHTML, what really
+determines XHTML/HTML processing in browsers is the MIME type, which as
+said before is often not set properly. So the valid XHTML was being treated
+as invalid HTML.
+
+XHTML also changed the way JavaScript is used. To properly work with XHTML,
+programmers have to use the namespaced DOM interface with the XHTML
+namespace to query for HTML elements.
+
+History of HTML5
+----------------
+
+Development of the HTML5 specification was started in 2004 under the name
+"Web Applications 1.0" by the Web Hypertext Application Technology Working
+Group, or WHATWG (which was formed by the major browser vendors Apple,
+Mozilla, and Opera) with the goal of writing a new and improved HTML
+specification, based on existing browser behaviour instead of unrealistic
+and backwards-incompatible specifications.
+
+For example, in HTML4 ``<title/Hello/`` theoretically parses exactly the
+same as ``<title>Hello</title>``. However, since people were using
+XHTML-like tags along the lines of ``<link />``, browser vendors implemented
+the XHTML syntax over the syntax defined by the specification.
+
+In 2007, the specification was adopted as the basis of a new HTML
+specification under the umbrella of the W3C, known as HTML5. Currently,
+it appears that XHTML is losing traction, as the XHTML 2 working group has
+been disbanded and HTML5 is being implemented by all major browser vendors.
+
+HTML versus XHTML
+-----------------
+
+The following table gives you a quick overview of features available in
+HTML 4.01, XHTML 1.1 and HTML5. (XHTML 1.0 is not included, as it was
+superseded by XHTML 1.1 and the barely-used XHTML5.)
+
+.. tabularcolumns:: |p{9cm}|p{2cm}|p{2cm}|p{2cm}|
+
++-----------------------------------------+----------+----------+----------+
+| | HTML4.01 | XHTML1.1 | HTML5 |
++=========================================+==========+==========+==========+
+| ``<tag/value/`` == ``<tag>value</tag>`` | |Y| [1]_ | |N| | |N| |
++-----------------------------------------+----------+----------+----------+
+| ``<br/>`` supported | |N| | |Y| | |Y| [2]_ |
++-----------------------------------------+----------+----------+----------+
+| ``<script/>`` supported | |N| | |Y| | |N| |
++-----------------------------------------+----------+----------+----------+
+| should be served as `text/html` | |Y| | |N| [3]_ | |Y| |
++-----------------------------------------+----------+----------+----------+
+| should be served as | |N| | |Y| | |N| |
+| `application/xhtml+xml` | | | |
++-----------------------------------------+----------+----------+----------+
+| strict error handling | |N| | |Y| | |N| |
++-----------------------------------------+----------+----------+----------+
+| inline SVG | |N| | |Y| | |Y| |
++-----------------------------------------+----------+----------+----------+
+| inline MathML | |N| | |Y| | |Y| |
++-----------------------------------------+----------+----------+----------+
+| ``<video>`` tag | |N| | |N| | |Y| |
++-----------------------------------------+----------+----------+----------+
+| ``<audio>`` tag | |N| | |N| | |Y| |
++-----------------------------------------+----------+----------+----------+
+| New semantic tags like ``<article>`` | |N| | |N| | |Y| |
++-----------------------------------------+----------+----------+----------+
+
+.. [1] This is an obscure feature inherited from SGML. It is usually not
+ supported by browsers, for reasons detailed above.
+.. [2] This is for compatibility with server code that generates XHTML for
+ tags such as ``<br>``. It should not be used in new code.
+.. [3] XHTML 1.0 is the last XHTML standard that allows to be served
+ as `text/html` for backwards compatibility reasons.
+
+.. |Y| image:: _static/yes.png
+ :alt: Yes
+.. |N| image:: _static/no.png
+ :alt: No
+
+What does "strict" mean?
+------------------------
+
+HTML5 has strictly defined parsing rules, but it also specifies exactly
+how a browser should react to parsing errors - unlike XHTML, which simply
+states parsing should abort. Some people are confused by apparently
+invalid syntax that still generates the expected results (for example,
+missing end tags or unquoted attribute values).
+
+Some of these work because of the lenient error handling most browsers use
+when they encounter a markup error, others are actually specified. The
+following constructs are optional in HTML5 by standard, but have to be
+supported by browsers:
+
+- Wrapping the document in an ``<html>`` tag
+- Wrapping header elements in ``<head>`` or the body elements in
+ ``<body>``
+- Closing the ``<p>``, ``<li>``, ``<dt>``, ``<dd>``, ``<tr>``,
+ ``<td>``, ``<th>``, ``<tbody>``, ``<thead>``, or ``<tfoot>`` tags.
+- Quoting attributes, so long as they contain no whitespace or
+ special characters (like ``<``, ``>``, ``'``, or ``"``).
+- Requiring boolean attributes to have a value.
+
+This means the following page in HTML5 is perfectly valid:
+
+.. sourcecode:: html
+
+ <!doctype html>
+ <title>Hello HTML5</title>
+ <div class=header>
+ <h1>Hello HTML5</h1>
+ <p class=tagline>HTML5 is awesome
+ </div>
+ <ul class=nav>
+ <li><a href=/index>Index</a>
+ <li><a href=/downloads>Downloads</a>
+ <li><a href=/about>About</a>
+ </ul>
+ <div class=body>
+ <h2>HTML5 is probably the future</h2>
+ <p>
+ There might be some other things around but in terms of
+ browser vendor support, HTML5 is hard to beat.
+ <dl>
+ <dt>Key 1
+ <dd>Value 1
+ <dt>Key 2
+ <dd>Value 2
+ </dl>
+ </div>
+
+
+New technologies in HTML5
+-------------------------
+
+HTML5 adds many new features that make Web applications easier to write
+and to use.
+
+- The ``<audio>`` and ``<video>`` tags provide a way to embed audio and
+ video without complicated add-ons like QuickTime or Flash.
+- Semantic elements like ``<article>``, ``<header>``, ``<nav>``, and
+ ``<time>`` that make content easier to understand.
+- The ``<canvas>`` tag, which supports a powerful drawing API, reducing
+ the need for server-generated images to present data graphically.
+- New form control types like ``<input type="date">`` that allow user
+ agents to make entering and validating values easier.
+- Advanced JavaScript APIs like Web Storage, Web Workers, Web Sockets,
+ geolocation, and offline applications.
+
+Many other features have been added, as well. A good guide to new features
+in HTML5 is Mark Pilgrim's soon-to-be-published book, `Dive Into HTML5`_.
+Not all of them are supported in browsers yet, however, so use caution.
+
+.. _Dive Into HTML5: http://www.diveintohtml5.org/
+
+What should be used?
+--------------------
+
+Currently, the answer is HTML5. There are very few reasons to use XHTML
+considering the latest developments in Web browsers. To summarize the
+reasons given above:
+
+- Internet Explorer (which, sadly, currently leads in market share)
+ has poor support for XHTML.
+- Many JavaScript libraries also do not support XHTML, due to the more
+ complicated namespacing API it requires.
+- HTML5 adds several new features, including semantic tags and the
+ long-awaited ``<audio>`` and ``<video>`` tags.
+- It has the support of most browser vendors behind it.
+- It is much easier to write, and more compact.
+
+For most applications, it is undoubtedly better to use HTML5 than XHTML.
diff --git a/app/static/doc/flask-docs/_sources/index.txt b/app/static/doc/flask-docs/_sources/index.txt
new file mode 100644
index 0000000..c4ded1f
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/index.txt
@@ -0,0 +1,30 @@
+:orphan:
+
+Welcome to Flask
+================
+
+.. image:: _static/logo-full.png
+ :alt: Flask: web development, one drop at a time
+ :class: floatingflask
+
+Welcome to Flask's documentation. This documentation is divided into
+different parts. I recommend that you get started with
+:ref:`installation` and then head over to the :ref:`quickstart`.
+Besides the quickstart there is also a more detailed :ref:`tutorial` that
+shows how to create a complete (albeit small) application with Flask. If
+you'd rather dive into the internals of Flask, check out
+the :ref:`api` documentation. Common patterns are described in the
+:ref:`patterns` section.
+
+Flask depends on two external libraries: the `Jinja2`_ template
+engine and the `Werkzeug`_ WSGI toolkit. These libraries are not documented
+here. If you want to dive into their documentation check out the
+following links:
+
+- `Jinja2 Documentation <http://jinja.pocoo.org/2/documentation/>`_
+- `Werkzeug Documentation <http://werkzeug.pocoo.org/documentation/>`_
+
+.. _Jinja2: http://jinja.pocoo.org/2/
+.. _Werkzeug: http://werkzeug.pocoo.org/
+
+.. include:: contents.rst.inc
diff --git a/app/static/doc/flask-docs/_sources/installation.txt b/app/static/doc/flask-docs/_sources/installation.txt
new file mode 100644
index 0000000..eb645bd
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/installation.txt
@@ -0,0 +1,175 @@
+.. _installation:
+
+Installation
+============
+
+Flask depends on two external libraries, `Werkzeug
+<http://werkzeug.pocoo.org/>`_ and `Jinja2 <http://jinja.pocoo.org/2/>`_.
+Werkzeug is a toolkit for WSGI, the standard Python interface between web
+applications and a variety of servers for both development and deployment.
+Jinja2 renders templates.
+
+So how do you get all that on your computer quickly? There are many ways
+which this section will explain, but the most kick-ass method is
+virtualenv, so let's look at that first.
+
+Either way, you will need Python 2.5 or higher to get started, so be sure
+to have an up to date Python 2.x installation. At the time of writing,
+the WSGI specification is not yet finalized for Python 3, so Flask cannot
+support the 3.x series of Python.
+
+.. _virtualenv:
+
+virtualenv
+----------
+
+Virtualenv is probably what you want to use during development, and in
+production too if you have shell access there.
+
+What problem does virtualenv solve? If you like Python as I do,
+chances are you want to use it for other projects besides Flask-based
+web applications. But the more projects you have, the more likely it is
+that you will be working with different versions of Python itself, or at
+least different versions of Python libraries. Let's face it; quite often
+libraries break backwards compatibility, and it's unlikely that any serious
+application will have zero dependencies. So what do you do if two or more
+of your projects have conflicting dependencies?
+
+Virtualenv to the rescue! It basically enables multiple side-by-side
+installations of Python, one for each project. It doesn't actually
+install separate copies of Python, but it does provide a clever way
+to keep different project environments isolated.
+
+So let's see how virtualenv works!
+
+If you are on Mac OS X or Linux, chances are that one of the following two
+commands will work for you::
+
+ $ sudo easy_install virtualenv
+
+or even better::
+
+ $ sudo pip install virtualenv
+
+One of these will probably install virtualenv on your system. Maybe it's
+even in your package manager. If you use Ubuntu, try::
+
+ $ sudo apt-get install python-virtualenv
+
+If you are on Windows and don't have the `easy_install` command, you must
+install it first. Check the :ref:`windows-easy-install` section for more
+information about how to do that. Once you have it installed, run the
+same commands as above, but without the `sudo` prefix.
+
+Once you have virtualenv installed, just fire up a shell and create
+your own environment. I usually create a project folder and an `env`
+folder within::
+
+ $ mkdir myproject
+ $ cd myproject
+ $ virtualenv env
+ New python executable in env/bin/python
+ Installing setuptools............done.
+
+Now, whenever you want to work on a project, you only have to activate
+the corresponding environment. On OS X and Linux, do the following::
+
+ $ . env/bin/activate
+
+(Note the space between the dot and the script name. The dot means that
+this script should run in the context of the current shell. If this command
+does not work in your shell, try replacing the dot with ``source``)
+
+If you are a Windows user, the following command is for you::
+
+ $ env\scripts\activate
+
+Either way, you should now be using your virtualenv (see how the prompt of
+your shell has changed to show the virtualenv).
+
+Now you can just enter the following command to get Flask activated in
+your virtualenv::
+
+ $ easy_install Flask
+
+A few seconds later you are good to go.
+
+
+System Wide Installation
+------------------------
+
+This is possible as well, but I do not recommend it. Just run
+`easy_install` with root rights::
+
+ $ sudo easy_install Flask
+
+(Run it in an Admin shell on Windows systems and without `sudo`).
+
+
+Living on the Edge
+------------------
+
+If you want to work with the latest version of Flask, there are two ways: you
+can either let `easy_install` pull in the development version, or tell it
+to operate on a git checkout. Either way, virtualenv is recommended.
+
+Get the git checkout in a new virtualenv and run in development mode::
+
+ $ git clone http://github.com/mitsuhiko/flask.git
+ Initialized empty Git repository in ~/dev/flask/.git/
+ $ cd flask
+ $ virtualenv env
+ $ . env/bin/activate
+ New python executable in env/bin/python
+ Installing setuptools............done.
+ $ python setup.py develop
+ ...
+ Finished processing dependencies for Flask
+
+This will pull in the dependencies and activate the git head as the current
+version inside the virtualenv. Then you just have to ``git pull origin``
+to get the latest version.
+
+To just get the development version without git, do this instead::
+
+ $ mkdir flask
+ $ cd flask
+ $ virtualenv env
+ $ . env/bin/activate
+ New python executable in env/bin/python
+ Installing setuptools............done.
+ $ easy_install Flask==dev
+ ...
+ Finished processing dependencies for Flask==dev
+
+.. _windows-easy-install:
+
+`easy_install` on Windows
+-------------------------
+
+On Windows, installation of `easy_install` is a little bit trickier because
+slightly different rules apply on Windows than on Unix-like systems, but
+it's not difficult. The easiest way to do it is to download the
+`ez_setup.py`_ file and run it. The easiest way to run the file is to
+open your downloads folder and double-click on the file.
+
+Next, add the `easy_install` command and other Python scripts to the
+command search path, by adding your Python installation's Scripts folder
+to the `PATH` environment variable. To do that, right-click on the
+"Computer" icon on the Desktop or in the Start menu, and choose
+"Properties". Then, on Windows Vista and Windows 7 click on "Advanced System
+settings"; on Windows XP, click on the "Advanced" tab instead. Then click
+on the "Environment variables" button and double click on the "Path"
+variable in the "System variables" section. There append the path of your
+Python interpreter's Scripts folder; make sure you delimit it from
+existing values with a semicolon. Assuming you are using Python 2.6 on
+the default path, add the following value::
+
+ ;C:\Python26\Scripts
+
+Then you are done. To check that it worked, open the Command Prompt and
+execute ``easy_install``. If you have User Account Control enabled on
+Windows Vista or Windows 7, it should prompt you for admin privileges.
+
+
+.. _ez_setup.py: http://peak.telecommunity.com/dist/ez_setup.py
diff --git a/app/static/doc/flask-docs/_sources/latexindex.txt b/app/static/doc/flask-docs/_sources/latexindex.txt
new file mode 100644
index 0000000..288197c
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/latexindex.txt
@@ -0,0 +1,6 @@
+:orphan:
+
+Flask Documentation
+===================
+
+.. include:: contents.rst.inc
diff --git a/app/static/doc/flask-docs/_sources/license.txt b/app/static/doc/flask-docs/_sources/license.txt
new file mode 100644
index 0000000..38777e6
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/license.txt
@@ -0,0 +1,48 @@
+License
+=======
+
+Flask is licensed under a three clause BSD License. It basically means:
+do whatever you want with it as long as the copyright in Flask sticks
+around, the conditions are not modified and the disclaimer is present.
+Furthermore you must not use the names of the authors to promote derivatives
+of the software without written consent.
+
+The full license text can be found below (:ref:`flask-license`). For the
+documentation and artwork different licenses apply.
+
+.. _authors:
+
+Authors
+-------
+
+.. include:: ../AUTHORS
+
+General License Definitions
+---------------------------
+
+The following section contains the full license texts for Flask and the
+documentation.
+
+- "AUTHORS" hereby refers to all the authors listed in the
+ :ref:`authors` section.
+
+- The ":ref:`flask-license`" applies to all the sourcecode shipped as
+ part of Flask (Flask itself as well as the examples and the unittests)
+ as well as documentation.
+
+- The ":ref:`artwork-license`" applies to the project's Horn-Logo.
+
+.. _flask-license:
+
+Flask License
+-------------
+
+.. include:: ../LICENSE
+
+
+.. _artwork-license:
+
+Flask Artwork License
+---------------------
+
+.. include:: ../artwork/LICENSE
diff --git a/app/static/doc/flask-docs/_sources/patterns/appdispatch.txt b/app/static/doc/flask-docs/_sources/patterns/appdispatch.txt
new file mode 100644
index 0000000..93b4af9
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/patterns/appdispatch.txt
@@ -0,0 +1,170 @@
+.. _app-dispatch:
+
+Application Dispatching
+=======================
+
+Application dispatching is the process of combining multiple Flask
+applications on the WSGI level. You can not only combine Flask
+applications into something larger but any WSGI application. This would
+even allow you to run a Django and a Flask application in the same
+interpreter side by side if you want. The usefulness of this depends on
+how the applications work internally.
+
+The fundamental difference from the :ref:`module approach
+<larger-applications>` is that in this case you are running the same or
+different Flask applications that are entirely isolated from each other.
+They run different configurations and are dispatched on the WSGI level.
+
+
+Working with this Document
+--------------------------
+
+Each of the techniques and examples below results in an ``application`` object
+that can be run with any WSGI server. For production, see :ref:`deployment`.
+For development, Werkzeug provides a builtin server for development available
+at :func:`werkzeug.serving.run_simple`::
+
+ from werkzeug.serving import run_simple
+ run_simple('localhost', 5000, application, use_reloader=True)
+
+Note that :func:`run_simple <werkzeug.serving.run_simple>` is not intended for
+use in production. Use a :ref:`full-blown WSGI server <deployment>`.
+
+
+Combining Applications
+----------------------
+
+If you have entirely separated applications and you want them to work next
+to each other in the same Python interpreter process you can take
+advantage of the :class:`werkzeug.wsgi.DispatcherMiddleware`. The idea
+here is that each Flask application is a valid WSGI application and they
+are combined by the dispatcher middleware into a larger one that
+dispatched based on prefix.
+
+For example you could have your main application run on `/` and your
+backend interface on `/backend`::
+
+ from werkzeug.wsgi import DispatcherMiddleware
+ from frontend_app import application as frontend
+ from backend_app import application as backend
+
+ application = DispatcherMiddleware(frontend, {
+ '/backend': backend
+ })
+
+
+Dispatch by Subdomain
+---------------------
+
+Sometimes you might want to use multiple instances of the same application
+with different configurations. Assuming the application is created inside
+a function and you can call that function to instanciate it, that is
+really easy to implement. In order to develop your application to support
+creating new instances in functions have a look at the
+:ref:`app-factories` pattern.
+
+A very common example would be creating applications per subdomain. For
+instance you configure your webserver to dispatch all requests for all
+subdomains to your application and you then use the subdomain information
+to create user-specific instances. Once you have your server set up to
+listen on all subdomains you can use a very simple WSGI application to do
+the dynamic application creation.
+
+The perfect level for abstraction in that regard is the WSGI layer. You
+write your own WSGI application that looks at the request that comes and
+and delegates it to your Flask application. If that application does not
+exist yet, it is dynamically created and remembered::
+
+ from threading import Lock
+
+ class SubdomainDispatcher(object):
+
+ def __init__(self, domain, create_app):
+ self.domain = domain
+ self.create_app = create_app
+ self.lock = Lock()
+ self.instances = {}
+
+ def get_application(self, host):
+ host = host.split(':')[0]
+ assert host.endswith(self.domain), 'Configuration error'
+ subdomain = host[:-len(self.domain)].rstrip('.')
+ with self.lock:
+ app = self.instances.get(subdomain)
+ if app is None:
+ app = self.create_app(subdomain)
+ self.instances[subdomain] = app
+ return app
+
+ def __call__(self, environ, start_response):
+ app = self.get_application(environ['HTTP_HOST'])
+ return app(environ, start_response)
+
+
+This dispatcher can then be used like this::
+
+ from myapplication import create_app, get_user_for_subdomain
+ from werkzeug.exceptions import NotFound
+
+ def make_app(subdomain):
+ user = get_user_for_subdomain(subdomain)
+ if user is None:
+ # if there is no user for that subdomain we still have
+ # to return a WSGI application that handles that request.
+ # We can then just return the NotFound() exception as
+ # application which will render a default 404 page.
+ # You might also redirect the user to the main page then
+ return NotFound()
+
+ # otherwise create the application for the specific user
+ return create_app(user)
+
+ application = SubdomainDispatcher('example.com', make_app)
+
+
+Dispatch by Path
+----------------
+
+Dispatching by a path on the URL is very similar. Instead of looking at
+the `Host` header to figure out the subdomain one simply looks at the
+request path up to the first slash::
+
+ from threading import Lock
+ from werkzeug.wsgi import pop_path_info, peek_path_info
+
+ class PathDispatcher(object):
+
+ def __init__(self, default_app, create_app):
+ self.default_app = default_app
+ self.create_app = create_app
+ self.lock = Lock()
+ self.instances = {}
+
+ def get_application(self, prefix):
+ with self.lock:
+ app = self.instances.get(prefix)
+ if app is None:
+ app = self.create_app(prefix)
+ if app is not None:
+ self.instances[prefix] = app
+ return app
+
+ def __call__(self, environ, start_response):
+ app = self.get_application(peek_path_info(environ))
+ if app is not None:
+ pop_path_info(environ)
+ else:
+ app = self.default_app
+ return app(environ, start_response)
+
+The big difference between this and the subdomain one is that this one
+falls back to another application if the creator function returns `None`::
+
+ from myapplication import create_app, default_app, get_user_for_prefix
+
+ def make_app(prefix):
+ user = get_user_for_prefix(prefix)
+ if user is not None:
+ return create_app(user)
+
+ application = PathDispatcher(default_app, make_app)
diff --git a/app/static/doc/flask-docs/_sources/patterns/appfactories.txt b/app/static/doc/flask-docs/_sources/patterns/appfactories.txt
new file mode 100644
index 0000000..2a6190e
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/patterns/appfactories.txt
@@ -0,0 +1,75 @@
+.. _app-factories:
+
+Application Factories
+=====================
+
+If you are already using packages and blueprints for your application
+(:ref:`blueprints`) there are a couple of really nice ways to further improve
+the experience. A common pattern is creating the application object when
+the blueprint is imported. But if you move the creation of this object,
+into a function, you can then create multiple instances of this and later.
+
+So why would you want to do this?
+
+1. Testing. You can have instances of the application with different
+ settings to test every case.
+2. Multiple instances. Imagine you want to run different versions of the
+ same application. Of course you could have multiple instances with
+ different configs set up in your webserver, but if you use factories,
+ you can have multiple instances of the same application running in the
+ same application process which can be handy.
+
+So how would you then actually implement that?
+
+Basic Factories
+---------------
+
+The idea is to set up the application in a function. Like this::
+
+ def create_app(config_filename):
+ app = Flask(__name__)
+ app.config.from_pyfile(config_filename)
+
+ from yourapplication.views.admin import admin
+ from yourapplication.views.frontend import frontend
+ app.register_blueprint(admin)
+ app.register_blueprint(frontend)
+
+ return app
+
+The downside is that you cannot use the application object in the blueprints
+at import time. You can however use it from within a request. How do you
+get access to the application with the config? Use
+:data:`~flask.current_app`::
+
+ from flask import current_app, Blueprint, render_template
+ admin = Blueprint('admin', __name__, url_prefix='/admin')
+
+ @admin.route('/')
+ def index():
+ return render_template(current_app.config['INDEX_TEMPLATE'])
+
+Here we look up the name of a template in the config.
+
+Using Applications
+------------------
+
+So to use such an application you then have to create the application
+first. Here an example `run.py` file that runs such an application::
+
+ from yourapplication import create_app
+ app = create_app('/path/to/config.cfg')
+ app.run()
+
+Factory Improvements
+--------------------
+
+The factory function from above is not very clever so far, you can improve
+it. The following changes are straightforward and possible:
+
+1. make it possible to pass in configuration values for unittests so that
+ you don't have to create config files on the filesystem
+2. call a function from a blueprint when the application is setting up so
+ that you have a place to modify attributes of the application (like
+ hooking in before / after request handlers etc.)
+3. Add in WSGI middlewares when the application is creating if necessary.
diff --git a/app/static/doc/flask-docs/_sources/patterns/caching.txt b/app/static/doc/flask-docs/_sources/patterns/caching.txt
new file mode 100644
index 0000000..5817aa2
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/patterns/caching.txt
@@ -0,0 +1,69 @@
+.. _caching-pattern:
+
+Caching
+=======
+
+When your application runs slow, throw some caches in. Well, at least
+it's the easiest way to speed up things. What does a cache do? Say you
+have a function that takes some time to complete but the results would
+still be good enough if they were 5 minutes old. So then the idea is that
+you actually put the result of that calculation into a cache for some
+time.
+
+Flask itself does not provide caching for you, but Werkzeug, one of the
+libraries it is based on, has some very basic cache support. It supports
+multiple cache backends, normally you want to use a memcached server.
+
+Setting up a Cache
+------------------
+
+You create a cache object once and keep it around, similar to how
+:class:`~flask.Flask` objects are created. If you are using the
+development server you can create a
+:class:`~werkzeug.contrib.cache.SimpleCache` object, that one is a simple
+cache that keeps the item stored in the memory of the Python interpreter::
+
+ from werkzeug.contrib.cache import SimpleCache
+ cache = SimpleCache()
+
+If you want to use memcached, make sure to have one of the memcache modules
+supported (you get them from `PyPI <http://pypi.python.org/>`_) and a
+memcached server running somewhere. This is how you connect to such an
+memcached server then::
+
+ from werkzeug.contrib.cache import MemcachedCache
+ cache = MemcachedCache(['127.0.0.1:11211'])
+
+If you are using App Engine, you can connect to the App Engine memcache
+server easily::
+
+ from werkzeug.contrib.cache import GAEMemcachedCache
+ cache = GAEMemcachedCache()
+
+Using a Cache
+-------------
+
+Now how can one use such a cache? There are two very important
+operations: :meth:`~werkzeug.contrib.cache.BaseCache.get` and
+:meth:`~werkzeug.contrib.cache.BaseCache.set`. This is how to use them:
+
+To get an item from the cache call
+:meth:`~werkzeug.contrib.cache.BaseCache.get` with a string as key name.
+If something is in the cache, it is returned. Otherwise that function
+will return `None`::
+
+ rv = cache.get('my-item')
+
+To add items to the cache, use the :meth:`~werkzeug.contrib.cache.BaseCache.set`
+method instead. The first argument is the key and the second the value
+that should be set. Also a timeout can be provided after which the cache
+will automatically remove item.
+
+Here a full example how this looks like normally::
+
+ def get_my_item():
+ rv = cache.get('my-item')
+ if rv is None:
+ rv = calculate_value()
+ cache.set('my-item', rv, timeout=5 * 60)
+ return rv
diff --git a/app/static/doc/flask-docs/_sources/patterns/deferredcallbacks.txt b/app/static/doc/flask-docs/_sources/patterns/deferredcallbacks.txt
new file mode 100644
index 0000000..917c512
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/patterns/deferredcallbacks.txt
@@ -0,0 +1,73 @@
+.. _deferred-callbacks:
+
+Deferred Request Callbacks
+==========================
+
+One of the design principles of Flask is that response objects are created
+and passed down a chain of potential callbacks that can modify them or
+replace them. When the request handling starts, there is no response
+object yet. It is created as necessary either by a view function or by
+some other component in the system.
+
+But what happens if you want to modify the response at a point where the
+response does not exist yet? A common example for that would be a
+before-request function that wants to set a cookie on the response object.
+
+One way is to avoid the situation. Very often that is possible. For
+instance you can try to move that logic into an after-request callback
+instead. Sometimes however moving that code there is just not a very
+pleasant experience or makes code look very awkward.
+
+As an alternative possibility you can attach a bunch of callback functions
+to the :data:`~flask.g` object and call then at the end of the request.
+This way you can defer code execution from anywhere in the application.
+
+
+The Decorator
+-------------
+
+The following decorator is the key. It registers a function on a list on
+the :data:`~flask.g` object::
+
+ from flask import g
+
+ def after_this_request(f):
+ if not hasattr(g, 'after_request_callbacks'):
+ g.after_request_callbacks = []
+ g.after_request_callbacks.append(f)
+ return f
+
+
+Calling the Deferred
+--------------------
+
+Now you can use the `after_this_request` decorator to mark a function to
+be called at the end of the request. But we still need to call them. For
+this the following function needs to be registered as
+:meth:`~flask.Flask.after_request` callback::
+
+ @app.after_request
+ def call_after_request_callbacks(response):
+ for callback in getattr(g, 'after_request_callbacks', ()):
+ response = callback(response)
+ return response
+
+
+A Practical Example
+-------------------
+
+Now we can easily at any point in time register a function to be called at
+the end of this particular request. For example you can remember the
+current language of the user in a cookie in the before-request function::
+
+ from flask import request
+
+ @app.before_request
+ def detect_user_language():
+ language = request.cookies.get('user_lang')
+ if language is None:
+ language = guess_language_from_request()
+ @after_this_request
+ def remember_language(response):
+ response.set_cookie('user_lang', language)
+ g.language = language
diff --git a/app/static/doc/flask-docs/_sources/patterns/distribute.txt b/app/static/doc/flask-docs/_sources/patterns/distribute.txt
new file mode 100644
index 0000000..b6f6a5e
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/patterns/distribute.txt
@@ -0,0 +1,166 @@
+.. _distribute-deployment:
+
+Deploying with Distribute
+=========================
+
+`distribute`_, formerly setuptools, is an extension library that is
+commonly used to (like the name says) distribute Python libraries and
+extensions. It extends distutils, a basic module installation system
+shipped with Python to also support various more complex constructs that
+make larger applications easier to distribute:
+
+- **support for dependencies**: a library or application can declare a
+ list of other libraries it depends on which will be installed
+ automatically for you.
+- **package registry**: setuptools registers your package with your
+ Python installation. This makes it possible to query information
+ provided by one package from another package. The best known feature of
+ this system is the entry point support which allows one package to
+ declare an "entry point" another package can hook into to extend the
+ other package.
+- **installation manager**: `easy_install`, which comes with distribute
+ can install other libraries for you. You can also use `pip`_ which
+ sooner or later will replace `easy_install` which does more than just
+ installing packages for you.
+
+Flask itself, and all the libraries you can find on the cheeseshop
+are distributed with either distribute, the older setuptools or distutils.
+
+In this case we assume your application is called
+`yourapplication.py` and you are not using a module, but a :ref:`package
+<larger-applications>`. Distributing resources with standard modules is
+not supported by `distribute`_ so we will not bother with it. If you have
+not yet converted your application into a package, head over to the
+:ref:`larger-applications` pattern to see how this can be done.
+
+A working deployment with distribute is the first step into more complex
+and more automated deployment scenarios. If you want to fully automate
+the process, also read the :ref:`fabric-deployment` chapter.
+
+Basic Setup Script
+------------------
+
+Because you have Flask running, you either have setuptools or distribute
+available on your system anyways. If you do not, fear not, there is a
+script to install it for you: `distribute_setup.py`_. Just download and
+run with your Python interpreter.
+
+Standard disclaimer applies: :ref:`you better use a virtualenv
+<virtualenv>`.
+
+Your setup code always goes into a file named `setup.py` next to your
+application. The name of the file is only convention, but because
+everybody will look for a file with that name, you better not change it.
+
+Yes, even if you are using `distribute`, you are importing from a package
+called `setuptools`. `distribute` is fully backwards compatible with
+`setuptools`, so it also uses the same import name.
+
+A basic `setup.py` file for a Flask application looks like this::
+
+ from setuptools import setup
+
+ setup(
+ name='Your Application',
+ version='1.0',
+ long_description=__doc__,
+ packages=['yourapplication'],
+ include_package_data=True,
+ zip_safe=False,
+ install_requires=['Flask']
+ )
+
+Please keep in mind that you have to list subpackages explicitly. If you
+want distribute to lookup the packages for you automatically, you can use
+the `find_packages` function::
+
+ from setuptools import setup, find_packages
+
+ setup(
+ ...
+ packages=find_packages()
+ )
+
+Most parameters to the `setup` function should be self explanatory,
+`include_package_data` and `zip_safe` might not be.
+`include_package_data` tells distribute to look for a `MANIFEST.in` file
+and install all the entries that match as package data. We will use this
+to distribute the static files and templates along with the Python module
+(see :ref:`distributing-resources`). The `zip_safe` flag can be used to
+force or prevent zip Archive creation. In general you probably don't want
+your packages to be installed as zip files because some tools do not
+support them and they make debugging a lot harder.
+
+
+.. _distributing-resources:
+
+Distributing Resources
+----------------------
+
+If you try to install the package you just created, you will notice that
+folders like `static` or `templates` are not installed for you. The
+reason for this is that distribute does not know which files to add for
+you. What you should do, is to create a `MANIFEST.in` file next to your
+`setup.py` file. This file lists all the files that should be added to
+your tarball::
+
+ recursive-include yourapplication/templates *
+ recursive-include yourapplication/static *
+
+Don't forget that even if you enlist them in your `MANIFEST.in` file, they
+won't be installed for you unless you set the `include_package_data`
+parameter of the `setup` function to `True`!
+
+
+Declaring Dependencies
+----------------------
+
+Dependencies are declared in the `install_requires` parameter as list.
+Each item in that list is the name of a package that should be pulled from
+PyPI on installation. By default it will always use the most recent
+version, but you can also provide minimum and maximum version
+requirements. Here some examples::
+
+ install_requires=[
+ 'Flask>=0.2',
+ 'SQLAlchemy>=0.6',
+ 'BrokenPackage>=0.7,<=1.0'
+ ]
+
+I mentioned earlier that dependencies are pulled from PyPI. What if you
+want to depend on a package that cannot be found on PyPI and won't be
+because it is an internal package you don't want to share with anyone?
+Just still do as if there was a PyPI entry for it and provide a list of
+alternative locations where distribute should look for tarballs::
+
+ dependency_links=['http://example.com/yourfiles']
+
+Make sure that page has a directory listing and the links on the page are
+pointing to the actual tarballs with their correct filenames as this is
+how distribute will find the files. If you have an internal company
+server that contains the packages, provide the URL to that server there.
+
+
+Installing / Developing
+-----------------------
+
+To install your application (ideally into a virtualenv) just run the
+`setup.py` script with the `install` parameter. It will install your
+application into the virtualenv's site-packages folder and also download
+and install all dependencies::
+
+ $ python setup.py install
+
+If you are developing on the package and also want the requirements to be
+installed, you can use the `develop` command instead::
+
+ $ python setup.py develop
+
+This has the advantage of just installing a link to the site-packages
+folder instead of copying the data over. You can then continue to work on
+the code without having to run `install` again after each change.
+
+
+.. _distribute: http://pypi.python.org/pypi/distribute
+.. _pip: http://pypi.python.org/pypi/pip
+.. _distribute_setup.py: http://python-distribute.org/distribute_setup.py
diff --git a/app/static/doc/flask-docs/_sources/patterns/errorpages.txt b/app/static/doc/flask-docs/_sources/patterns/errorpages.txt
new file mode 100644
index 0000000..ddf73c9
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/patterns/errorpages.txt
@@ -0,0 +1,77 @@
+Custom Error Pages
+==================
+
+Flask comes with a handy :func:`~flask.abort` function that aborts a
+request with an HTTP error code early. It will also provide a plain black
+and white error page for you with a basic description, but nothing fancy.
+
+Depending on the error code it is less or more likely for the user to
+actually see such an error.
+
+Common Error Codes
+------------------
+
+The following error codes are some that are often displayed to the user,
+even if the application behaves correctly:
+
+*404 Not Found*
+ The good old "chap, you made a mistake typing that URL" message. So
+ common that even novices to the internet know that 404 means: damn,
+ the thing I was looking for is not there. It's a very good idea to
+ make sure there is actually something useful on a 404 page, at least a
+ link back to the index.
+
+*403 Forbidden*
+ If you have some kind of access control on your website, you will have
+ to send a 403 code for disallowed resources. So make sure the user
+ is not lost when they try to access a forbidden resource.
+
+*410 Gone*
+ Did you know that there the "404 Not Found" has a brother named "410
+ Gone"? Few people actually implement that, but the idea is that
+ resources that previously existed and got deleted answer with 410
+ instead of 404. If you are not deleting documents permanently from
+ the database but just mark them as deleted, do the user a favour and
+ use the 410 code instead and display a message that what they were
+ looking for was deleted for all eternity.
+
+*500 Internal Server Error*
+ Usually happens on programming errors or if the server is overloaded.
+ A terrible good idea to have a nice page there, because your
+ application *will* fail sooner or later (see also:
+ :ref:`application-errors`).
+
+
+Error Handlers
+--------------
+
+An error handler is a function, just like a view function, but it is
+called when an error happens and is passed that error. The error is most
+likely a :exc:`~werkzeug.exceptions.HTTPException`, but in one case it
+can be a different error: a handler for internal server errors will be
+passed other exception instances as well if they are uncaught.
+
+An error handler is registered with the :meth:`~flask.Flask.errorhandler`
+decorator and the error code of the exception. Keep in mind that Flask
+will *not* set the error code for you, so make sure to also provide the
+HTTP status code when returning a response.
+
+Here an example implementation for a "404 Page Not Found" exception::
+
+ from flask import render_template
+
+ @app.errorhandler(404)
+ def page_not_found(e):
+ return render_template('404.html'), 404
+
+An example template might be this:
+
+.. sourcecode:: html+jinja
+
+ {% extends "layout.html" %}
+ {% block title %}Page Not Found{% endblock %}
+ {% block body %}
+ <h1>Page Not Found</h1>
+ <p>What you were looking for is just not there.
+ <p><a href="{{ url_for('index') }}">go somewhere nice</a>
+ {% endblock %}
diff --git a/app/static/doc/flask-docs/_sources/patterns/fabric.txt b/app/static/doc/flask-docs/_sources/patterns/fabric.txt
new file mode 100644
index 0000000..b02ad27
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/patterns/fabric.txt
@@ -0,0 +1,196 @@
+.. _fabric-deployment:
+
+Deploying with Fabric
+=====================
+
+`Fabric`_ is a tool for Python similar to Makefiles but with the ability
+to execute commands on a remote server. In combination with a properly
+set up Python package (:ref:`larger-applications`) and a good concept for
+configurations (:ref:`config`) it is very easy to deploy Flask
+applications to external servers.
+
+Before we get started, here a quick checklist of things we have to ensure
+upfront:
+
+- Fabric 1.0 has to be installed locally. This tutorial assumes the
+ latest version of Fabric.
+- The application already has to be a package and requires a working
+ `setup.py` file (:ref:`distribute-deployment`).
+- In the following example we are using `mod_wsgi` for the remote
+ servers. You can of course use your own favourite server there, but
+ for this example we chose Apache + `mod_wsgi` because it's very easy
+ to setup and has a simple way to reload applications without root
+ access.
+
+Creating the first Fabfile
+--------------------------
+
+A fabfile is what controls what Fabric executes. It is named `fabfile.py`
+and executed by the `fab` command. All the functions defined in that file
+will show up as `fab` subcommands. They are executed on one or more
+hosts. These hosts can be defined either in the fabfile or on the command
+line. In this case we will add them to the fabfile.
+
+This is a basic first example that has the ability to upload the current
+sourcecode to the server and install it into a pre-existing
+virtual environment::
+
+ from fabric.api import *
+
+ # the user to use for the remote commands
+ env.user = 'appuser'
+ # the servers where the commands are executed
+ env.hosts = ['server1.example.com', 'server2.example.com']
+
+ def pack():
+ # create a new source distribution as tarball
+ local('python setup.py sdist --formats=gztar', capture=False)
+
+ def deploy():
+ # figure out the release name and version
+ dist = local('python setup.py --fullname', capture=True).strip()
+ # upload the source tarball to the temporary folder on the server
+ put('dist/%s.tar.gz' % dist, '/tmp/yourapplication.tar.gz')
+ # create a place where we can unzip the tarball, then enter
+ # that directory and unzip it
+ run('mkdir /tmp/yourapplication')
+ with cd('/tmp/yourapplication'):
+ run('tar xzf /tmp/yourapplication.tar.gz')
+ # now setup the package with our virtual environment's
+ # python interpreter
+ run('/var/www/yourapplication/env/bin/python setup.py install')
+ # now that all is set up, delete the folder again
+ run('rm -rf /tmp/yourapplication /tmp/yourapplication.tar.gz')
+ # and finally touch the .wsgi file so that mod_wsgi triggers
+ # a reload of the application
+ run('touch /var/www/yourapplication.wsgi')
+
+The example above is well documented and should be straightforward. Here
+a recap of the most common commands fabric provides:
+
+- `run` - executes a command on a remote server
+- `local` - executes a command on the local machine
+- `put` - uploads a file to the remote server
+- `cd` - changes the directory on the serverside. This has to be used
+ in combination with the `with` statement.
+
+Running Fabfiles
+----------------
+
+Now how do you execute that fabfile? You use the `fab` command. To
+deploy the current version of the code on the remote server you would use
+this command::
+
+ $ fab pack deploy
+
+However this requires that our server already has the
+``/var/www/yourapplication`` folder created and
+``/var/www/yourapplication/env`` to be a virtual environment. Furthermore
+are we not creating the configuration or `.wsgi` file on the server. So
+how do we bootstrap a new server into our infrastructure?
+
+This now depends on the number of servers we want to set up. If we just
+have one application server (which the majority of applications will
+have), creating a command in the fabfile for this is overkill. But
+obviously you can do that. In that case you would probably call it
+`setup` or `bootstrap` and then pass the servername explicitly on the
+command line::
+
+ $ fab -H newserver.example.com bootstrap
+
+To setup a new server you would roughly do these steps:
+
+1. Create the directory structure in ``/var/www``::
+
+ $ mkdir /var/www/yourapplication
+ $ cd /var/www/yourapplication
+ $ virtualenv --distribute env
+
+2. Upload a new `application.wsgi` file to the server and the
+ configuration file for the application (eg: `application.cfg`)
+
+3. Create a new Apache config for `yourapplication` and activate it.
+ Make sure to activate watching for changes of the `.wsgi` file so
+ that we can automatically reload the application by touching it.
+ (See :ref:`mod_wsgi-deployment` for more information)
+
+So now the question is, where do the `application.wsgi` and
+`application.cfg` files come from?
+
+The WSGI File
+-------------
+
+The WSGI file has to import the application and also to set an environment
+variable so that the application knows where to look for the config. This
+is a short example that does exactly that::
+
+ import os
+ os.environ['YOURAPPLICATION_CONFIG'] = '/var/www/yourapplication/application.cfg'
+ from yourapplication import app
+
+The application itself then has to initialize itself like this to look for
+the config at that environment variable::
+
+ app = Flask(__name__)
+ app.config.from_object('yourapplication.default_config')
+ app.config.from_envvar('YOURAPPLICATION_CONFIG')
+
+This approach is explained in detail in the :ref:`config` section of the
+documentation.
+
+The Configuration File
+----------------------
+
+Now as mentioned above, the application will find the correct
+configuration file by looking up the `YOURAPPLICATION_CONFIG` environment
+variable. So we have to put the configuration in a place where the
+application will able to find it. Configuration files have the unfriendly
+quality of being different on all computers, so you do not version them
+usually.
+
+A popular approach is to store configuration files for different servers
+in a separate version control repository and check them out on all
+servers. Then symlink the file that is active for the server into the
+location where it's expected (eg: ``/var/www/yourapplication``).
+
+Either way, in our case here we only expect one or two servers and we can
+upload them ahead of time by hand.
+
+First Deployment
+----------------
+
+Now we can do our first deployment. We have set up the servers so that
+they have their virtual environments and activated apache configs. Now we
+can pack up the application and deploy it::
+
+ $ fab pack deploy
+
+Fabric will now connect to all servers and run the commands as written
+down in the fabfile. First it will execute pack so that we have our
+tarball ready and then it will execute deploy and upload the source code
+to all servers and install it there. Thanks to the `setup.py` file we
+will automatically pull in the required libraries into our virtual
+environment.
+
+Next Steps
+----------
+
+From that point onwards there is so much that can be done to make
+deployment actually fun:
+
+- Create a `bootstrap` command that initializes new servers. It could
+ initialize a new virtual environment, setup apache appropriately etc.
+- Put configuration files into a separate version control repository
+ and symlink the active configs into place.
+- You could also put your application code into a repository and check
+ out the latest version on the server and then install. That way you
+ can also easily go back to older versions.
+- hook in testing functionality so that you can deploy to an external
+ server and run the testsuite.
+
+Working with Fabric is fun and you will notice that it's quite magical to
+type ``fab deploy`` and see your application being deployed automatically
+to one or more remote servers.
+
+
+.. _Fabric: http://fabfile.org/
diff --git a/app/static/doc/flask-docs/_sources/patterns/favicon.txt b/app/static/doc/flask-docs/_sources/patterns/favicon.txt
new file mode 100644
index 0000000..f7b2f9c
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/patterns/favicon.txt
@@ -0,0 +1,53 @@
+Adding a favicon
+================
+
+A "favicon" is an icon used by browsers for tabs and bookmarks. This helps
+to distinguish your website and to give it a unique brand.
+
+A common question is how to add a favicon to a flask application. First, of
+course, you need an icon. It should be 16 × 16 pixels and in the ICO file
+format. This is not a requirement but a de-facto standard supported by all
+relevant browsers. Put the icon in your static directory as
+:file:`favicon.ico`.
+
+Now, to get browsers to find your icon, the correct way is to add a link
+tag in your HTML. So, for example:
+
+.. sourcecode:: html+jinja
+
+ <link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}">
+
+That's all you need for most browsers, however some really old ones do not
+support this standard. The old de-facto standard is to serve this file,
+with this name, at the website root. If your application is not mounted at
+the root path of the domain you either need to configure the webserver to
+serve the icon at the root or if you can't do that you're out of luck. If
+however your application is the root you can simply route a redirect::
+
+ app.add_url_rule('/favicon.ico',
+ redirect_to=url_for('static', filename='favicon.ico'))
+
+If you want to save the extra redirect request you can also write a view
+using :func:`~flask.send_from_directory`::
+
+ import os
+ from flask import send_from_directory
+
+ @app.route('/favicon.ico')
+ def favicon():
+ return send_from_directory(os.path.join(app.root_path, 'static'),
+ 'favicon.ico', mimetype='image/vnd.microsoft.icon')
+
+We can leave out the explicit mimetype and it will be guessed, but we may
+as well specify it to avoid the extra guessing, as it will always be the
+same.
+
+The above will serve the icon via your application and if possible it's
+better to configure your dedicated web server to serve it; refer to the
+webserver's documentation.
+
+See also
+--------
+
+* The `Favicon <http://en.wikipedia.org/wiki/Favicon>`_ article on
+ Wikipedia
diff --git a/app/static/doc/flask-docs/_sources/patterns/fileuploads.txt b/app/static/doc/flask-docs/_sources/patterns/fileuploads.txt
new file mode 100644
index 0000000..d237b10
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/patterns/fileuploads.txt
@@ -0,0 +1,181 @@
+.. _uploading-files:
+
+Uploading Files
+===============
+
+Ah yes, the good old problem of file uploads. The basic idea of file
+uploads is actually quite simple. It basically works like this:
+
+1. A ``<form>`` tag is marked with ``enctype=multipart/form-data``
+ and an ``<input type=file>`` is placed in that form.
+2. The application accesses the file from the :attr:`~flask.request.files`
+ dictionary on the request object.
+3. use the :meth:`~werkzeug.datastructures.FileStorage.save` method of the file to save
+ the file permanently somewhere on the filesystem.
+
+A Gentle Introduction
+---------------------
+
+Let's start with a very basic application that uploads a file to a
+specific upload folder and displays a file to the user. Let's look at the
+bootstrapping code for our application::
+
+ import os
+ from flask import Flask, request, redirect, url_for
+ from werkzeug import secure_filename
+
+ UPLOAD_FOLDER = '/path/to/the/uploads'
+ ALLOWED_EXTENSIONS = set(['txt', 'pdf', 'png', 'jpg', 'jpeg', 'gif'])
+
+ app = Flask(__name__)
+ app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
+
+So first we need a couple of imports. Most should be straightforward, the
+:func:`werkzeug.secure_filename` is explained a little bit later. The
+`UPLOAD_FOLDER` is where we will store the uploaded files and the
+`ALLOWED_EXTENSIONS` is the set of allowed file extensions. Then we add a
+URL rule by hand to the application. Now usually we're not doing that, so
+why here? The reasons is that we want the webserver (or our development
+server) to serve these files for us and so we only need a rule to generate
+the URL to these files.
+
+Why do we limit the extensions that are allowed? You probably don't want
+your users to be able to upload everything there if the server is directly
+sending out the data to the client. That way you can make sure that users
+are not able to upload HTML files that would cause XSS problems (see
+:ref:`xss`). Also make sure to disallow `.php` files if the server
+executes them, but who has PHP installed on his server, right? :)
+
+Next the functions that check if an extension is valid and that uploads
+the file and redirects the user to the URL for the uploaded file::
+
+ def allowed_file(filename):
+ return '.' in filename and \
+ filename.rsplit('.', 1)[1] in ALLOWED_EXTENSIONS
+
+ @app.route('/', methods=['GET', 'POST'])
+ def upload_file():
+ if request.method == 'POST':
+ file = request.files['file']
+ if file and allowed_file(file.filename):
+ filename = secure_filename(file.filename)
+ file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename))
+ return redirect(url_for('uploaded_file',
+ filename=filename))
+ return '''
+ <!doctype html>
+ <title>Upload new File</title>
+ <h1>Upload new File</h1>
+ <form action="" method=post enctype=multipart/form-data>
+ <p><input type=file name=file>
+ <input type=submit value=Upload>
+ </form>
+ '''
+
+So what does that :func:`~werkzeug.utils.secure_filename` function actually do?
+Now the problem is that there is that principle called "never trust user
+input". This is also true for the filename of an uploaded file. All
+submitted form data can be forged, and filenames can be dangerous. For
+the moment just remember: always use that function to secure a filename
+before storing it directly on the filesystem.
+
+.. admonition:: Information for the Pros
+
+ So you're interested in what that :func:`~werkzeug.utils.secure_filename`
+ function does and what the problem is if you're not using it? So just
+ imagine someone would send the following information as `filename` to
+ your application::
+
+ filename = "../../../../home/username/.bashrc"
+
+ Assuming the number of ``../`` is correct and you would join this with
+ the `UPLOAD_FOLDER` the user might have the ability to modify a file on
+ the server's filesystem he or she should not modify. This does require some
+ knowledge about how the application looks like, but trust me, hackers
+ are patient :)
+
+ Now let's look how that function works:
+
+ >>> secure_filename('../../../../home/username/.bashrc')
+ 'home_username_.bashrc'
+
+Now one last thing is missing: the serving of the uploaded files. As of
+Flask 0.5 we can use a function that does that for us::
+
+ from flask import send_from_directory
+
+ @app.route('/uploads/<filename>')
+ def uploaded_file(filename):
+ return send_from_directory(app.config['UPLOAD_FOLDER'],
+ filename)
+
+Alternatively you can register `uploaded_file` as `build_only` rule and
+use the :class:`~werkzeug.wsgi.SharedDataMiddleware`. This also works with
+older versions of Flask::
+
+ from werkzeug import SharedDataMiddleware
+ app.add_url_rule('/uploads/<filename>', 'uploaded_file',
+ build_only=True)
+ app.wsgi_app = SharedDataMiddleware(app.wsgi_app, {
+ '/uploads': app.config['UPLOAD_FOLDER']
+ })
+
+If you now run the application everything should work as expected.
+
+
+Improving Uploads
+-----------------
+
+.. versionadded:: 0.6
+
+So how exactly does Flask handle uploads? Well it will store them in the
+webserver's memory if the files are reasonable small otherwise in a
+temporary location (as returned by :func:`tempfile.gettempdir`). But how
+do you specify the maximum file size after which an upload is aborted? By
+default Flask will happily accept file uploads to an unlimited amount of
+memory, but you can limit that by setting the ``MAX_CONTENT_LENGTH``
+config key::
+
+ from flask import Flask, Request
+
+ app = Flask(__name__)
+ app.config['MAX_CONTENT_LENGTH'] = 16 * 1024 * 1024
+
+The code above will limited the maximum allowed payload to 16 megabytes.
+If a larger file is transmitted, Flask will raise an
+:exc:`~werkzeug.exceptions.RequestEntityTooLarge` exception.
+
+This feature was added in Flask 0.6 but can be achieved in older versions
+as well by subclassing the request object. For more information on that
+consult the Werkzeug documentation on file handling.
+
+
+Upload Progress Bars
+--------------------
+
+A while ago many developers had the idea to read the incoming file in
+small chunks and store the upload progress in the database to be able to
+poll the progress with JavaScript from the client. Long story short: the
+client asks the server every 5 seconds how much it has transmitted
+already. Do you realize the irony? The client is asking for something it
+should already know.
+
+Now there are better solutions to that work faster and more reliable. The
+web changed a lot lately and you can use HTML5, Java, Silverlight or Flash
+to get a nicer uploading experience on the client side. Look at the
+following libraries for some nice examples how to do that:
+
+- `Plupload <http://www.plupload.com/>`_ - HTML5, Java, Flash
+- `SWFUpload <http://www.swfupload.org/>`_ - Flash
+- `JumpLoader <http://jumploader.com/>`_ - Java
+
+
+An Easier Solution
+------------------
+
+Because the common pattern for file uploads exists almost unchanged in all
+applications dealing with uploads, there is a Flask extension called
+`Flask-Uploads`_ that implements a full fledged upload mechanism with
+white and blacklisting of extensions and more.
+
+.. _Flask-Uploads: http://packages.python.org/Flask-Uploads/
diff --git a/app/static/doc/flask-docs/_sources/patterns/flashing.txt b/app/static/doc/flask-docs/_sources/patterns/flashing.txt
new file mode 100644
index 0000000..7abe716
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/patterns/flashing.txt
@@ -0,0 +1,119 @@
+.. _message-flashing-pattern:
+
+Message Flashing
+================
+
+Good applications and user interfaces are all about feedback. If the user
+does not get enough feedback they will probably end up hating the
+application. Flask provides a really simple way to give feedback to a
+user with the flashing system. The flashing system basically makes it
+possible to record a message at the end of a request and access it next
+request and only next request. This is usually combined with a layout
+template that does this.
+
+Simple Flashing
+---------------
+
+So here is a full example::
+
+ from flask import flash, redirect, url_for, render_template
+
+ @app.route('/')
+ def index():
+ return render_template('index.html')
+
+ @app.route('/login', methods=['GET', 'POST'])
+ def login():
+ error = None
+ if request.method == 'POST':
+ if request.form['username'] != 'admin' or \
+ request.form['password'] != 'secret':
+ error = 'Invalid credentials'
+ else:
+ flash('You were successfully logged in')
+ return redirect(url_for('index'))
+ return render_template('login.html', error=error)
+
+And here the ``layout.html`` template which does the magic:
+
+.. sourcecode:: html+jinja
+
+ <!doctype html>
+ <title>My Application</title>
+ {% with messages = get_flashed_messages() %}
+ {% if messages %}
+ <ul class=flashes>
+ {% for message in messages %}
+ <li>{{ message }}</li>
+ {% endfor %}
+ </ul>
+ {% endif %}
+ {% endwith %}
+ {% block body %}{% endblock %}
+
+And here the index.html template:
+
+.. sourcecode:: html+jinja
+
+ {% extends "layout.html" %}
+ {% block body %}
+ <h1>Overview</h1>
+ <p>Do you want to <a href="{{ url_for('login') }}">log in?</a>
+ {% endblock %}
+
+And of course the login template:
+
+.. sourcecode:: html+jinja
+
+ {% extends "layout.html" %}
+ {% block body %}
+ <h1>Login</h1>
+ {% if error %}
+ <p class=error><strong>Error:</strong> {{ error }}
+ {% endif %}
+ <form action="" method=post>
+ <dl>
+ <dt>Username:
+ <dd><input type=text name=username value="{{
+ request.form.username }}">
+ <dt>Password:
+ <dd><input type=password name=password>
+ </dl>
+ <p><input type=submit value=Login>
+ </form>
+ {% endblock %}
+
+Flashing With Categories
+------------------------
+
+.. versionadded:: 0.3
+
+It is also possible to provide categories when flashing a message. The
+default category if nothing is provided is ``'message'``. Alternative
+categories can be used to give the user better feedback. For example
+error messages could be displayed with a red background.
+
+To flash a message with a different category, just use the second argument
+to the :func:`~flask.flash` function::
+
+ flash(u'Invalid password provided', 'error')
+
+Inside the template you then have to tell the
+:func:`~flask.get_flashed_messages` function to also return the
+categories. The loop looks slightly different in that situation then:
+
+.. sourcecode:: html+jinja
+
+ {% with messages = get_flashed_messages(with_categories=true) %}
+ {% if messages %}
+ <ul class=flashes>
+ {% for category, message in messages %}
+ <li class="{{ category }}">{{ message }}</li>
+ {% endfor %}
+ </ul>
+ {% endif %}
+ {% endwith %}
+
+This is just one example of how to render these flashed messages. One
+might also use the category to add a prefix such as
+``<strong>Error:</strong>`` to the message.
diff --git a/app/static/doc/flask-docs/_sources/patterns/index.txt b/app/static/doc/flask-docs/_sources/patterns/index.txt
new file mode 100644
index 0000000..964b1e1
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/patterns/index.txt
@@ -0,0 +1,39 @@
+.. _patterns:
+
+Patterns for Flask
+==================
+
+Certain things are common enough that the chances are high you will find
+them in most web applications. For example quite a lot of applications
+are using relational databases and user authentication. In that case,
+chances are they will open a database connection at the beginning of the
+request and get the information of the currently logged in user. At the
+end of the request, the database connection is closed again.
+
+There are more user contributed snippets and patterns in the `Flask
+Snippet Archives <http://flask.pocoo.org/snippets/>`_.
+
+.. toctree::
+ :maxdepth: 2
+
+ packages
+ appfactories
+ appdispatch
+ urlprocessors
+ distribute
+ fabric
+ sqlite3
+ sqlalchemy
+ fileuploads
+ caching
+ viewdecorators
+ wtforms
+ templateinheritance
+ flashing
+ jquery
+ errorpages
+ lazyloading
+ mongokit
+ favicon
+ streaming
+ deferredcallbacks
diff --git a/app/static/doc/flask-docs/_sources/patterns/jquery.txt b/app/static/doc/flask-docs/_sources/patterns/jquery.txt
new file mode 100644
index 0000000..f3c46e3
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/patterns/jquery.txt
@@ -0,0 +1,167 @@
+AJAX with jQuery
+================
+
+`jQuery`_ is a small JavaScript library commonly used to simplify working
+with the DOM and JavaScript in general. It is the perfect tool to make
+web applications more dynamic by exchanging JSON between server and
+client.
+
+JSON itself is a very lightweight transport format, very similar to how
+Python primitives (numbers, strings, dicts and lists) look like which is
+widely supported and very easy to parse. It became popular a few years
+ago and quickly replaced XML as transport format in web applications.
+
+If you have Python 2.6 JSON will work out of the box, in Python 2.5 you
+will have to install the `simplejson`_ library from PyPI.
+
+.. _jQuery: http://jquery.com/
+.. _simplejson: http://pypi.python.org/pypi/simplejson
+
+Loading jQuery
+--------------
+
+In order to use jQuery, you have to download it first and place it in the
+static folder of your application and then ensure it's loaded. Ideally
+you have a layout template that is used for all pages where you just have
+to add a script statement to the bottom of your `<body>` to load jQuery:
+
+.. sourcecode:: html
+
+ <script type=text/javascript src="{{
+ url_for('static', filename='jquery.js') }}"></script>
+
+Another method is using Google's `AJAX Libraries API
+<http://code.google.com/apis/ajaxlibs/documentation/>`_ to load jQuery:
+
+.. sourcecode:: html
+
+ <script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.js"></script>
+ <script>window.jQuery || document.write('<script src="{{
+ url_for('static', filename='jquery.js') }}">\x3C/script>')</script>
+
+In this case you have to put jQuery into your static folder as a fallback, but it will
+first try to load it directly from Google. This has the advantage that your
+website will probably load faster for users if they went to at least one
+other website before using the same jQuery version from Google because it
+will already be in the browser cache.
+
+Where is My Site?
+-----------------
+
+Do you know where your application is? If you are developing the answer
+is quite simple: it's on localhost port something and directly on the root
+of that server. But what if you later decide to move your application to
+a different location? For example to ``http://example.com/myapp``? On
+the server side this never was a problem because we were using the handy
+:func:`~flask.url_for` function that could answer that question for
+us, but if we are using jQuery we should not hardcode the path to
+the application but make that dynamic, so how can we do that?
+
+A simple method would be to add a script tag to our page that sets a
+global variable to the prefix to the root of the application. Something
+like this:
+
+.. sourcecode:: html+jinja
+
+ <script type=text/javascript>
+ $SCRIPT_ROOT = {{ request.script_root|tojson|safe }};
+ </script>
+
+The ``|safe`` is necessary so that Jinja does not escape the JSON encoded
+string with HTML rules. Usually this would be necessary, but we are
+inside a `script` block here where different rules apply.
+
+.. admonition:: Information for Pros
+
+ In HTML the `script` tag is declared `CDATA` which means that entities
+ will not be parsed. Everything until ``</script>`` is handled as script.
+ This also means that there must never be any ``</`` between the script
+ tags. ``|tojson`` is kind enough to do the right thing here and
+ escape slashes for you (``{{ "</script>"|tojson|safe }}`` is rendered as
+ ``"<\/script>"``).
+
+
+JSON View Functions
+-------------------
+
+Now let's create a server side function that accepts two URL arguments of
+numbers which should be added together and then sent back to the
+application in a JSON object. This is a really ridiculous example and is
+something you usually would do on the client side alone, but a simple
+example that shows how you would use jQuery and Flask nonetheless::
+
+ from flask import Flask, jsonify, render_template, request
+ app = Flask(__name__)
+
+ @app.route('/_add_numbers')
+ def add_numbers():
+ a = request.args.get('a', 0, type=int)
+ b = request.args.get('b', 0, type=int)
+ return jsonify(result=a + b)
+
+ @app.route('/')
+ def index():
+ return render_template('index.html')
+
+As you can see I also added an `index` method here that renders a
+template. This template will load jQuery as above and have a little form
+we can add two numbers and a link to trigger the function on the server
+side.
+
+Note that we are using the :meth:`~werkzeug.datastructures.MultiDict.get` method here
+which will never fail. If the key is missing a default value (here ``0``)
+is returned. Furthermore it can convert values to a specific type (like
+in our case `int`). This is especially handy for code that is
+triggered by a script (APIs, JavaScript etc.) because you don't need
+special error reporting in that case.
+
+The HTML
+--------
+
+Your index.html template either has to extend a `layout.html` template with
+jQuery loaded and the `$SCRIPT_ROOT` variable set, or do that on the top.
+Here's the HTML code needed for our little application (`index.html`).
+Notice that we also drop the script directly into the HTML here. It is
+usually a better idea to have that in a separate script file:
+
+.. sourcecode:: html
+
+ <script type=text/javascript>
+ $(function() {
+ $('a#calculate').bind('click', function() {
+ $.getJSON($SCRIPT_ROOT + '/_add_numbers', {
+ a: $('input[name="a"]').val(),
+ b: $('input[name="b"]').val()
+ }, function(data) {
+ $("#result").text(data.result);
+ });
+ return false;
+ });
+ });
+ </script>
+ <h1>jQuery Example</h1>
+ <p><input type=text size=5 name=a> +
+ <input type=text size=5 name=b> =
+ <span id=result>?</span>
+ <p><a href=# id=calculate>calculate server side</a>
+
+I won't got into detail here about how jQuery works, just a very quick
+explanation of the little bit of code above:
+
+1. ``$(function() { ... })`` specifies code that should run once the
+ browser is done loading the basic parts of the page.
+2. ``$('selector')`` selects an element and lets you operate on it.
+3. ``element.bind('event', func)`` specifies a function that should run
+ when the user clicked on the element. If that function returns
+ `false`, the default behaviour will not kick in (in this case, navigate
+ to the `#` URL).
+4. ``$.getJSON(url, data, func)`` sends a `GET` request to `url` and will
+ send the contents of the `data` object as query parameters. Once the
+ data arrived, it will call the given function with the return value as
+ argument. Note that we can use the `$SCRIPT_ROOT` variable here that
+ we set earlier.
+
+If you don't get the whole picture, download the `sourcecode
+for this example
+<http://github.com/mitsuhiko/flask/tree/master/examples/jqueryexample>`_
+from github.
diff --git a/app/static/doc/flask-docs/_sources/patterns/lazyloading.txt b/app/static/doc/flask-docs/_sources/patterns/lazyloading.txt
new file mode 100644
index 0000000..50ad6fa
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/patterns/lazyloading.txt
@@ -0,0 +1,104 @@
+Lazily Loading Views
+====================
+
+Flask is usually used with the decorators. Decorators are simple and you
+have the URL right next to the function that is called for that specific
+URL. However there is a downside to this approach: it means all your code
+that uses decorators has to be imported upfront or Flask will never
+actually find your function.
+
+This can be a problem if your application has to import quick. It might
+have to do that on systems like Google's App Engine or other systems. So
+if you suddenly notice that your application outgrows this approach you
+can fall back to a centralized URL mapping.
+
+The system that enables having a central URL map is the
+:meth:`~flask.Flask.add_url_rule` function. Instead of using decorators,
+you have a file that sets up the application with all URLs.
+
+Converting to Centralized URL Map
+---------------------------------
+
+Imagine the current application looks somewhat like this::
+
+ from flask import Flask
+ app = Flask(__name__)
+
+ @app.route('/')
+ def index():
+ pass
+
+ @app.route('/user/<username>')
+ def user(username):
+ pass
+
+Then the centralized approach you would have one file with the views
+(`views.py`) but without any decorator::
+
+ def index():
+ pass
+
+ def user(username):
+ pass
+
+And then a file that sets up an application which maps the functions to
+URLs::
+
+ from flask import Flask
+ from yourapplication import views
+ app = Flask(__name__)
+ app.add_url_rule('/', view_func=views.index)
+ app.add_url_rule('/user/<username>', view_func=views.user)
+
+Loading Late
+------------
+
+So far we only split up the views and the routing, but the module is still
+loaded upfront. The trick to actually load the view function as needed.
+This can be accomplished with a helper class that behaves just like a
+function but internally imports the real function on first use::
+
+ from werkzeug import import_string, cached_property
+
+ class LazyView(object):
+
+ def __init__(self, import_name):
+ self.__module__, self.__name__ = import_name.rsplit('.', 1)
+ self.import_name = import_name
+
+ @cached_property
+ def view(self):
+ return import_string(self.import_name)
+
+ def __call__(self, *args, **kwargs):
+ return self.view(*args, **kwargs)
+
+What's important here is is that `__module__` and `__name__` are properly
+set. This is used by Flask internally to figure out how to name the
+URL rules in case you don't provide a name for the rule yourself.
+
+Then you can define your central place to combine the views like this::
+
+ from flask import Flask
+ from yourapplication.helpers import LazyView
+ app = Flask(__name__)
+ app.add_url_rule('/',
+ view_func=LazyView('yourapplication.views.index'))
+ app.add_url_rule('/user/<username>',
+ view_func=LazyView('yourapplication.views.user'))
+
+You can further optimize this in terms of amount of keystrokes needed to
+write this by having a function that calls into
+:meth:`~flask.Flask.add_url_rule` by prefixing a string with the project
+name and a dot, and by wrapping `view_func` in a `LazyView` as needed::
+
+ def url(url_rule, import_name, **options):
+ view = LazyView('yourapplication.' + import_name)
+ app.add_url_rule(url_rule, view_func=view, **options)
+
+ url('/', 'views.index')
+ url('/user/<username>', 'views.user')
+
+One thing to keep in mind is that before and after request handlers have
+to be in a file that is imported upfront to work properly on the first
+request. The same goes for any kind of remaining decorator.
diff --git a/app/static/doc/flask-docs/_sources/patterns/mongokit.txt b/app/static/doc/flask-docs/_sources/patterns/mongokit.txt
new file mode 100644
index 0000000..a9c4eef
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/patterns/mongokit.txt
@@ -0,0 +1,144 @@
+.. mongokit-pattern:
+
+MongoKit in Flask
+=================
+
+Using a document database rather than a full DBMS gets more common these days.
+This pattern shows how to use MongoKit, a document mapper library, to
+integrate with MongoDB.
+
+This pattern requires a running MongoDB server and the MongoKit library
+installed.
+
+There are two very common ways to use MongoKit. I will outline each of them
+here:
+
+
+Declarative
+-----------
+
+The default behaviour of MongoKit is the declarative one that is based on
+common ideas from Django or the SQLAlchemy declarative extension.
+
+Here an example `app.py` module for your application::
+
+ from flask import Flask
+ from mongokit import Connection, Document
+
+ # configuration
+ MONGODB_HOST = 'localhost'
+ MONGODB_PORT = 27017
+
+ # create the little application object
+ app = Flask(__name__)
+ app.config.from_object(__name__)
+
+ # connect to the database
+ connection = Connection(app.config['MONGODB_HOST'],
+ app.config['MONGODB_PORT'])
+
+
+To define your models, just subclass the `Document` class that is imported
+from MongoKit. If you've seen the SQLAlchemy pattern you may wonder why we do
+not have a session and even do not define a `init_db` function here. On the
+one hand, MongoKit does not have something like a session. This sometimes
+makes it more to type but also makes it blazingly fast. On the other hand,
+MongoDB is schemaless. This means you can modify the data structure from one
+insert query to the next without any problem. MongoKit is just schemaless
+too, but implements some validation to ensure data integrity.
+
+Here is an example document (put this also into `app.py`, e.g.)::
+
+ def max_length(length):
+ def validate(value):
+ if len(value) <= length:
+ return True
+ raise Exception('%s must be at most %s characters long' % length)
+ return validate
+
+ class User(Document):
+ structure = {
+ 'name': unicode,
+ 'email': unicode,
+ }
+ validators = {
+ 'name': max_length(50),
+ 'email': max_length(120)
+ }
+ use_dot_notation = True
+ def __repr__(self):
+ return '<User %r>' % (self.name)
+
+ # register the User document with our current connection
+ connection.register([User])
+
+
+This example shows you how to define your schema (named structure), a
+validator for the maximum character length and uses a special MongoKit feature
+called `use_dot_notation`. Per default MongoKit behaves like a python
+dictionary but with `use_dot_notation` set to `True` you can use your
+documents like you use models in nearly any other ORM by using dots to
+separate between attributes.
+
+You can insert entries into the database like this:
+
+>>> from yourapplication.database import connection
+>>> from yourapplication.models import User
+>>> collection = connection['test'].users
+>>> user = collection.User()
+>>> user['name'] = u'admin'
+>>> user['email'] = u'admin@localhost'
+>>> user.save()
+
+Note that MongoKit is kinda strict with used column types, you must not use a
+common `str` type for either `name` or `email` but unicode.
+
+Querying is simple as well:
+
+>>> list(collection.User.find())
+[<User u'admin'>]
+>>> collection.User.find_one({'name': u'admin'})
+<User u'admin'>
+
+.. _MongoKit: http://bytebucket.org/namlook/mongokit/
+
+
+PyMongo Compatibility Layer
+---------------------------
+
+If you just want to use PyMongo, you can do that with MongoKit as well. You
+may use this process if you need the best performance to get. Note that this
+example does not show how to couple it with Flask, see the above MongoKit code
+for examples::
+
+ from MongoKit import Connection
+
+ connection = Connection()
+
+To insert data you can use the `insert` method. We have to get a
+collection first, this is somewhat the same as a table in the SQL world.
+
+>>> collection = connection['test'].users
+>>> user = {'name': u'admin', 'email': u'admin@localhost'}
+>>> collection.insert(user)
+
+print list(collection.find())
+print collection.find_one({'name': u'admin'})
+
+MongoKit will automatically commit for us.
+
+To query your database, you use the collection directly:
+
+>>> list(collection.find())
+[{u'_id': ObjectId('4c271729e13823182f000000'), u'name': u'admin', u'email': u'admin@localhost'}]
+>>> collection.find_one({'name': u'admin'})
+{u'_id': ObjectId('4c271729e13823182f000000'), u'name': u'admin', u'email': u'admin@localhost'}
+
+These results are also dict-like objects:
+
+>>> r = collection.find_one({'name': u'admin'})
+>>> r['email']
+u'admin@localhost'
+
+For more information about MongoKit, head over to the
+`website <http://bytebucket.org/namlook/mongokit/>`_.
diff --git a/app/static/doc/flask-docs/_sources/patterns/packages.txt b/app/static/doc/flask-docs/_sources/patterns/packages.txt
new file mode 100644
index 0000000..79fd2c5
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/patterns/packages.txt
@@ -0,0 +1,115 @@
+.. _larger-applications:
+
+Larger Applications
+===================
+
+For larger applications it's a good idea to use a package instead of a
+module. That is quite simple. Imagine a small application looks like
+this::
+
+ /yourapplication
+ /yourapplication.py
+ /static
+ /style.css
+ /templates
+ layout.html
+ index.html
+ login.html
+ ...
+
+Simple Packages
+---------------
+
+To convert that into a larger one, just create a new folder
+`yourapplication` inside the existing one and move everything below it.
+Then rename `yourapplication.py` to `__init__.py`. (Make sure to delete
+all `.pyc` files first, otherwise things would most likely break)
+
+You should then end up with something like that::
+
+ /yourapplication
+ /yourapplication
+ /__init__.py
+ /static
+ /style.css
+ /templates
+ layout.html
+ index.html
+ login.html
+ ...
+
+But how do you run your application now? The naive ``python
+yourapplication/__init__.py`` will not work. Let's just say that Python
+does not want modules in packages to be the startup file. But that is not
+a big problem, just add a new file called `runserver.py` next to the inner
+`yourapplication` folder with the following contents::
+
+ from yourapplication import app
+ app.run(debug=True)
+
+What did we gain from this? Now we can restructure the application a bit
+into multiple modules. The only thing you have to remember is the
+following quick checklist:
+
+1. the `Flask` application object creation has to be in the
+ `__init__.py` file. That way each module can import it safely and the
+ `__name__` variable will resolve to the correct package.
+2. all the view functions (the ones with a :meth:`~flask.Flask.route`
+ decorator on top) have to be imported when in the `__init__.py` file.
+ Not the object itself, but the module it is in. Import the view module
+ **after the application object is created**.
+
+Here's an example `__init__.py`::
+
+ from flask import Flask
+ app = Flask(__name__)
+
+ import yourapplication.views
+
+And this is what `views.py` would look like::
+
+ from yourapplication import app
+
+ @app.route('/')
+ def index():
+ return 'Hello World!'
+
+You should then end up with something like that::
+
+ /yourapplication
+ /runserver.py
+ /yourapplication
+ /__init__.py
+ /views.py
+ /static
+ /style.css
+ /templates
+ layout.html
+ index.html
+ login.html
+ ...
+
+.. admonition:: Circular Imports
+
+ Every Python programmer hates them, and yet we just added some:
+ circular imports (That's when two modules depend on each other. In this
+ case `views.py` depends on `__init__.py`). Be advised that this is a
+ bad idea in general but here it is actually fine. The reason for this is
+ that we are not actually using the views in `__init__.py` and just
+ ensuring the module is imported and we are doing that at the bottom of
+ the file.
+
+ There are still some problems with that approach but if you want to use
+ decorators there is no way around that. Check out the
+ :ref:`becomingbig` section for some inspiration how to deal with that.
+
+
+.. _working-with-modules:
+
+Working with Blueprints
+-----------------------
+
+If you have larger applications it's recommended to divide them into
+smaller groups where each group is implemented with the help of a
+blueprint. For a gentle introduction into this topic refer to the
+:ref:`blueprints` chapter of the documentation.
diff --git a/app/static/doc/flask-docs/_sources/patterns/sqlalchemy.txt b/app/static/doc/flask-docs/_sources/patterns/sqlalchemy.txt
new file mode 100644
index 0000000..5a33d1f
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/patterns/sqlalchemy.txt
@@ -0,0 +1,214 @@
+.. _sqlalchemy-pattern:
+
+SQLAlchemy in Flask
+===================
+
+Many people prefer `SQLAlchemy`_ for database access. In this case it's
+encouraged to use a package instead of a module for your flask application
+and drop the models into a separate module (:ref:`larger-applications`).
+While that is not necessary, it makes a lot of sense.
+
+There are four very common ways to use SQLAlchemy. I will outline each
+of them here:
+
+Flask-SQLAlchemy Extension
+--------------------------
+
+Because SQLAlchemy is a common database abstraction layer and object
+relational mapper that requires a little bit of configuration effort,
+there is a Flask extension that handles that for you. This is recommended
+if you want to get started quickly.
+
+You can download `Flask-SQLAlchemy`_ from `PyPI
+<http://pypi.python.org/pypi/Flask-SQLAlchemy>`_.
+
+.. _Flask-SQLAlchemy: http://packages.python.org/Flask-SQLAlchemy/
+
+
+Declarative
+-----------
+
+The declarative extension in SQLAlchemy is the most recent method of using
+SQLAlchemy. It allows you to define tables and models in one go, similar
+to how Django works. In addition to the following text I recommend the
+official documentation on the `declarative`_ extension.
+
+Here the example `database.py` module for your application::
+
+ from sqlalchemy import create_engine
+ from sqlalchemy.orm import scoped_session, sessionmaker
+ from sqlalchemy.ext.declarative import declarative_base
+
+ engine = create_engine('sqlite:////tmp/test.db', convert_unicode=True)
+ db_session = scoped_session(sessionmaker(autocommit=False,
+ autoflush=False,
+ bind=engine))
+ Base = declarative_base()
+ Base.query = db_session.query_property()
+
+ def init_db():
+ # import all modules here that might define models so that
+ # they will be registered properly on the metadata. Otherwise
+ # you will have to import them first before calling init_db()
+ import yourapplication.models
+ Base.metadata.create_all(bind=engine)
+
+To define your models, just subclass the `Base` class that was created by
+the code above. If you are wondering why we don't have to care about
+threads here (like we did in the SQLite3 example above with the
+:data:`~flask.g` object): that's because SQLAlchemy does that for us
+already with the :class:`~sqlalchemy.orm.scoped_session`.
+
+To use SQLAlchemy in a declarative way with your application, you just
+have to put the following code into your application module. Flask will
+automatically remove database sessions at the end of the request for you::
+
+ from yourapplication.database import db_session
+
+ @app.teardown_request
+ def shutdown_session(exception=None):
+ db_session.remove()
+
+Here is an example model (put this into `models.py`, e.g.)::
+
+ from sqlalchemy import Column, Integer, String
+ from yourapplication.database import Base
+
+ class User(Base):
+ __tablename__ = 'users'
+ id = Column(Integer, primary_key=True)
+ name = Column(String(50), unique=True)
+ email = Column(String(120), unique=True)
+
+ def __init__(self, name=None, email=None):
+ self.name = name
+ self.email = email
+
+ def __repr__(self):
+ return '<User %r>' % (self.name)
+
+To create the database you can use the `init_db` function:
+
+>>> from yourapplication.database import init_db
+>>> init_db()
+
+You can insert entries into the database like this:
+
+>>> from yourapplication.database import db_session
+>>> from yourapplication.models import User
+>>> u = User('admin', 'admin@localhost')
+>>> db_session.add(u)
+>>> db_session.commit()
+
+Querying is simple as well:
+
+>>> User.query.all()
+[<User u'admin'>]
+>>> User.query.filter(User.name == 'admin').first()
+<User u'admin'>
+
+.. _SQLAlchemy: http://www.sqlalchemy.org/
+.. _declarative:
+ http://www.sqlalchemy.org/docs/orm/extensions/declarative.html
+
+Manual Object Relational Mapping
+--------------------------------
+
+Manual object relational mapping has a few upsides and a few downsides
+versus the declarative approach from above. The main difference is that
+you define tables and classes separately and map them together. It's more
+flexible but a little more to type. In general it works like the
+declarative approach, so make sure to also split up your application into
+multiple modules in a package.
+
+Here is an example `database.py` module for your application::
+
+ from sqlalchemy import create_engine, MetaData
+ from sqlalchemy.orm import scoped_session, sessionmaker
+
+ engine = create_engine('sqlite:////tmp/test.db', convert_unicode=True)
+ metadata = MetaData()
+ db_session = scoped_session(sessionmaker(autocommit=False,
+ autoflush=False,
+ bind=engine))
+ def init_db():
+ metadata.create_all(bind=engine)
+
+As for the declarative approach you need to close the session after
+each request. Put this into your application module::
+
+ from yourapplication.database import db_session
+
+ @app.teardown_request
+ def shutdown_session(exception=None):
+ db_session.remove()
+
+Here is an example table and model (put this into `models.py`)::
+
+ from sqlalchemy import Table, Column, Integer, String
+ from sqlalchemy.orm import mapper
+ from yourapplication.database import metadata, db_session
+
+ class User(object):
+ query = db_session.query_property()
+
+ def __init__(self, name=None, email=None):
+ self.name = name
+ self.email = email
+
+ def __repr__(self):
+ return '<User %r>' % (self.name, self.email)
+
+ users = Table('users', metadata,
+ Column('id', Integer, primary_key=True),
+ Column('name', String(50), unique=True),
+ Column('email', String(120), unique=True)
+ )
+ mapper(User, users)
+
+Querying and inserting works exactly the same as in the example above.
+
+
+SQL Abstraction Layer
+---------------------
+
+If you just want to use the database system (and SQL) abstraction layer
+you basically only need the engine::
+
+ from sqlalchemy import create_engine, MetaData
+
+ engine = create_engine('sqlite:////tmp/test.db', convert_unicode=True)
+ metadata = MetaData(bind=engine)
+
+Then you can either declare the tables in your code like in the examples
+above, or automatically load them::
+
+ users = Table('users', metadata, autoload=True)
+
+To insert data you can use the `insert` method. We have to get a
+connection first so that we can use a transaction:
+
+>>> con = engine.connect()
+>>> con.execute(users.insert(name='admin', email='admin@localhost'))
+
+SQLAlchemy will automatically commit for us.
+
+To query your database, you use the engine directly or use a connection:
+
+>>> users.select(users.c.id == 1).execute().first()
+(1, u'admin', u'admin@localhost')
+
+These results are also dict-like tuples:
+
+>>> r = users.select(users.c.id == 1).execute().first()
+>>> r['name']
+u'admin'
+
+You can also pass strings of SQL statements to the
+:meth:`~sqlalchemy.engine.base.Connection.execute` method:
+
+>>> engine.execute('select * from users where id = :1', [1]).first()
+(1, u'admin', u'admin@localhost')
+
+For more information about SQLAlchemy, head over to the
+`website <http://sqlalchemy.org/>`_.
diff --git a/app/static/doc/flask-docs/_sources/patterns/sqlite3.txt b/app/static/doc/flask-docs/_sources/patterns/sqlite3.txt
new file mode 100644
index 0000000..0d02e46
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/patterns/sqlite3.txt
@@ -0,0 +1,119 @@
+.. _sqlite3:
+
+Using SQLite 3 with Flask
+=========================
+
+In Flask you can implement the opening of database connections at the
+beginning of the request and closing at the end with the
+:meth:`~flask.Flask.before_request` and :meth:`~flask.Flask.teardown_request`
+decorators in combination with the special :class:`~flask.g` object.
+
+So here is a simple example of how you can use SQLite 3 with Flask::
+
+ import sqlite3
+ from flask import g
+
+ DATABASE = '/path/to/database.db'
+
+ def connect_db():
+ return sqlite3.connect(DATABASE)
+
+ @app.before_request
+ def before_request():
+ g.db = connect_db()
+
+ @app.teardown_request
+ def teardown_request(exception):
+ if hasattr(g, 'db'):
+ g.db.close()
+
+.. note::
+
+ Please keep in mind that the teardown request functions are always
+ executed, even if a before-request handler failed or was never
+ executed. Because of this we have to make sure here that the database
+ is there before we close it.
+
+Connect on Demand
+-----------------
+
+The downside of this approach is that this will only work if Flask
+executed the before-request handlers for you. If you are attempting to
+use the database from a script or the interactive Python shell you would
+have to do something like this::
+
+ with app.test_request_context():
+ app.preprocess_request()
+ # now you can use the g.db object
+
+In order to trigger the execution of the connection code. You won't be
+able to drop the dependency on the request context this way, but you could
+make it so that the application connects when necessary::
+
+ def get_connection():
+ db = getattr(g, '_db', None)
+ if db is None:
+ db = g._db = connect_db()
+ return db
+
+Downside here is that you have to use ``db = get_connection()`` instead of
+just being able to use ``g.db`` directly.
+
+.. _easy-querying:
+
+Easy Querying
+-------------
+
+Now in each request handling function you can access `g.db` to get the
+current open database connection. To simplify working with SQLite, a
+helper function can be useful::
+
+ def query_db(query, args=(), one=False):
+ cur = g.db.execute(query, args)
+ rv = [dict((cur.description[idx][0], value)
+ for idx, value in enumerate(row)) for row in cur.fetchall()]
+ return (rv[0] if rv else None) if one else rv
+
+This handy little function makes working with the database much more
+pleasant than it is by just using the raw cursor and connection objects.
+
+Here is how you can use it::
+
+ for user in query_db('select * from users'):
+ print user['username'], 'has the id', user['user_id']
+
+Or if you just want a single result::
+
+ user = query_db('select * from users where username = ?',
+ [the_username], one=True)
+ if user is None:
+ print 'No such user'
+ else:
+ print the_username, 'has the id', user['user_id']
+
+To pass variable parts to the SQL statement, use a question mark in the
+statement and pass in the arguments as a list. Never directly add them to
+the SQL statement with string formatting because this makes it possible
+to attack the application using `SQL Injections
+<http://en.wikipedia.org/wiki/SQL_injection>`_.
+
+Initial Schemas
+---------------
+
+Relational databases need schemas, so applications often ship a
+`schema.sql` file that creates the database. It's a good idea to provide
+a function that creates the database based on that schema. This function
+can do that for you::
+
+ from contextlib import closing
+
+ def init_db():
+ with closing(connect_db()) as db:
+ with app.open_resource('schema.sql') as f:
+ db.cursor().executescript(f.read())
+ db.commit()
+
+You can then create such a database from the python shell:
+
+>>> from yourapplication import init_db
+>>> init_db()
diff --git a/app/static/doc/flask-docs/_sources/patterns/streaming.txt b/app/static/doc/flask-docs/_sources/patterns/streaming.txt
new file mode 100644
index 0000000..8393b00
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/patterns/streaming.txt
@@ -0,0 +1,61 @@
+Streaming Contents
+==================
+
+Sometimes you want to send an enormous amount of data to the client, much
+more than you want to keep in memory. When you are generating the data on
+the fly though, how do you send that back to the client without the
+roundtrip to the filesystem?
+
+The answer is by using generators and direct responses.
+
+Basic Usage
+-----------
+
+This is a basic view function that generates a lot of CSV data on the fly.
+The trick is to have an inner function that uses a generator to generate
+data and to then invoke that function and pass it to a response object::
+
+ from flask import Response
+
+ @app.route('/large.csv')
+ def generate_large_csv():
+ def generate():
+ for row in iter_all_rows():
+ yield ','.join(row) + '\n'
+ return Response(generate(), mimetype='text/csv')
+
+Each ``yield`` expression is directly sent to the browser. Now though
+that some WSGI middlewares might break streaming, so be careful there in
+debug environments with profilers and other things you might have enabled.
+
+Streaming from Templates
+------------------------
+
+The Jinja2 template engine also supports rendering templates piece by
+piece. This functionality is not directly exposed by Flask because it is
+quite uncommon, but you can easily do it yourself::
+
+ from flask import Response
+
+ def stream_template(template_name, **context):
+ app.update_template_context(context)
+ t = app.jinja_env.get_template(template_name)
+ rv = t.stream(context)
+ rv.enable_buffering(5)
+ return rv
+
+ @app.route('/my-large-page.html')
+ def render_large_template():
+ rows = iter_all_rows()
+ return Response(stream_template('the_template.html', rows=rows))
+
+The trick here is to get the template object from the Jinja2 environment
+on the application and to call :meth:`~jinja2.Template.stream` instead of
+:meth:`~jinja2.Template.render` which returns a stream object instead of a
+string. Since we're bypassing the Flask template render functions and
+using the template object itself we have to make sure to update the render
+context ourselves by calling :meth:`~flask.Flask.update_template_context`.
+The template is then evaluated as the stream is iterated over. Since each
+time you do a yield the server will flush the content to the client you
+might want to buffer up a few items in the template which you can do with
+``rv.enable_buffering(size)``. ``5`` is a sane default.
diff --git a/app/static/doc/flask-docs/_sources/patterns/templateinheritance.txt b/app/static/doc/flask-docs/_sources/patterns/templateinheritance.txt
new file mode 100644
index 0000000..70015ec
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/patterns/templateinheritance.txt
@@ -0,0 +1,69 @@
+.. _template-inheritance:
+
+Template Inheritance
+====================
+
+The most powerful part of Jinja is template inheritance. Template inheritance
+allows you to build a base "skeleton" template that contains all the common
+elements of your site and defines **blocks** that child templates can override.
+
+Sounds complicated but is very basic. It's easiest to understand it by starting
+with an example.
+
+
+Base Template
+-------------
+
+This template, which we'll call ``layout.html``, defines a simple HTML skeleton
+document that you might use for a simple two-column page. It's the job of
+"child" templates to fill the empty blocks with content:
+
+.. sourcecode:: html+jinja
+
+ <!doctype html>
+ <html>
+ <head>
+ {% block head %}
+ <link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
+ <title>{% block title %}{% endblock %} - My Webpage</title>
+ {% endblock %}
+ </head>
+ <body>
+ <div id="content">{% block content %}{% endblock %}</div>
+ <div id="footer">
+ {% block footer %}
+ &copy; Copyright 2010 by <a href="http://domain.invalid/">you</a>.
+ {% endblock %}
+ </div>
+ </body>
+
+In this example, the ``{% block %}`` tags define four blocks that child templates
+can fill in. All the `block` tag does is tell the template engine that a
+child template may override those portions of the template.
+
+Child Template
+--------------
+
+A child template might look like this:
+
+.. sourcecode:: html+jinja
+
+ {% extends "layout.html" %}
+ {% block title %}Index{% endblock %}
+ {% block head %}
+ {{ super() }}
+ <style type="text/css">
+ .important { color: #336699; }
+ </style>
+ {% endblock %}
+ {% block content %}
+ <h1>Index</h1>
+ <p class="important">
+ Welcome on my awesome homepage.
+ {% endblock %}
+
+The ``{% extends %}`` tag is the key here. It tells the template engine that
+this template "extends" another template. When the template system evaluates
+this template, first it locates the parent. The extends tag must be the
+first tag in the template. To render the contents of a block defined in
+the parent template, use ``{{ super() }}``.
diff --git a/app/static/doc/flask-docs/_sources/patterns/urlprocessors.txt b/app/static/doc/flask-docs/_sources/patterns/urlprocessors.txt
new file mode 100644
index 0000000..778a5a6
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/patterns/urlprocessors.txt
@@ -0,0 +1,126 @@
+Using URL Processors
+====================
+
+.. versionadded:: 0.7
+
+Flask 0.7 introduces the concept of URL processors. The idea is that you
+might have a bunch of resources with common parts in the URL that you
+don't always explicitly want to provide. For instance you might have a
+bunch of URLs that have the language code in it but you don't want to have
+to handle it in every single function yourself.
+
+URL processors are especially helpful when combined with blueprints. We
+will handle both application specific URL processors here as well as
+blueprint specifics.
+
+Internationalized Application URLs
+----------------------------------
+
+Consider an application like this::
+
+ from flask import Flask, g
+
+ app = Flask(__name__)
+
+ @app.route('/<lang_code>/')
+ def index(lang_code):
+ g.lang_code = lang_code
+ ...
+
+ @app.route('/<lang_code>/about')
+ def about(lang_code):
+ g.lang_code = lang_code
+ ...
+
+This is an awful lot of repetition as you have to handle the language code
+setting on the :data:`~flask.g` object yourself in every single function.
+Sure, a decorator could be used to simplify this, but if you want to
+generate URLs from one function to another you would have to still provide
+the language code explicitly which can be annoying.
+
+For the latter, this is where :func:`~flask.Flask.url_defaults` functions
+come in. They can automatically inject values into a call for
+:func:`~flask.url_for` automatically. The code below checks if the
+language code is not yet in the dictionary of URL values and if the
+endpoint wants a value named ``'lang_code'``::
+
+ @app.url_defaults
+ def add_language_code(endpoint, values):
+ if 'lang_code' in values or not g.lang_code:
+ return
+ if app.url_map.is_endpoint_expecting(endpoint, 'lang_code'):
+ values['lang_code'] = g.lang_code
+
+The method :meth:`~werkzeug.routing.Map.is_endpoint_expecting` of the URL
+map can be used to figure out if it would make sense to provide a language
+code for the given endpoint.
+
+The reverse of that function are
+:meth:`~flask.Flask.url_value_preprocessor`\s. They are executed right
+after the request was matched and can execute code based on the URL
+values. The idea is that they pull information out of the values
+dictionary and put it somewhere else::
+
+ @app.url_value_preprocessor
+ def pull_lang_code(endpoint, values):
+ g.lang_code = values.pop('lang_code', None)
+
+That way you no longer have to do the `lang_code` assigment to
+:data:`~flask.g` in every function. You can further improve that by
+writing your own decorator that prefixes URLs with the language code, but
+the more beautiful solution is using a blueprint. Once the
+``'lang_code'`` is popped from the values dictionary and it will no longer
+be forwarded to the view function reducing the code to this::
+
+ from flask import Flask, g
+
+ app = Flask(__name__)
+
+ @app.url_defaults
+ def add_language_code(endpoint, values):
+ if 'lang_code' in values or not g.lang_code:
+ return
+ if app.url_map.is_endpoint_expecting(endpoint, 'lang_code'):
+ values['lang_code'] = g.lang_code
+
+ @app.url_value_preprocessor
+ def pull_lang_code(endpoint, values):
+ g.lang_code = values.pop('lang_code', None)
+
+ @app.route('/<lang_code>/')
+ def index():
+ ...
+
+ @app.route('/<lang_code>/about')
+ def about():
+ ...
+
+Internationalized Blueprint URLs
+--------------------------------
+
+Because blueprints can automatically prefix all URLs with a common string
+it's easy to automatically do that for every function. Furthermore
+blueprints can have per-blueprint URL processors which removes a whole lot
+of logic from the :meth:`~flask.Flask.url_defaults` function because it no
+longer has to check if the URL is really interested in a ``'lang_code'``
+parameter::
+
+ from flask import Blueprint, g
+
+ bp = Blueprint('frontend', __name__, url_prefix='/<lang_code>')
+
+ @bp.url_defaults
+ def add_language_code(endpoint, values):
+ values.setdefault('lang_code', g.lang_code)
+
+ @bp.url_value_preprocessor
+ def pull_lang_code(endpoint, values):
+ g.lang_code = values.pop('lang_code')
+
+ @bp.route('/')
+ def index():
+ ...
+
+ @bp.route('/about')
+ def about():
+ ...
diff --git a/app/static/doc/flask-docs/_sources/patterns/viewdecorators.txt b/app/static/doc/flask-docs/_sources/patterns/viewdecorators.txt
new file mode 100644
index 0000000..a094857
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/patterns/viewdecorators.txt
@@ -0,0 +1,168 @@
+View Decorators
+===============
+
+Python has a really interesting feature called function decorators. This
+allow some really neat things for web applications. Because each view in
+Flask is a function decorators can be used to inject additional
+functionality to one or more functions. The :meth:`~flask.Flask.route`
+decorator is the one you probably used already. But there are use cases
+for implementing your own decorator. For instance, imagine you have a
+view that should only be used by people that are logged in to. If a user
+goes to the site and is not logged in, they should be redirected to the
+login page. This is a good example of a use case where a decorator is an
+excellent solution.
+
+Login Required Decorator
+------------------------
+
+So let's implement such a decorator. A decorator is a function that
+returns a function. Pretty simple actually. The only thing you have to
+keep in mind when implementing something like this is to update the
+`__name__`, `__module__` and some other attributes of a function. This is
+often forgotten, but you don't have to do that by hand, there is a
+function for that that is used like a decorator (:func:`functools.wraps`).
+
+This example assumes that the login page is called ``'login'`` and that
+the current user is stored as `g.user` and `None` if there is no-one
+logged in::
+
+ from functools import wraps
+ from flask import g, request, redirect, url_for
+
+ def login_required(f):
+ @wraps(f)
+ def decorated_function(*args, **kwargs):
+ if g.user is None:
+ return redirect(url_for('login', next=request.url))
+ return f(*args, **kwargs)
+ return decorated_function
+
+So how would you use that decorator now? Apply it as innermost decorator
+to a view function. When applying further decorators, always remember
+that the :meth:`~flask.Flask.route` decorator is the outermost::
+
+ @app.route('/secret_page')
+ @login_required
+ def secret_page():
+ pass
+
+Caching Decorator
+-----------------
+
+Imagine you have a view function that does an expensive calculation and
+because of that you would like to cache the generated results for a
+certain amount of time. A decorator would be nice for that. We're
+assuming you have set up a cache like mentioned in :ref:`caching-pattern`.
+
+Here an example cache function. It generates the cache key from a
+specific prefix (actually a format string) and the current path of the
+request. Notice that we are using a function that first creates the
+decorator that then decorates the function. Sounds awful? Unfortunately
+it is a little bit more complex, but the code should still be
+straightforward to read.
+
+The decorated function will then work as follows
+
+1. get the unique cache key for the current request base on the current
+ path.
+2. get the value for that key from the cache. If the cache returned
+ something we will return that value.
+3. otherwise the original function is called and the return value is
+ stored in the cache for the timeout provided (by default 5 minutes).
+
+Here the code::
+
+ from functools import wraps
+ from flask import request
+
+ def cached(timeout=5 * 60, key='view/%s'):
+ def decorator(f):
+ @wraps(f)
+ def decorated_function(*args, **kwargs):
+ cache_key = key % request.path
+ rv = cache.get(cache_key)
+ if rv is not None:
+ return rv
+ rv = f(*args, **kwargs)
+ cache.set(cache_key, rv, timeout=timeout)
+ return rv
+ return decorated_function
+ return decorator
+
+Notice that this assumes an instantiated `cache` object is available, see
+:ref:`caching-pattern` for more information.
+
+
+Templating Decorator
+--------------------
+
+A common pattern invented by the TurboGears guys a while back is a
+templating decorator. The idea of that decorator is that you return a
+dictionary with the values passed to the template from the view function
+and the template is automatically rendered. With that, the following
+three examples do exactly the same::
+
+ @app.route('/')
+ def index():
+ return render_template('index.html', value=42)
+
+ @app.route('/')
+ @templated('index.html')
+ def index():
+ return dict(value=42)
+
+ @app.route('/')
+ @templated()
+ def index():
+ return dict(value=42)
+
+As you can see, if no template name is provided it will use the endpoint
+of the URL map with dots converted to slashes + ``'.html'``. Otherwise
+the provided template name is used. When the decorated function returns,
+the dictionary returned is passed to the template rendering function. If
+`None` is returned, an empty dictionary is assumed, if something else than
+a dictionary is returned we return it from the function unchanged. That
+way you can still use the redirect function or return simple strings.
+
+Here the code for that decorator::
+
+ from functools import wraps
+ from flask import request
+
+ def templated(template=None):
+ def decorator(f):
+ @wraps(f)
+ def decorated_function(*args, **kwargs):
+ template_name = template
+ if template_name is None:
+ template_name = request.endpoint \
+ .replace('.', '/') + '.html'
+ ctx = f(*args, **kwargs)
+ if ctx is None:
+ ctx = {}
+ elif not isinstance(ctx, dict):
+ return ctx
+ return render_template(template_name, **ctx)
+ return decorated_function
+ return decorator
+
+
+Endpoint Decorator
+------------------
+
+When you want to use the werkzeug routing system for more flexibility you
+need to map the endpoint as defined in the :class:`~werkzeug.routing.Rule`
+to a view function. This is possible with this decorator. For example::
+
+ from flask import Flask
+ from werkzeug.routing import Rule
+
+ app = Flask(__name__)
+ app.url_map.add(Rule('/', endpoint='index'))
+
+ @app.endpoint('index')
+ def my_index():
+ return "Hello world"
+
+
+
diff --git a/app/static/doc/flask-docs/_sources/patterns/wtforms.txt b/app/static/doc/flask-docs/_sources/patterns/wtforms.txt
new file mode 100644
index 0000000..93824df
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/patterns/wtforms.txt
@@ -0,0 +1,124 @@
+Form Validation with WTForms
+============================
+
+When you have to work with form data submitted by a browser view code
+quickly becomes very hard to read. There are libraries out there designed
+to make this process easier to manage. One of them is `WTForms`_ which we
+will handle here. If you find yourself in the situation of having many
+forms, you might want to give it a try.
+
+When you are working with WTForms you have to define your forms as classes
+first. I recommend breaking up the application into multiple modules
+(:ref:`larger-applications`) for that and adding a separate module for the
+forms.
+
+.. admonition:: Getting most of WTForms with an Extension
+
+ The `Flask-WTF`_ extension expands on this pattern and adds a few
+ handful little helpers that make working with forms and Flask more
+ fun. You can get it from `PyPI
+ <http://pypi.python.org/pypi/Flask-WTF>`_.
+
+.. _Flask-WTF: http://packages.python.org/Flask-WTF/
+
+The Forms
+---------
+
+This is an example form for a typical registration page::
+
+ from wtforms import Form, BooleanField, TextField, validators
+
+ class RegistrationForm(Form):
+ username = TextField('Username', [validators.Length(min=4, max=25)])
+ email = TextField('Email Address', [validators.Length(min=6, max=35)])
+ password = PasswordField('New Password', [
+ validators.Required(),
+ validators.EqualTo('confirm', message='Passwords must match')
+ ])
+ confirm = PasswordField('Repeat Password')
+ accept_tos = BooleanField('I accept the TOS', [validators.Required()])
+
+In the View
+-----------
+
+In the view function, the usage of this form looks like this::
+
+ @app.route('/register', methods=['GET', 'POST'])
+ def register():
+ form = RegistrationForm(request.form)
+ if request.method == 'POST' and form.validate():
+ user = User(form.username.data, form.email.data,
+ form.password.data)
+ db_session.add(user)
+ flash('Thanks for registering')
+ return redirect(url_for('login'))
+ return render_template('register.html', form=form)
+
+Notice that we are implying that the view is using SQLAlchemy here
+(:ref:`sqlalchemy-pattern`) but this is no requirement of course. Adapt
+the code as necessary.
+
+Things to remember:
+
+1. create the form from the request :attr:`~flask.request.form` value if
+ the data is submitted via the HTTP `POST` method and
+ :attr:`~flask.request.args` if the data is submitted as `GET`.
+2. to validate the data, call the :func:`~wtforms.form.Form.validate`
+ method which will return `True` if the data validates, `False`
+ otherwise.
+3. to access individual values from the form, access `form.<NAME>.data`.
+
+Forms in Templates
+------------------
+
+Now to the template side. When you pass the form to the templates you can
+easily render them there. Look at the following example template to see
+how easy this is. WTForms does half the form generation for us already.
+To make it even nicer, we can write a macro that renders a field with
+label and a list of errors if there are any.
+
+Here's an example `_formhelpers.html` template with such a macro:
+
+.. sourcecode:: html+jinja
+
+ {% macro render_field(field) %}
+ <dt>{{ field.label }}
+ <dd>{{ field(**kwargs)|safe }}
+ {% if field.errors %}
+ <ul class="errors">
+ {% for error in field.errors %}<li>{{ error }}{% endfor %}
+ </ul>
+ {% endif %}
+ </dd>
+ {% endmacro %}
+
+This macro accepts a couple of keyword arguments that are forwarded to
+WTForm's field function that renders the field for us. The keyword
+arguments will be inserted as HTML attributes. So for example you can
+call ``render_field(form.username, class='username')`` to add a class to
+the input element. Note that WTForms returns standard Python unicode
+strings, so we have to tell Jinja2 that this data is already HTML escaped
+with the `|safe` filter.
+
+Here the `register.html` template for the function we used above which
+takes advantage of the `_formhelpers.html` template:
+
+.. sourcecode:: html+jinja
+
+ {% from "_formhelpers.html" import render_field %}
+ <form method="post" action="/register">
+ <dl>
+ {{ render_field(form.username) }}
+ {{ render_field(form.email) }}
+ {{ render_field(form.password) }}
+ {{ render_field(form.confirm) }}
+ {{ render_field(form.accept_tos) }}
+ </dl>
+ <p><input type=submit value=Register>
+ </form>
+
+For more information about WTForms, head over to the `WTForms
+website`_.
+
+.. _WTForms: http://wtforms.simplecodes.com/
+.. _WTForms website: http://wtforms.simplecodes.com/
diff --git a/app/static/doc/flask-docs/_sources/quickstart.txt b/app/static/doc/flask-docs/_sources/quickstart.txt
new file mode 100644
index 0000000..34aa3be
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/quickstart.txt
@@ -0,0 +1,824 @@
+.. _quickstart:
+
+Quickstart
+==========
+
+Eager to get started? This page gives a good introduction in how to get
+started with Flask. This assumes you already have Flask installed. If
+you do not, head over to the :ref:`installation` section.
+
+
+A Minimal Application
+---------------------
+
+A minimal Flask application looks something like this::
+
+ from flask import Flask
+ app = Flask(__name__)
+
+ @app.route('/')
+ def hello_world():
+ return 'Hello World!'
+
+ if __name__ == '__main__':
+ app.run()
+
+Just save it as `hello.py` or something similar and run it with your
+Python interpreter. Make sure to not call your application `flask.py`
+because this would conflict with Flask itself.
+
+::
+
+ $ python hello.py
+ * Running on http://127.0.0.1:5000/
+
+Head over to `http://127.0.0.1:5000/ <http://127.0.0.1:5000/>`_, you should
+see your hello world greeting.
+
+So what did that code do?
+
+1. First we imported the :class:`~flask.Flask` class. An instance of this
+ class will be our WSGI application. The first argument is the name of
+ the application's module. If you are using a single module (like here)
+ you should use `__name__` because depending on if it's started as
+ application or imported as module the name will be different
+ (``'__main__'`` versus the actual import name). For more information
+ on that, have a look at the :class:`~flask.Flask` documentation.
+2. Next we create an instance of it. We pass it the name of the module /
+ package. This is needed so that Flask knows where it should look for
+ templates, static files and so on.
+3. Then we use the :meth:`~flask.Flask.route` decorator to tell Flask
+ what URL should trigger our function.
+4. The function then has a name which is also used to generate URLs to
+ that particular function, and returns the message we want to display in
+ the user's browser.
+5. Finally we use the :meth:`~flask.Flask.run` function to run the
+ local server with our application. The ``if __name__ == '__main__':``
+ makes sure the server only runs if the script is executed directly from
+ the Python interpreter and not used as imported module.
+
+To stop the server, hit control-C.
+
+.. _public-server:
+
+.. admonition:: Externally Visible Server
+
+ If you run the server you will notice that the server is only available
+ from your own computer, not from any other in the network. This is the
+ default because in debugging mode a user of the application can execute
+ arbitrary Python code on your computer. If you have `debug` disabled
+ or trust the users on your network, you can make the server publicly
+ available.
+
+ Just change the call of the :meth:`~flask.Flask.run` method to look
+ like this::
+
+ app.run(host='0.0.0.0')
+
+ This tells your operating system to listen on a public IP.
+
+
+Debug Mode
+----------
+
+The :meth:`~flask.Flask.run` method is nice to start a local
+development server, but you would have to restart it manually after each
+change you do to code. That is not very nice and Flask can do better. If
+you enable the debug support the server will reload itself on code changes
+and also provide you with a helpful debugger if things go wrong.
+
+There are two ways to enable debugging. Either set that flag on the
+application object::
+
+ app.debug = True
+ app.run()
+
+Or pass it to run::
+
+ app.run(debug=True)
+
+Both will have exactly the same effect.
+
+.. admonition:: Attention
+
+ Even though the interactive debugger does not work in forking environments
+ (which makes it nearly impossible to use on production servers), it still
+ allows the execution of arbitrary code. That makes it a major security
+ risk and therefore it **must never be used on production machines**.
+
+Screenshot of the debugger in action:
+
+.. image:: _static/debugger.png
+ :align: center
+ :class: screenshot
+ :alt: screenshot of debugger in action
+
+.. admonition:: Working With Other Debuggers
+
+ Debuggers interfere with each other. If you are using another debugger
+ (e.g. PyDev or IntelliJ), you may need to set ``app.debug = False``.
+
+
+Routing
+-------
+
+Modern web applications have beautiful URLs. This helps people remember
+the URLs which is especially handy for applications that are used from
+mobile devices with slower network connections. If the user can directly
+go to the desired page without having to hit the index page it is more
+likely they will like the page and come back next time.
+
+As you have seen above, the :meth:`~flask.Flask.route` decorator is used
+to bind a function to a URL. Here are some basic examples::
+
+ @app.route('/')
+ def index():
+ return 'Index Page'
+
+ @app.route('/hello')
+ def hello():
+ return 'Hello World'
+
+But there is more to it! You can make certain parts of the URL dynamic
+and attach multiple rules to a function.
+
+Variable Rules
+``````````````
+
+To add variable parts to a URL you can mark these special sections as
+``<variable_name>``. Such a part is then passed as keyword argument to
+your function. Optionally a converter can be specified by specifying a
+rule with ``<converter:variable_name>``. Here are some nice examples::
+
+ @app.route('/user/<username>')
+ def show_user_profile(username):
+ # show the user profile for that user
+ pass
+
+ @app.route('/post/<int:post_id>')
+ def show_post(post_id):
+ # show the post with the given id, the id is an integer
+ pass
+
+The following converters exist:
+
+=========== ===========================================
+`int` accepts integers
+`float` like `int` but for floating point values
+`path` like the default but also accepts slashes
+=========== ===========================================
+
+.. admonition:: Unique URLs / Redirection Behaviour
+
+ Flask's URL rules are based on Werkzeug's routing module. The idea
+ behind that module is to ensure nice looking and also unique URLs based
+ on behaviour Apache and earlier servers coined.
+
+ Take these two rules::
+
+ @app.route('/projects/')
+ def projects():
+ pass
+
+ @app.route('/about')
+ def about():
+ pass
+
+ They look rather similar, the difference is the trailing slash in the
+ URL *definition*. In the first case, the canonical URL for the
+ `projects` endpoint has a trailing slash. It's similar to a folder in
+ that sense. Accessing it without a trailing slash will cause Flask to
+ redirect to the canonical URL with the trailing slash.
+
+ However in the second case the URL is defined without a slash so it
+ behaves similar to a file and accessing the URL with a trailing slash
+ will be a 404 error.
+
+ Why is this? This allows relative URLs to continue working if users
+ access the page when they forget a trailing slash. This behaviour is
+ also consistent with how Apache and other servers work. Also, the URLs
+ will stay unique which helps search engines not indexing the same page
+ twice.
+
+
+.. _url-building:
+
+URL Building
+````````````
+
+If it can match URLs, can it also generate them? Of course it can. To
+build a URL to a specific function you can use the :func:`~flask.url_for`
+function. It accepts the name of the function as first argument and a
+number of keyword arguments, each corresponding to the variable part of
+the URL rule. Unknown variable parts are appended to the URL as query
+parameter. Here are some examples:
+
+>>> from flask import Flask, url_for
+>>> app = Flask(__name__)
+>>> @app.route('/')
+... def index(): pass
+...
+>>> @app.route('/login')
+... def login(): pass
+...
+>>> @app.route('/user/<username>')
+... def profile(username): pass
+...
+>>> with app.test_request_context():
+... print url_for('index')
+... print url_for('login')
+... print url_for('login', next='/')
+... print url_for('profile', username='John Doe')
+...
+/
+/login
+/login?next=/
+/user/John%20Doe
+
+(This also uses the :meth:`~flask.Flask.test_request_context` method
+explained below. It basically tells Flask to think we are handling a
+request even though we are not, we are in an interactive Python shell.
+Have a look at the explanation below. :ref:`context-locals`).
+
+Why would you want to build URLs instead of hardcoding them in your
+templates? There are three good reasons for this:
+
+1. reversing is often more descriptive than hardcoding the URLs. Also and
+ more importantly you can change URLs in one go without having to change
+ the URLs all over the place.
+2. URL building will handle escaping of special characters and Unicode
+ data transparently for you, you don't have to deal with that.
+3. If your application is placed outside the URL root (so say in
+ ``/myapplication`` instead of ``/``), :func:`~flask.url_for` will
+ handle that properly for you.
+
+
+HTTP Methods
+````````````
+
+HTTP (the protocol web applications are speaking) knows different methods
+to access URLs. By default a route only answers to `GET` requests, but
+that can be changed by providing the `methods` argument to the
+:meth:`~flask.Flask.route` decorator. Here are some examples::
+
+ @app.route('/login', methods=['GET', 'POST'])
+ def login():
+ if request.method == 'POST':
+ do_the_login()
+ else:
+ show_the_login_form()
+
+If `GET` is present, `HEAD` will be added automatically for you. You
+don't have to deal with that. It will also make sure that `HEAD` requests
+are handled like the `HTTP RFC`_ (the document describing the HTTP
+protocol) demands, so you can completely ignore that part of the HTTP
+specification. Likewise as of Flask 0.6, `OPTIONS` is implemented for you
+as well automatically.
+
+You have no idea what an HTTP method is? Worry not, here is a quick
+introduction to HTTP methods and why they matter:
+
+The HTTP method (also often called "the verb") tells the server what the
+clients wants to *do* with the requested page. The following methods are
+very common:
+
+`GET`
+ The browser tells the server to just *get* the information stored on
+ that page and send it. This is probably the most common method.
+
+`HEAD`
+ The browser tells the server to get the information, but it is only
+ interested in the *headers*, not the content of the page. An
+ application is supposed to handle that as if a `GET` request was
+ received but to not deliver the actual content. In Flask you don't
+ have to deal with that at all, the underlying Werkzeug library handles
+ that for you.
+
+`POST`
+ The browser tells the server that it wants to *post* some new
+ information to that URL and that the server must ensure the data is
+ stored and only stored once. This is how HTML forms are usually
+ transmitting data to the server.
+
+`PUT`
+ Similar to `POST` but the server might trigger the store procedure
+ multiple times by overwriting the old values more than once. Now you
+ might be asking why is this useful, but there are some good reasons
+ to do it this way. Consider that the connection gets lost during
+ transmission: in this situation a system between the browser and the
+ server might receive the request safely a second time without breaking
+ things. With `POST` that would not be possible because it must only
+ be triggered once.
+
+`DELETE`
+ Remove the information at the given location.
+
+`OPTIONS`
+ Provides a quick way for a client to figure out which methods are
+ supported by this URL. Starting with Flask 0.6, this is implemented
+ for you automatically.
+
+Now the interesting part is that in HTML4 and XHTML1, the only methods a
+form can submit to the server are `GET` and `POST`. But with JavaScript
+and future HTML standards you can use the other methods as well. Furthermore
+HTTP has become quite popular lately and browsers are no longer the only
+clients that are using HTTP. For instance, many revision control system
+use it.
+
+.. _HTTP RFC: http://www.ietf.org/rfc/rfc2068.txt
+
+Static Files
+------------
+
+Dynamic web applications need static files as well. That's usually where
+the CSS and JavaScript files are coming from. Ideally your web server is
+configured to serve them for you, but during development Flask can do that
+as well. Just create a folder called `static` in your package or next to
+your module and it will be available at `/static` on the application.
+
+To generate URLs to that part of the URL, use the special ``'static'`` URL
+name::
+
+ url_for('static', filename='style.css')
+
+The file has to be stored on the filesystem as ``static/style.css``.
+
+Rendering Templates
+-------------------
+
+Generating HTML from within Python is not fun, and actually pretty
+cumbersome because you have to do the HTML escaping on your own to keep
+the application secure. Because of that Flask configures the `Jinja2
+<http://jinja.pocoo.org/2/>`_ template engine for you automatically.
+
+To render a template you can use the :func:`~flask.render_template`
+method. All you have to do is to provide the name of the template and the
+variables you want to pass to the template engine as keyword arguments.
+Here's a simple example of how to render a template::
+
+ from flask import render_template
+
+ @app.route('/hello/')
+ @app.route('/hello/<name>')
+ def hello(name=None):
+ return render_template('hello.html', name=name)
+
+Flask will look for templates in the `templates` folder. So if your
+application is a module, that folder is next to that module, if it's a
+package it's actually inside your package:
+
+**Case 1**: a module::
+
+ /application.py
+ /templates
+ /hello.html
+
+**Case 2**: a package::
+
+ /application
+ /__init__.py
+ /templates
+ /hello.html
+
+For templates you can use the full power of Jinja2 templates. Head over
+to the the official `Jinja2 Template Documentation
+<http://jinja.pocoo.org/2/documentation/templates>`_ for more information.
+
+Here is an example template:
+
+.. sourcecode:: html+jinja
+
+ <!doctype html>
+ <title>Hello from Flask</title>
+ {% if name %}
+ <h1>Hello {{ name }}!</h1>
+ {% else %}
+ <h1>Hello World!</h1>
+ {% endif %}
+
+Inside templates you also have access to the :class:`~flask.request`,
+:class:`~flask.session` and :class:`~flask.g` [#]_ objects
+as well as the :func:`~flask.get_flashed_messages` function.
+
+Templates are especially useful if inheritance is used. If you want to
+know how that works, head over to the :ref:`template-inheritance` pattern
+documentation. Basically template inheritance makes it possible to keep
+certain elements on each page (like header, navigation and footer).
+
+Automatic escaping is enabled, so if name contains HTML it will be escaped
+automatically. If you can trust a variable and you know that it will be
+safe HTML (because for example it came from a module that converts wiki
+markup to HTML) you can mark it as safe by using the
+:class:`~jinja2.Markup` class or by using the ``|safe`` filter in the
+template. Head over to the Jinja 2 documentation for more examples.
+
+Here is a basic introduction to how the :class:`~jinja2.Markup` class works:
+
+>>> from flask import Markup
+>>> Markup('<strong>Hello %s!</strong>') % '<blink>hacker</blink>'
+Markup(u'<strong>Hello &lt;blink&gt;hacker&lt;/blink&gt;!</strong>')
+>>> Markup.escape('<blink>hacker</blink>')
+Markup(u'&lt;blink&gt;hacker&lt;/blink&gt;')
+>>> Markup('<em>Marked up</em> &raquo; HTML').striptags()
+u'Marked up \xbb HTML'
+
+.. versionchanged:: 0.5
+
+ Autoescaping is no longer enabled for all templates. The following
+ extensions for templates trigger autoescaping: ``.html``, ``.htm``,
+ ``.xml``, ``.xhtml``. Templates loaded from a string will have
+ autoescaping disabled.
+
+.. [#] Unsure what that :class:`~flask.g` object is? It's something in which
+ you can store information for your own needs, check the documentation of
+ that object (:class:`~flask.g`) and the :ref:`sqlite3` for more
+ information.
+
+
+Accessing Request Data
+----------------------
+
+For web applications it's crucial to react to the data a client sent to
+the server. In Flask this information is provided by the global
+:class:`~flask.request` object. If you have some experience with Python
+you might be wondering how that object can be global and how Flask
+manages to still be threadsafe. The answer are context locals:
+
+
+.. _context-locals:
+
+Context Locals
+``````````````
+
+.. admonition:: Insider Information
+
+ If you want to understand how that works and how you can implement
+ tests with context locals, read this section, otherwise just skip it.
+
+Certain objects in Flask are global objects, but not of the usual kind.
+These objects are actually proxies to objects that are local to a specific
+context. What a mouthful. But that is actually quite easy to understand.
+
+Imagine the context being the handling thread. A request comes in and the
+webserver decides to spawn a new thread (or something else, the
+underlying object is capable of dealing with other concurrency systems
+than threads as well). When Flask starts its internal request handling it
+figures out that the current thread is the active context and binds the
+current application and the WSGI environments to that context (thread).
+It does that in an intelligent way that one application can invoke another
+application without breaking.
+
+So what does this mean to you? Basically you can completely ignore that
+this is the case unless you are doing something like unittesting. You
+will notice that code that depends on a request object will suddenly break
+because there is no request object. The solution is creating a request
+object yourself and binding it to the context. The easiest solution for
+unittesting is by using the :meth:`~flask.Flask.test_request_context`
+context manager. In combination with the `with` statement it will bind a
+test request so that you can interact with it. Here is an example::
+
+ from flask import request
+
+ with app.test_request_context('/hello', method='POST'):
+ # now you can do something with the request until the
+ # end of the with block, such as basic assertions:
+ assert request.path == '/hello'
+ assert request.method == 'POST'
+
+The other possibility is passing a whole WSGI environment to the
+:meth:`~flask.Flask.request_context` method::
+
+ from flask import request
+
+ with app.request_context(environ):
+ assert request.method == 'POST'
+
+The Request Object
+``````````````````
+
+The request object is documented in the API section and we will not cover
+it here in detail (see :class:`~flask.request`). Here is a broad overview of
+some of the most common operations. First of all you have to import it from
+the `flask` module::
+
+ from flask import request
+
+The current request method is available by using the
+:attr:`~flask.request.method` attribute. To access form data (data
+transmitted in a `POST` or `PUT` request) you can use the
+:attr:`~flask.request.form` attribute. Here is a full example of the two
+attributes mentioned above::
+
+ @app.route('/login', methods=['POST', 'GET'])
+ def login():
+ error = None
+ if request.method == 'POST':
+ if valid_login(request.form['username'],
+ request.form['password']):
+ return log_the_user_in(request.form['username'])
+ else:
+ error = 'Invalid username/password'
+ # this is executed if the request method was GET or the
+ # credentials were invalid
+
+What happens if the key does not exist in the `form` attribute? In that
+case a special :exc:`KeyError` is raised. You can catch it like a
+standard :exc:`KeyError` but if you don't do that, a HTTP 400 Bad Request
+error page is shown instead. So for many situations you don't have to
+deal with that problem.
+
+To access parameters submitted in the URL (``?key=value``) you can use the
+:attr:`~flask.request.args` attribute::
+
+ searchword = request.args.get('q', '')
+
+We recommend accessing URL parameters with `get` or by catching the
+`KeyError` because users might change the URL and presenting them a 400
+bad request page in that case is not user friendly.
+
+For a full list of methods and attributes of the request object, head over
+to the :class:`~flask.request` documentation.
+
+
+File Uploads
+````````````
+
+You can handle uploaded files with Flask easily. Just make sure not to
+forget to set the ``enctype="multipart/form-data"`` attribute on your HTML
+form, otherwise the browser will not transmit your files at all.
+
+Uploaded files are stored in memory or at a temporary location on the
+filesystem. You can access those files by looking at the
+:attr:`~flask.request.files` attribute on the request object. Each
+uploaded file is stored in that dictionary. It behaves just like a
+standard Python :class:`file` object, but it also has a
+:meth:`~werkzeug.datastructures.FileStorage.save` method that allows you to store that
+file on the filesystem of the server. Here is a simple example showing how
+that works::
+
+ from flask import request
+
+ @app.route('/upload', methods=['GET', 'POST'])
+ def upload_file():
+ if request.method == 'POST':
+ f = request.files['the_file']
+ f.save('/var/www/uploads/uploaded_file.txt')
+ ...
+
+If you want to know how the file was named on the client before it was
+uploaded to your application, you can access the
+:attr:`~werkzeug.datastructures.FileStorage.filename` attribute. However please keep in
+mind that this value can be forged so never ever trust that value. If you
+want to use the filename of the client to store the file on the server,
+pass it through the :func:`~werkzeug.utils.secure_filename` function that
+Werkzeug provides for you::
+
+ from flask import request
+ from werkzeug import secure_filename
+
+ @app.route('/upload', methods=['GET', 'POST'])
+ def upload_file():
+ if request.method == 'POST':
+ f = request.files['the_file']
+ f.save('/var/www/uploads/' + secure_filename(f.filename))
+ ...
+
+For some better examples, checkout the :ref:`uploading-files` pattern.
+
+Cookies
+```````
+
+To access cookies you can use the :attr:`~flask.Request.cookies`
+attribute. To set cookies you can use the
+:attr:`~flask.Response.set_cookie` method of response objects. The
+:attr:`~flask.Request.cookies` attribute of request objects is a
+dictionary with all the cookies the client transmits. If you want to use
+sessions, do not use the cookies directly but instead use the
+:ref:`sessions` in Flask that add some security on top of cookies for you.
+
+Reading cookies::
+
+ from flask import request
+
+ @app.route('/')
+ def index():
+ username = request.cookies.get('username')
+ # use cookies.get(key) instead of cookies[key] to not get a
+ # KeyError if the cookie is missing.
+
+Storing cookies::
+
+ from flask import make_response
+
+ @app.route('/')
+ def index():
+ resp = make_response(render_template(...))
+ resp.set_cookie('username', 'the username')
+ return resp
+
+Note that cookies are set on response objects. Since you normally you
+just return strings from the view functions Flask will convert them into
+response objects for you. If you explicitly want to do that you can use
+the :meth:`~flask.make_response` function and then modify it.
+
+Sometimes you might want to set a cookie at a point where the response
+object does not exist yet. This is possible by utilizing the
+:ref:`deferred-callbacks` pattern.
+
+For this also see :ref:`about-responses`.
+
+Redirects and Errors
+--------------------
+
+To redirect a user to somewhere else you can use the
+:func:`~flask.redirect` function. To abort a request early with an error
+code use the :func:`~flask.abort` function. Here an example how this works::
+
+ from flask import abort, redirect, url_for
+
+ @app.route('/')
+ def index():
+ return redirect(url_for('login'))
+
+ @app.route('/login')
+ def login():
+ abort(401)
+ this_is_never_executed()
+
+This is a rather pointless example because a user will be redirected from
+the index to a page they cannot access (401 means access denied) but it
+shows how that works.
+
+By default a black and white error page is shown for each error code. If
+you want to customize the error page, you can use the
+:meth:`~flask.Flask.errorhandler` decorator::
+
+ from flask import render_template
+
+ @app.errorhandler(404)
+ def page_not_found(error):
+ return render_template('page_not_found.html'), 404
+
+Note the ``404`` after the :func:`~flask.render_template` call. This
+tells Flask that the status code of that page should be 404 which means
+not found. By default 200 is assumed which translates to: all went well.
+
+.. _about-responses:
+
+About Responses
+---------------
+
+The return value from a view function is automatically converted into a
+response object for you. If the return value is a string it's converted
+into a response object with the string as response body, an ``200 OK``
+error code and a ``text/html`` mimetype. The logic that Flask applies to
+converting return values into response objects is as follows:
+
+1. If a response object of the correct type is returned it's directly
+ returned from the view.
+2. If it's a string, a response object is created with that data and the
+ default parameters.
+3. If a tuple is returned the response object is created by passing the
+ tuple as arguments to the response object's constructor.
+4. If neither of that works, Flask will assume the return value is a
+ valid WSGI application and converts that into a response object.
+
+If you want to get hold of the resulting response object inside the view
+you can use the :func:`~flask.make_response` function.
+
+Imagine you have a view like this:
+
+.. sourcecode:: python
+
+ @app.errorhandler(404)
+ def not_found(error):
+ return render_template('error.html'), 404
+
+You just need to wrap the return expression with
+:func:`~flask.make_response` and get the result object to modify it, then
+return it:
+
+.. sourcecode:: python
+
+ @app.errorhandler(404)
+ def not_found(error):
+ resp = make_response(render_template('error.html'), 404)
+ resp.headers['X-Something'] = 'A value'
+ return resp
+
+.. _sessions:
+
+Sessions
+--------
+
+Besides the request object there is also a second object called
+:class:`~flask.session` that allows you to store information specific to a
+user from one request to the next. This is implemented on top of cookies
+for you and signs the cookies cryptographically. What this means is that
+the user could look at the contents of your cookie but not modify it,
+unless they know the secret key used for signing.
+
+In order to use sessions you have to set a secret key. Here is how
+sessions work::
+
+ from flask import Flask, session, redirect, url_for, escape, request
+
+ app = Flask(__name__)
+
+ @app.route('/')
+ def index():
+ if 'username' in session:
+ return 'Logged in as %s' % escape(session['username'])
+ return 'You are not logged in'
+
+ @app.route('/login', methods=['GET', 'POST'])
+ def login():
+ if request.method == 'POST':
+ session['username'] = request.form['username']
+ return redirect(url_for('index'))
+ return '''
+ <form action="" method="post">
+ <p><input type=text name=username>
+ <p><input type=submit value=Login>
+ </form>
+ '''
+
+ @app.route('/logout')
+ def logout():
+ # remove the username from the session if its there
+ session.pop('username', None)
+ return redirect(url_for('index'))
+
+ # set the secret key. keep this really secret:
+ app.secret_key = 'A0Zr98j/3yX R~XHH!jmN]LWX/,?RT'
+
+The here mentioned :func:`~flask.escape` does escaping for you if you are
+not using the template engine (like in this example).
+
+.. admonition:: How to generate good secret keys
+
+ The problem with random is that it's hard to judge what random is. And
+ a secret key should be as random as possible. Your operating system
+ has ways to generate pretty random stuff based on a cryptographic
+ random generator which can be used to get such a key:
+
+ >>> import os
+ >>> os.urandom(24)
+ '\xfd{H\xe5<\x95\xf9\xe3\x96.5\xd1\x01O<!\xd5\xa2\xa0\x9fR"\xa1\xa8'
+
+ Just take that thing and copy/paste it into your code and you're done.
+
+Message Flashing
+----------------
+
+Good applications and user interfaces are all about feedback. If the user
+does not get enough feedback they will probably end up hating the
+application. Flask provides a really simple way to give feedback to a
+user with the flashing system. The flashing system basically makes it
+possible to record a message at the end of a request and access it next
+request and only next request. This is usually combined with a layout
+template that does this.
+
+To flash a message use the :func:`~flask.flash` method, to get hold of the
+messages you can use :func:`~flask.get_flashed_messages` which is also
+available in the templates. Check out the :ref:`message-flashing-pattern`
+for a full example.
+
+Logging
+-------
+
+.. versionadded:: 0.3
+
+Sometimes you might be in a situation where you deal with data that
+should be correct, but actually is not. For example you may have some client
+side code that sends an HTTP request to the server but it's obviously
+malformed. This might be caused by a user tempering with the data, or the
+client code failing. Most of the time, it's okay to reply with ``400 Bad
+Request`` in that situation, but sometimes that won't do and the code has
+to continue working.
+
+You may still want to log that something fishy happened. This is where
+loggers come in handy. As of Flask 0.3 a logger is preconfigured for you
+to use.
+
+Here are some example log calls::
+
+ app.logger.debug('A value for debugging')
+ app.logger.warning('A warning occurred (%d apples)', 42)
+ app.logger.error('An error occurred')
+
+The attached :attr:`~flask.Flask.logger` is a standard logging
+:class:`~logging.Logger`, so head over to the official `logging
+documentation <http://docs.python.org/library/logging.html>`_ for more
+information.
+
+Hooking in WSGI Middlewares
+---------------------------
+
+If you want to add a WSGI middleware to your application you can wrap the
+internal WSGI application. For example if you want to use one of the
+middlewares from the Werkzeug package to work around bugs in lighttpd, you
+can do it like this::
+
+ from werkzeug.contrib.fixers import LighttpdCGIRootFix
+ app.wsgi_app = LighttpdCGIRootFix(app.wsgi_app)
diff --git a/app/static/doc/flask-docs/_sources/reqcontext.txt b/app/static/doc/flask-docs/_sources/reqcontext.txt
new file mode 100644
index 0000000..0249b88
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/reqcontext.txt
@@ -0,0 +1,239 @@
+.. _request-context:
+
+The Request Context
+===================
+
+This document describes the behavior in Flask 0.7 which is mostly in line
+with the old behavior but has some small, subtle differences.
+
+One of the design ideas behind Flask is that there are two different
+“states” in which code is executed. The application setup state in which
+the application implicitly is on the module level. It starts when the
+:class:`Flask` object is instantiated, and it implicitly ends when the
+first request comes in. While the application is in this state a few
+assumptions are true:
+
+- the programmer can modify the application object safely.
+- no request handling happened so far
+- you have to have a reference to the application object in order to
+ modify it, there is no magic proxy that can give you a reference to
+ the application object you're currently creating or modifying.
+
+On the contrast, during request handling, a couple of other rules exist:
+
+- while a request is active, the context local objects
+ (:data:`flask.request` and others) point to the current request.
+- any code can get hold of these objects at any time.
+
+The magic that makes this works is internally referred in Flask as the
+“request context”.
+
+Diving into Context Locals
+--------------------------
+
+Say you have a utility function that returns the URL the user should be
+redirected to. Imagine it would always redirect to the URL's ``next``
+parameter or the HTTP referrer or the index page::
+
+ from flask import request, url_for
+
+ def redirect_url():
+ return request.args.get('next') or \
+ request.referrer or \
+ url_for('index')
+
+As you can see, it accesses the request object. If you try to run this
+from a plain Python shell, this is the exception you will see:
+
+>>> redirect_url()
+Traceback (most recent call last):
+ File "<stdin>", line 1, in <module>
+AttributeError: 'NoneType' object has no attribute 'request'
+
+That makes a lot of sense because we currently do not have a request we
+could access. So we have to make a request and bind it to the current
+context. The :attr:`~flask.Flask.test_request_context` method can create
+us a :class:`~flask.ctx.RequestContext`:
+
+>>> ctx = app.test_request_context('/?next=http://example.com/')
+
+This context can be used in two ways. Either with the `with` statement
+or by calling the :meth:`~flask.ctx.RequestContext.push` and
+:meth:`~flask.ctx.RequestContext.pop` methods:
+
+>>> ctx.push()
+
+From that point onwards you can work with the request object:
+
+>>> redirect_url()
+u'http://example.com/'
+
+Until you call `pop`:
+
+>>> ctx.pop()
+
+Because the request context is internally maintained as a stack you can
+push and pop multiple times. This is very handy to implement things like
+internal redirects.
+
+For more information of how to utilize the request context from the
+interactive Python shell, head over to the :ref:`shell` chapter.
+
+How the Context Works
+---------------------
+
+If you look into how the Flask WSGI application internally works, you will
+find a piece of code that looks very much like this::
+
+ def wsgi_app(self, environ):
+ with self.request_context(environ):
+ try:
+ response = self.full_dispatch_request()
+ except Exception, e:
+ response = self.make_response(self.handle_exception(e))
+ return response(environ, start_response)
+
+The method :meth:`~Flask.request_context` returns a new
+:class:`~flask.ctx.RequestContext` object and uses it in combination with
+the `with` statement to bind the context. Everything that is called from
+the same thread from this point onwards until the end of the `with`
+statement will have access to the request globals (:data:`flask.request`
+and others).
+
+The request context internally works like a stack: The topmost level on
+the stack is the current active request.
+:meth:`~flask.ctx.RequestContext.push` adds the context to the stack on
+the very top, :meth:`~flask.ctx.RequestContext.pop` removes it from the
+stack again. On popping the application's
+:func:`~flask.Flask.teardown_request` functions are also executed.
+
+.. _callbacks-and-errors:
+
+Callbacks and Errors
+--------------------
+
+What happens if an error occurs in Flask during request processing? This
+particular behavior changed in 0.7 because we wanted to make it easier to
+understand what is actually happening. The new behavior is quite simple:
+
+1. Before each request, :meth:`~flask.Flask.before_request` functions are
+ executed. If one of these functions return a response, the other
+ functions are no longer called. In any case however the return value
+ is treated as a replacement for the view's return value.
+
+2. If the :meth:`~flask.Flask.before_request` functions did not return a
+ response, the regular request handling kicks in and the view function
+ that was matched has the chance to return a response.
+
+3. The return value of the view is then converted into an actual response
+ object and handed over to the :meth:`~flask.Flask.after_request`
+ functions which have the chance to replace it or modify it in place.
+
+4. At the end of the request the :meth:`~flask.Flask.teardown_request`
+ functions are executed. This always happens, even in case of an
+ unhandled exception down the road or if a before-request handler was
+ not executed yet or at all (for example in test environments sometimes
+ you might want to not execute before-request callbacks).
+
+Now what happens on errors? In production mode if an exception is not
+caught, the 500 internal server handler is called. In development mode
+however the exception is not further processed and bubbles up to the WSGI
+server. That way things like the interactive debugger can provide helpful
+debug information.
+
+An important change in 0.7 is that the internal server error is now no
+longer post processed by the after request callbacks and after request
+callbacks are no longer guaranteed to be executed. This way the internal
+dispatching code looks cleaner and is easier to customize and understand.
+
+The new teardown functions are supposed to be used as a replacement for
+things that absolutely need to happen at the end of request.
+
+Teardown Callbacks
+------------------
+
+The teardown callbacks are special callbacks in that they are executed at
+at different point. Strictly speaking they are independent of the actual
+request handling as they are bound to the lifecycle of the
+:class:`~flask.ctx.RequestContext` object. When the request context is
+popped, the :meth:`~flask.Flask.teardown_request` functions are called.
+
+This is important to know if the life of the request context is prolonged
+by using the test client in a with statement or when using the request
+context from the command line::
+
+ with app.test_client() as client:
+ resp = client.get('/foo')
+ # the teardown functions are still not called at that point
+ # even though the response ended and you have the response
+ # object in your hand
+
+ # only when the code reaches this point the teardown functions
+ # are called. Alternatively the same thing happens if another
+ # request was triggered from the test client
+
+It's easy to see the behavior from the command line:
+
+>>> app = Flask(__name__)
+>>> @app.teardown_request
+... def teardown_request(exception=None):
+... print 'this runs after request'
+...
+>>> ctx = app.test_request_context()
+>>> ctx.push()
+>>> ctx.pop()
+this runs after request
+>>>
+
+Keep in mind that teardown callbacks are always executed, even if
+before-request callbacks were not executed yet but an exception happened.
+Certain parts of the test system might also temporarily create a request
+context without calling the before-request handlers. Make sure to write
+your teardown-request handlers in a way that they will never fail.
+
+.. _notes-on-proxies:
+
+Notes On Proxies
+----------------
+
+Some of the objects provided by Flask are proxies to other objects. The
+reason behind this is that these proxies are shared between threads and
+they have to dispatch to the actual object bound to a thread behind the
+scenes as necessary.
+
+Most of the time you don't have to care about that, but there are some
+exceptions where it is good to know that this object is an actual proxy:
+
+- The proxy objects do not fake their inherited types, so if you want to
+ perform actual instance checks, you have to do that on the instance
+ that is being proxied (see `_get_current_object` below).
+- if the object reference is important (so for example for sending
+ :ref:`signals`)
+
+If you need to get access to the underlying object that is proxied, you
+can use the :meth:`~werkzeug.local.LocalProxy._get_current_object` method::
+
+ app = current_app._get_current_object()
+ my_signal.send(app)
+
+Context Preservation on Error
+-----------------------------
+
+If an error occurs or not, at the end of the request the request context
+is popped and all data associated with it is destroyed. During
+development however that can be problematic as you might want to have the
+information around for a longer time in case an exception occurred. In
+Flask 0.6 and earlier in debug mode, if an exception occurred, the
+request context was not popped so that the interactive debugger can still
+provide you with important information.
+
+Starting with Flask 0.7 you have finer control over that behavior by
+setting the ``PRESERVE_CONTEXT_ON_EXCEPTION`` configuration variable. By
+default it's linked to the setting of ``DEBUG``. If the application is in
+debug mode the context is preserved, in production mode it's not.
+
+Do not force activate ``PRESERVE_CONTEXT_ON_EXCEPTION`` in production mode
+as it will cause your application to leak memory on exceptions. However
+it can be useful during development to get the same error preserving
+behavior as in development mode when attempting to debug an error that
+only occurs under production settings.
diff --git a/app/static/doc/flask-docs/_sources/security.txt b/app/static/doc/flask-docs/_sources/security.txt
new file mode 100644
index 0000000..909ef53
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/security.txt
@@ -0,0 +1,175 @@
+Security Considerations
+=======================
+
+Web applications usually face all kinds of security problems and it's very
+hard to get everything right. Flask tries to solve a few of these things
+for you, but there are a couple more you have to take care of yourself.
+
+.. _xss:
+
+Cross-Site Scripting (XSS)
+--------------------------
+
+Cross site scripting is the concept of injecting arbitrary HTML (and with
+it JavaScript) into the context of a website. To remedy this, developers
+have to properly escape text so that it cannot include arbitrary HTML
+tags. For more information on that have a look at the Wikipedia article
+on `Cross-Site Scripting
+<http://en.wikipedia.org/wiki/Cross-site_scripting>`_.
+
+Flask configures Jinja2 to automatically escape all values unless
+explicitly told otherwise. This should rule out all XSS problems caused
+in templates, but there are still other places where you have to be
+careful:
+
+- generating HTML without the help of Jinja2
+- calling :class:`~flask.Markup` on data submitted by users
+- sending out HTML from uploaded files, never do that, use the
+ `Content-Disposition: attachment` header to prevent that problem.
+- sending out textfiles from uploaded files. Some browsers are using
+ content-type guessing based on the first few bytes so users could
+ trick a browser to execute HTML.
+
+Another thing that is very important are unquoted attributes. While
+Jinja2 can protect you from XSS issues by escaping HTML, there is one
+thing it cannot protect you from: XSS by attribute injection. To counter
+this possible attack vector, be sure to always quote your attributes with
+either double or single quotes when using Jinja expressions in them:
+
+.. sourcecode:: html+jinja
+
+ <a href="{{ href }}">the text</a>
+
+Why is this necessary? Because if you would not be doing that, an
+attacker could easily inject custom JavaScript handlers. For example an
+attacker could inject this piece of HTML+JavaScript:
+
+.. sourcecode:: html
+
+ onmouseover=alert(document.cookie)
+
+When the user would then move with the mouse over the link, the cookie
+would be presented to the user in an alert window. But instead of showing
+the cookie to the user, a good attacker might also execute any other
+JavaScript code. In combination with CSS injections the attacker might
+even make the element fill out the entire page so that the user would
+just have to have the mouse anywhere on the page to trigger the attack.
+
+Cross-Site Request Forgery (CSRF)
+---------------------------------
+
+Another big problem is CSRF. This is a very complex topic and I won't
+outline it here in detail just mention what it is and how to theoretically
+prevent it.
+
+If your authentication information is stored in cookies, you have implicit
+state management. The state of "being logged in" is controlled by a
+cookie, and that cookie is sent with each request to a page.
+Unfortunately that includes requests triggered by 3rd party sites. If you
+don't keep that in mind, some people might be able to trick your
+application's users with social engineering to do stupid things without
+them knowing.
+
+Say you have a specific URL that, when you sent `POST` requests to will
+delete a user's profile (say `http://example.com/user/delete`). If an
+attacker now creates a page that sends a post request to that page with
+some JavaScript they just has to trick some users to load that page and
+their profiles will end up being deleted.
+
+Imagine you were to run Facebook with millions of concurrent users and
+someone would send out links to images of little kittens. When users
+would go to that page, their profiles would get deleted while they are
+looking at images of fluffy cats.
+
+How can you prevent that? Basically for each request that modifies
+content on the server you would have to either use a one-time token and
+store that in the cookie **and** also transmit it with the form data.
+After receiving the data on the server again, you would then have to
+compare the two tokens and ensure they are equal.
+
+Why does Flask not do that for you? The ideal place for this to happen is
+the form validation framework, which does not exist in Flask.
+
+.. _json-security:
+
+JSON Security
+-------------
+
+.. admonition:: ECMAScript 5 Changes
+
+ Starting with ECMAScript 5 the behavior of literals changed. Now they
+ are not constructed with the constructor of ``Array`` and others, but
+ with the builtin constructor of ``Array`` which closes this particular
+ attack vector.
+
+JSON itself is a high-level serialization format, so there is barely
+anything that could cause security problems, right? You can't declare
+recursive structures that could cause problems and the only thing that
+could possibly break are very large responses that can cause some kind of
+denial of service at the receiver's side.
+
+However there is a catch. Due to how browsers work the CSRF issue comes
+up with JSON unfortunately. Fortunately there is also a weird part of the
+JavaScript specification that can be used to solve that problem easily and
+Flask is kinda doing that for you by preventing you from doing dangerous
+stuff. Unfortunately that protection is only there for
+:func:`~flask.jsonify` so you are still at risk when using other ways to
+generate JSON.
+
+So what is the issue and how to avoid it? The problem are arrays at
+top-level in JSON. Imagine you send the following data out in a JSON
+request. Say that's exporting the names and email addresses of all your
+friends for a part of the user interface that is written in JavaScript.
+Not very uncommon:
+
+.. sourcecode:: javascript
+
+ [
+ {"username": "admin",
+ "email": "admin@localhost"}
+ ]
+
+And it is doing that of course only as long as you are logged in and only
+for you. And it is doing that for all `GET` requests to a certain URL,
+say the URL for that request is
+``http://example.com/api/get_friends.json``.
+
+So now what happens if a clever hacker is embedding this to his website
+and social engineers a victim to visiting his site:
+
+.. sourcecode:: html
+
+ <script type=text/javascript>
+ var captured = [];
+ var oldArray = Array;
+ function Array() {
+ var obj = this, id = 0, capture = function(value) {
+ obj.__defineSetter__(id++, capture);
+ if (value)
+ captured.push(value);
+ };
+ capture();
+ }
+ </script>
+ <script type=text/javascript
+ src=http://example.com/api/get_friends.json></script>
+ <script type=text/javascript>
+ Array = oldArray;
+ // now we have all the data in the captured array.
+ </script>
+
+If you know a bit of JavaScript internals you might know that it's
+possible to patch constructors and register callbacks for setters. An
+attacker can use this (like above) to get all the data you exported in
+your JSON file. The browser will totally ignore the ``application/json``
+mimetype if ``text/javascript`` is defined as content type in the script
+tag and evaluate that as JavaScript. Because top-level array elements are
+allowed (albeit useless) and we hooked in our own constructor, after that
+page loaded the data from the JSON response is in the `captured` array.
+
+Because it is a syntax error in JavaScript to have an object literal
+(``{...}``) toplevel an attacker could not just do a request to an
+external URL with the script tag to load up the data. So what Flask does
+is to only allow objects as toplevel elements when using
+:func:`~flask.jsonify`. Make sure to do the same when using an ordinary
+JSON generate function.
diff --git a/app/static/doc/flask-docs/_sources/shell.txt b/app/static/doc/flask-docs/_sources/shell.txt
new file mode 100644
index 0000000..61b9dc0
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/shell.txt
@@ -0,0 +1,93 @@
+.. _shell:
+
+Working with the Shell
+======================
+
+.. versionadded:: 0.3
+
+One of the reasons everybody loves Python is the interactive shell. It
+basically allows you to execute Python commands in real time and
+immediately get results back. Flask itself does not come with an
+interactive shell, because it does not require any specific setup upfront,
+just import your application and start playing around.
+
+There are however some handy helpers to make playing around in the shell a
+more pleasant experience. The main issue with interactive console
+sessions is that you're not triggering a request like a browser does which
+means that :data:`~flask.g`, :data:`~flask.request` and others are not
+available. But the code you want to test might depend on them, so what
+can you do?
+
+This is where some helper functions come in handy. Keep in mind however
+that these functions are not only there for interactive shell usage, but
+also for unittesting and other situations that require a faked request
+context.
+
+Generally it's recommended that you read the :ref:`request-context`
+chapter of the documentation first.
+
+Creating a Request Context
+--------------------------
+
+The easiest way to create a proper request context from the shell is by
+using the :attr:`~flask.Flask.test_request_context` method which creates
+us a :class:`~flask.ctx.RequestContext`:
+
+>>> ctx = app.test_request_context()
+
+Normally you would use the `with` statement to make this request object
+active, but in the shell it's easier to use the
+:meth:`~flask.ctx.RequestContext.push` and
+:meth:`~flask.ctx.RequestContext.pop` methods by hand:
+
+>>> ctx.push()
+
+From that point onwards you can work with the request object until you
+call `pop`:
+
+>>> ctx.pop()
+
+Firing Before/After Request
+---------------------------
+
+By just creating a request context, you still don't have run the code that
+is normally run before a request. This might result in your database
+being unavailable if you are connecting to the database in a
+before-request callback or the current user not being stored on the
+:data:`~flask.g` object etc.
+
+This however can easily be done yourself. Just call
+:meth:`~flask.Flask.preprocess_request`:
+
+>>> ctx = app.test_request_context()
+>>> ctx.push()
+>>> app.preprocess_request()
+
+Keep in mind that the :meth:`~flask.Flask.preprocess_request` function
+might return a response object, in that case just ignore it.
+
+To shutdown a request, you need to trick a bit before the after request
+functions (triggered by :meth:`~flask.Flask.process_response`) operate on
+a response object:
+
+>>> app.process_response(app.response_class())
+<Response 0 bytes [200 OK]>
+>>> ctx.pop()
+
+The functions registered as :meth:`~flask.Flask.teardown_request` are
+automatically called when the context is popped. So this is the perfect
+place to automatically tear down resources that were needed by the request
+context (such as database connections).
+
+
+Further Improving the Shell Experience
+--------------------------------------
+
+If you like the idea of experimenting in a shell, create yourself a module
+with stuff you want to star import into your interactive session. There
+you could also define some more helper methods for common things such as
+initializing the database, dropping tables etc.
+
+Just put them into a module (like `shelltools` and import from there):
+
+>>> from shelltools import *
diff --git a/app/static/doc/flask-docs/_sources/signals.txt b/app/static/doc/flask-docs/_sources/signals.txt
new file mode 100644
index 0000000..0d1d9ee
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/signals.txt
@@ -0,0 +1,255 @@
+.. _signals:
+
+Signals
+=======
+
+.. versionadded:: 0.6
+
+Starting with Flask 0.6, there is integrated support for signalling in
+Flask. This support is provided by the excellent `blinker`_ library and
+will gracefully fall back if it is not available.
+
+What are signals? Signals help you decouple applications by sending
+notifications when actions occur elsewhere in the core framework or
+another Flask extensions. In short, signals allow certain senders to
+notify subscribers that something happened.
+
+Flask comes with a couple of signals and other extensions might provide
+more. Also keep in mind that signals are intended to notify subscribers
+and should not encourage subscribers to modify data. You will notice that
+there are signals that appear to do the same thing like some of the
+builtin decorators do (eg: :data:`~flask.request_started` is very similar
+to :meth:`~flask.Flask.before_request`). There are however difference in
+how they work. The core :meth:`~flask.Flask.before_request` handler for
+example is executed in a specific order and is able to abort the request
+early by returning a response. In contrast all signal handlers are
+executed in undefined order and do not modify any data.
+
+The big advantage of signals over handlers is that you can safely
+subscribe to them for the split of a second. These temporary
+subscriptions are helpful for unittesting for example. Say you want to
+know what templates were rendered as part of a request: signals allow you
+to do exactly that.
+
+Subscribing to Signals
+----------------------
+
+To subscribe to a signal, you can use the
+:meth:`~blinker.base.Signal.connect` method of a signal. The first
+argument is the function that should be called when the signal is emitted,
+the optional second argument specifies a sender. To unsubscribe from a
+signal, you can use the :meth:`~blinker.base.Signal.disconnect` method.
+
+For all core Flask signals, the sender is the application that issued the
+signal. When you subscribe to a signal, be sure to also provide a sender
+unless you really want to listen for signals of all applications. This is
+especially true if you are developing an extension.
+
+Here for example a helper context manager that can be used to figure out
+in a unittest which templates were rendered and what variables were passed
+to the template::
+
+ from flask import template_rendered
+ from contextlib import contextmanager
+
+ @contextmanager
+ def captured_templates(app):
+ recorded = []
+ def record(sender, template, context):
+ recorded.append((template, context))
+ template_rendered.connect(record, app)
+ try:
+ yield recorded
+ finally:
+ template_rendered.disconnect(record, app)
+
+This can now easily be paired with a test client::
+
+ with captured_templates(app) as templates:
+ rv = app.test_client().get('/')
+ assert rv.status_code == 200
+ assert len(templates) == 1
+ template, context = templates[0]
+ assert template.name == 'index.html'
+ assert len(context['items']) == 10
+
+All the template rendering in the code issued by the application `app`
+in the body of the `with` block will now be recorded in the `templates`
+variable. Whenever a template is rendered, the template object as well as
+context are appended to it.
+
+Additionally there is a convenient helper method
+(:meth:`~blinker.base.Signal.connected_to`). that allows you to
+temporarily subscribe a function to a signal with is a context manager on
+its own. Because the return value of the context manager cannot be
+specified that way one has to pass the list in as argument::
+
+ from flask import template_rendered
+
+ def captured_templates(app, recorded):
+ def record(sender, template, context):
+ recorded.append((template, context))
+ return template_rendered.connected_to(record, app)
+
+The example above would then look like this::
+
+ templates = []
+ with captured_templates(app, templates):
+ ...
+ template, context = templates[0]
+
+.. admonition:: Blinker API Changes
+
+ The :meth:`~blinker.base.Signal.connected_to` method arrived in Blinker
+ with version 1.1.
+
+Creating Signals
+----------------
+
+If you want to use signals in your own application, you can use the
+blinker library directly. The most common use case are named signals in a
+custom :class:`~blinker.base.Namespace`.. This is what is recommended
+most of the time::
+
+ from blinker import Namespace
+ my_signals = Namespace()
+
+Now you can create new signals like this::
+
+ model_saved = my_signals.signal('model-saved')
+
+The name for the signal here makes it unique and also simplifies
+debugging. You can access the name of the signal with the
+:attr:`~blinker.base.NamedSignal.name` attribute.
+
+.. admonition:: For Extension Developers
+
+ If you are writing a Flask extension and you want to gracefully degrade for
+ missing blinker installations, you can do so by using the
+ :class:`flask.signals.Namespace` class.
+
+Sending Signals
+---------------
+
+If you want to emit a signal, you can do so by calling the
+:meth:`~blinker.base.Signal.send` method. It accepts a sender as first
+argument and optionally some keyword arguments that are forwarded to the
+signal subscribers::
+
+ class Model(object):
+ ...
+
+ def save(self):
+ model_saved.send(self)
+
+Try to always pick a good sender. If you have a class that is emitting a
+signal, pass `self` as sender. If you emitting a signal from a random
+function, you can pass ``current_app._get_current_object()`` as sender.
+
+.. admonition:: Passing Proxies as Senders
+
+ Never pass :data:`~flask.current_app` as sender to a signal. Use
+ ``current_app._get_current_object()`` instead. The reason for this is
+ that :data:`~flask.current_app` is a proxy and not the real application
+ object.
+
+Decorator Based Signal Subscriptions
+------------------------------------
+
+With Blinker 1.1 you can also easily subscribe to signals by using the new
+:meth:`~blinker.base.NamedSignal.connect_via` decorator::
+
+ from flask import template_rendered
+
+ @template_rendered.connect_via(app)
+ def when_template_rendered(sender, template, context):
+ print 'Template %s is rendered with %s' % (template.name, context)
+
+Core Signals
+------------
+
+.. when modifying this list, also update the one in api.rst
+
+The following signals exist in Flask:
+
+.. data:: flask.template_rendered
+ :noindex:
+
+ This signal is sent when a template was successfully rendered. The
+ signal is invoked with the instance of the template as `template`
+ and the context as dictionary (named `context`).
+
+ Example subscriber::
+
+ def log_template_renders(sender, template, context):
+ sender.logger.debug('Rendering template "%s" with context %s',
+ template.name or 'string template',
+ context)
+
+ from flask import template_rendered
+ template_rendered.connect(log_template_renders, app)
+
+.. data:: flask.request_started
+ :noindex:
+
+ This signal is sent before any request processing started but when the
+ request context was set up. Because the request context is already
+ bound, the subscriber can access the request with the standard global
+ proxies such as :class:`~flask.request`.
+
+ Example subscriber::
+
+ def log_request(sender):
+ sender.logger.debug('Request context is set up')
+
+ from flask import request_started
+ request_started.connect(log_request, app)
+
+.. data:: flask.request_finished
+ :noindex:
+
+ This signal is sent right before the response is sent to the client.
+ It is passed the response to be sent named `response`.
+
+ Example subscriber::
+
+ def log_response(sender, response):
+ sender.logger.debug('Request context is about to close down. '
+ 'Response: %s', response)
+
+ from flask import request_finished
+ request_finished.connect(log_response, app)
+
+.. data:: flask.got_request_exception
+ :noindex:
+
+ This signal is sent when an exception happens during request processing.
+ It is sent *before* the standard exception handling kicks in and even
+ in debug mode, where no exception handling happens. The exception
+ itself is passed to the subscriber as `exception`.
+
+ Example subscriber::
+
+ def log_exception(sender, exception):
+ sender.logger.debug('Got exception during processing: %s', exception)
+
+ from flask import got_request_exception
+ got_request_exception.connect(log_exception, app)
+
+.. data:: flask.request_tearing_down
+ :noindex:
+
+ This signal is sent when the request is tearing down. This is always
+ called, even if an exception is caused. Currently functions listening
+ to this signal are called after the regular teardown handlers, but this
+ is not something you can rely on.
+
+ Example subscriber::
+
+ def close_db_connection(sender):
+ session.close()
+
+ from flask import request_tearing_down
+ request_tearing_down.connect(close_db_connection, app)
+
+.. _blinker: http://pypi.python.org/pypi/blinker
diff --git a/app/static/doc/flask-docs/_sources/styleguide.txt b/app/static/doc/flask-docs/_sources/styleguide.txt
new file mode 100644
index 0000000..d46ecd0
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/styleguide.txt
@@ -0,0 +1,200 @@
+Pocoo Styleguide
+================
+
+The Pocoo styleguide is the styleguide for all Pocoo Projects, including
+Flask. This styleguide is a requirement for Patches to Flask and a
+recommendation for Flask extensions.
+
+In general the Pocoo Styleguide closely follows :pep:`8` with some small
+differences and extensions.
+
+General Layout
+--------------
+
+Indentation:
+ 4 real spaces. No tabs, no exceptions.
+
+Maximum line length:
+ 79 characters with a soft limit for 84 if absolutely necessary. Try
+ to avoid too nested code by cleverly placing `break`, `continue` and
+ `return` statements.
+
+Continuing long statements:
+ To continue a statement you can use backslashes in which case you should
+ align the next line with the last dot or equal sign, or indent four
+ spaces::
+
+ this_is_a_very_long(function_call, 'with many parameters') \
+ .that_returns_an_object_with_an_attribute
+
+ MyModel.query.filter(MyModel.scalar > 120) \
+ .order_by(MyModel.name.desc()) \
+ .limit(10)
+
+ If you break in a statement with parentheses or braces, align to the
+ braces::
+
+ this_is_a_very_long(function_call, 'with many parameters',
+ 23, 42, 'and even more')
+
+ For lists or tuples with many items, break immediately after the
+ opening brace::
+
+ items = [
+ 'this is the first', 'set of items', 'with more items',
+ 'to come in this line', 'like this'
+ ]
+
+Blank lines:
+ Top level functions and classes are separated by two lines, everything
+ else by one. Do not use too many blank lines to separate logical
+ segments in code. Example::
+
+ def hello(name):
+ print 'Hello %s!' % name
+
+
+ def goodbye(name):
+ print 'See you %s.' % name
+
+
+ class MyClass(object):
+ """This is a simple docstring"""
+
+ def __init__(self, name):
+ self.name = name
+
+ def get_annoying_name(self):
+ return self.name.upper() + '!!!!111'
+
+Expressions and Statements
+--------------------------
+
+General whitespace rules:
+ - No whitespace for unary operators that are not words
+ (e.g.: ``-``, ``~`` etc.) as well on the inner side of parentheses.
+ - Whitespace is placed between binary operators.
+
+ Good::
+
+ exp = -1.05
+ value = (item_value / item_count) * offset / exp
+ value = my_list[index]
+ value = my_dict['key']
+
+ Bad::
+
+ exp = - 1.05
+ value = ( item_value / item_count ) * offset / exp
+ value = (item_value/item_count)*offset/exp
+ value=( item_value/item_count ) * offset/exp
+ value = my_list[ index ]
+ value = my_dict ['key']
+
+Yoda statements are a no-go:
+ Never compare constant with variable, always variable with constant:
+
+ Good::
+
+ if method == 'md5':
+ pass
+
+ Bad::
+
+ if 'md5' == method:
+ pass
+
+Comparisons:
+ - against arbitrary types: ``==`` and ``!=``
+ - against singletons with ``is`` and ``is not`` (eg: ``foo is not
+ None``)
+ - never compare something with `True` or `False` (for example never
+ do ``foo == False``, do ``not foo`` instead)
+
+Negated containment checks:
+ use ``foo not in bar`` instead of ``not foo in bar``
+
+Instance checks:
+ ``isinstance(a, C)`` instead of ``type(A) is C``, but try to avoid
+ instance checks in general. Check for features.
+
+
+Naming Conventions
+------------------
+
+- Class names: ``CamelCase``, with acronyms kept uppercase (``HTTPWriter``
+ and not ``HttpWriter``)
+- Variable names: ``lowercase_with_underscores``
+- Method and function names: ``lowercase_with_underscores``
+- Constants: ``UPPERCASE_WITH_UNDERSCORES``
+- precompiled regular expressions: ``name_re``
+
+Protected members are prefixed with a single underscore. Double
+underscores are reserved for mixin classes.
+
+On classes with keywords, trailing underscores are appended. Clashes with
+builtins are allowed and **must not** be resolved by appending an
+underline to the variable name. If the function needs to access a
+shadowed builtin, rebind the builtin to a different name instead.
+
+Function and method arguments:
+ - class methods: ``cls`` as first parameter
+ - instance methods: ``self`` as first parameter
+ - lambdas for properties might have the first parameter replaced
+ with ``x`` like in ``display_name = property(lambda x: x.real_name
+ or x.username)``
+
+
+Docstrings
+----------
+
+Docstring conventions:
+ All docstrings are formatted with reStructuredText as understood by
+ Sphinx. Depending on the number of lines in the docstring, they are
+ laid out differently. If it's just one line, the closing triple
+ quote is on the same line as the opening, otherwise the text is on
+ the same line as the opening quote and the triple quote that closes
+ the string on its own line::
+
+ def foo():
+ """This is a simple docstring"""
+
+
+ def bar():
+ """This is a longer docstring with so much information in there
+ that it spans three lines. In this case the closing triple quote
+ is on its own line.
+ """
+
+Module header:
+ The module header consists of an utf-8 encoding declaration (if non
+ ASCII letters are used, but it is recommended all the time) and a
+ standard docstring::
+
+ # -*- coding: utf-8 -*-
+ """
+ package.module
+ ~~~~~~~~~~~~~~
+
+ A brief description goes here.
+
+ :copyright: (c) YEAR by AUTHOR.
+ :license: LICENSE_NAME, see LICENSE_FILE for more details.
+ """
+
+ Please keep in mind that proper copyrights and license files are a
+ requirement for approved Flask extensions.
+
+
+Comments
+--------
+
+Rules for comments are similar to docstrings. Both are formatted with
+reStructuredText. If a comment is used to document an attribute, put a
+colon after the opening pound sign (``#``)::
+
+ class User(object):
+ #: the name of the user as unicode string
+ name = Column(String)
+ #: the sha1 hash of the password + inline salt
+ pw_hash = Column(String)
diff --git a/app/static/doc/flask-docs/_sources/templating.txt b/app/static/doc/flask-docs/_sources/templating.txt
new file mode 100644
index 0000000..bd940b0
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/templating.txt
@@ -0,0 +1,188 @@
+Templates
+=========
+
+Flask leverages Jinja2 as template engine. You are obviously free to use
+a different template engine, but you still have to install Jinja2 to run
+Flask itself. This requirement is necessary to enable rich extensions.
+An extension can depend on Jinja2 being present.
+
+This section only gives a very quick introduction into how Jinja2
+is integrated into Flask. If you want information on the template
+engine's syntax itself, head over to the official `Jinja2 Template
+Documentation <http://jinja.pocoo.org/2/documentation/templates>`_ for
+more information.
+
+Jinja Setup
+-----------
+
+Unless customized, Jinja2 is configured by Flask as follows:
+
+- autoescaping is enabled for all templates ending in ``.html``,
+ ``.htm``, ``.xml`` as well as ``.xhtml``
+- a template has the ability to opt in/out autoescaping with the
+ ``{% autoescape %}`` tag.
+- Flask inserts a couple of global functions and helpers into the
+ Jinja2 context, additionally to the values that are present by
+ default.
+
+Standard Context
+----------------
+
+The following global variables are available within Jinja2 templates
+by default:
+
+.. data:: config
+ :noindex:
+
+ The current configuration object (:data:`flask.config`)
+
+ .. versionadded:: 0.6
+
+.. data:: request
+ :noindex:
+
+ The current request object (:class:`flask.request`)
+
+.. data:: session
+ :noindex:
+
+ The current session object (:class:`flask.session`)
+
+.. data:: g
+ :noindex:
+
+ The request-bound object for global variables (:data:`flask.g`)
+
+.. function:: url_for
+ :noindex:
+
+ The :func:`flask.url_for` function.
+
+.. function:: get_flashed_messages
+ :noindex:
+
+ The :func:`flask.get_flashed_messages` function.
+
+.. admonition:: The Jinja Context Behaviour
+
+ These variables are added to the context of variables, they are not
+ global variables. The difference is that by default these will not
+ show up in the context of imported templates. This is partially caused
+ by performance considerations, partially to keep things explicit.
+
+ What does this mean for you? If you have a macro you want to import,
+ that needs to access the request object you have two possibilities:
+
+ 1. you explicitly pass the request to the macro as parameter, or
+ the attribute of the request object you are interested in.
+ 2. you import the macro "with context".
+
+ Importing with context looks like this:
+
+ .. sourcecode:: jinja
+
+ {% from '_helpers.html' import my_macro with context %}
+
+Standard Filters
+----------------
+
+These filters are available in Jinja2 additionally to the filters provided
+by Jinja2 itself:
+
+.. function:: tojson
+ :noindex:
+
+ This function converts the given object into JSON representation. This
+ is for example very helpful if you try to generate JavaScript on the
+ fly.
+
+ Note that inside `script` tags no escaping must take place, so make
+ sure to disable escaping with ``|safe`` if you intend to use it inside
+ `script` tags:
+
+ .. sourcecode:: html+jinja
+
+ <script type=text/javascript>
+ doSomethingWith({{ user.username|tojson|safe }});
+ </script>
+
+ That the ``|tojson`` filter escapes forward slashes properly for you.
+
+Controlling Autoescaping
+------------------------
+
+Autoescaping is the concept of automatically escaping special characters
+of you. Special characters in the sense of HTML (or XML, and thus XHTML)
+are ``&``, ``>``, ``<``, ``"`` as well as ``'``. Because these characters
+carry specific meanings in documents on their own you have to replace them
+by so called "entities" if you want to use them for text. Not doing so
+would not only cause user frustration by the inability to use these
+characters in text, but can also lead to security problems. (see
+:ref:`xss`)
+
+Sometimes however you will need to disable autoescaping in templates.
+This can be the case if you want to explicitly inject HTML into pages, for
+example if they come from a system that generate secure HTML like a
+markdown to HTML converter.
+
+There are three ways to accomplish that:
+
+- In the Python code, wrap the HTML string in a :class:`~flask.Markup`
+ object before passing it to the template. This is in general the
+ recommended way.
+- Inside the template, use the ``|safe`` filter to explicitly mark a
+ string as safe HTML (``{{ myvariable|safe }}``)
+- Temporarily disable the autoescape system altogether.
+
+To disable the autoescape system in templates, you can use the ``{%
+autoescape %}`` block:
+
+.. sourcecode:: html+jinja
+
+ {% autoescape false %}
+ <p>autoescaping is disabled here
+ <p>{{ will_not_be_escaped }}
+ {% endautoescape %}
+
+Whenever you do this, please be very cautious about the variables you are
+using in this block.
+
+Registering Filters
+-------------------
+
+If you want to register your own filters in Jinja2 you have two ways to do
+that. You can either put them by hand into the
+:attr:`~flask.Flask.jinja_env` of the application or use the
+:meth:`~flask.Flask.template_filter` decorator.
+
+The two following examples work the same and both reverse an object::
+
+ @app.template_filter('reverse')
+ def reverse_filter(s):
+ return s[::-1]
+
+ def reverse_filter(s):
+ return s[::-1]
+ app.jinja_env.filters['reverse'] = reverse_filter
+
+In case of the decorator the argument is optional if you want to use the
+function name as name of the filter.
+
+Context Processors
+------------------
+
+To inject new variables automatically into the context of a template
+context processors exist in Flask. Context processors run before the
+template is rendered and have the ability to inject new values into the
+template context. A context processor is a function that returns a
+dictionary. The keys and values of this dictionary are then merged with
+the template context::
+
+ @app.context_processor
+ def inject_user():
+ return dict(user=g.user)
+
+The context processor above makes a variable called `user` available in
+the template with the value of `g.user`. This example is not very
+interesting because `g` is available in templates anyways, but it gives an
+idea how this works.
diff --git a/app/static/doc/flask-docs/_sources/testing.txt b/app/static/doc/flask-docs/_sources/testing.txt
new file mode 100644
index 0000000..1e00fe8
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/testing.txt
@@ -0,0 +1,307 @@
+.. _testing:
+
+Testing Flask Applications
+==========================
+
+ **Something that is untested is broken.**
+
+The origin of this quote is unknown and while it is not entirely correct, it is also
+not far from the truth. Untested applications make it hard to
+improve existing code and developers of untested applications tend to
+become pretty paranoid. If an application has automated tests, you can
+safely make changes and instantly know if anything breaks.
+
+Flask provides a way to test your application by exposing the Werkzeug
+test :class:`~werkzeug.test.Client` and handling the context locals for you.
+You can then use that with your favourite testing solution. In this documentation
+we will use the :mod:`unittest` package that comes pre-installed with Python.
+
+The Application
+---------------
+
+First, we need an application to test; we will use the application from
+the :ref:`tutorial`. If you don't have that application yet, get the
+sources from `the examples`_.
+
+.. _the examples:
+ http://github.com/mitsuhiko/flask/tree/master/examples/flaskr/
+
+The Testing Skeleton
+--------------------
+
+In order to test the application, we add a second module
+(`flaskr_tests.py`) and create a unittest skeleton there::
+
+ import os
+ import flaskr
+ import unittest
+ import tempfile
+
+ class FlaskrTestCase(unittest.TestCase):
+
+ def setUp(self):
+ self.db_fd, flaskr.app.config['DATABASE'] = tempfile.mkstemp()
+ flaskr.app.config['TESTING'] = True
+ self.app = flaskr.app.test_client()
+ flaskr.init_db()
+
+ def tearDown(self):
+ os.close(self.db_fd)
+ os.unlink(flaskr.app.config['DATABASE'])
+
+ if __name__ == '__main__':
+ unittest.main()
+
+The code in the :meth:`~unittest.TestCase.setUp` method creates a new test
+client and initializes a new database. This function is called before
+each individual test function is run. To delete the database after the
+test, we close the file and remove it from the filesystem in the
+:meth:`~unittest.TestCase.tearDown` method. Additionally during setup the
+``TESTING`` config flag is activated. What it does is disabling the error
+catching during request handling so that you get better error reports when
+performing test requests against the application.
+
+This test client will give us a simple interface to the application. We can
+trigger test requests to the application, and the client will also keep track
+of cookies for us.
+
+Because SQLite3 is filesystem-based we can easily use the tempfile module
+to create a temporary database and initialize it. The
+:func:`~tempfile.mkstemp` function does two things for us: it returns a
+low-level file handle and a random file name, the latter we use as
+database name. We just have to keep the `db_fd` around so that we can use
+the :func:`os.close` function to close the file.
+
+If we now run the test suite, we should see the following output::
+
+ $ python flaskr_tests.py
+
+ ----------------------------------------------------------------------
+ Ran 0 tests in 0.000s
+
+ OK
+
+Even though it did not run any actual tests, we already know that our flaskr
+application is syntactically valid, otherwise the import would have died
+with an exception.
+
+The First Test
+--------------
+
+Now it's time to start testing the functionality of the application.
+Let's check that the application shows "No entries here so far" if we
+access the root of the application (``/``). To do this, we add a new
+test method to our class, like this::
+
+ class FlaskrTestCase(unittest.TestCase):
+
+ def setUp(self):
+ self.db_fd, flaskr.app.config['DATABASE'] = tempfile.mkstemp()
+ self.app = flaskr.app.test_client()
+ flaskr.init_db()
+
+ def tearDown(self):
+ os.close(self.db_fd)
+ os.unlink(flaskr.DATABASE)
+
+ def test_empty_db(self):
+ rv = self.app.get('/')
+ assert 'No entries here so far' in rv.data
+
+Notice that our test functions begin with the word `test`; this allows
+:mod:`unittest` to automatically identify the method as a test to run.
+
+By using `self.app.get` we can send an HTTP `GET` request to the application with
+the given path. The return value will be a :class:`~flask.Flask.response_class` object.
+We can now use the :attr:`~werkzeug.wrappers.BaseResponse.data` attribute to inspect
+the return value (as string) from the application. In this case, we ensure that
+``'No entries here so far'`` is part of the output.
+
+Run it again and you should see one passing test::
+
+ $ python flaskr_tests.py
+ .
+ ----------------------------------------------------------------------
+ Ran 1 test in 0.034s
+
+ OK
+
+Logging In and Out
+------------------
+
+The majority of the functionality of our application is only available for
+the administrative user, so we need a way to log our test client in and out
+of the application. To do this, we fire some requests to the login and logout
+pages with the required form data (username and password). And because the
+login and logout pages redirect, we tell the client to `follow_redirects`.
+
+Add the following two methods to your `FlaskrTestCase` class::
+
+ def login(self, username, password):
+ return self.app.post('/login', data=dict(
+ username=username,
+ password=password
+ ), follow_redirects=True)
+
+ def logout(self):
+ return self.app.get('/logout', follow_redirects=True)
+
+Now we can easily test that logging in and out works and that it fails with
+invalid credentials. Add this new test to the class::
+
+ def test_login_logout(self):
+ rv = self.login('admin', 'default')
+ assert 'You were logged in' in rv.data
+ rv = self.logout()
+ assert 'You were logged out' in rv.data
+ rv = self.login('adminx', 'default')
+ assert 'Invalid username' in rv.data
+ rv = self.login('admin', 'defaultx')
+ assert 'Invalid password' in rv.data
+
+Test Adding Messages
+--------------------
+
+We should also test that adding messages works. Add a new test method
+like this::
+
+ def test_messages(self):
+ self.login('admin', 'default')
+ rv = self.app.post('/add', data=dict(
+ title='<Hello>',
+ text='<strong>HTML</strong> allowed here'
+ ), follow_redirects=True)
+ assert 'No entries here so far' not in rv.data
+ assert '&lt;Hello&gt;' in rv.data
+ assert '<strong>HTML</strong> allowed here' in rv.data
+
+Here we check that HTML is allowed in the text but not in the title,
+which is the intended behavior.
+
+Running that should now give us three passing tests::
+
+ $ python flaskr_tests.py
+ ...
+ ----------------------------------------------------------------------
+ Ran 3 tests in 0.332s
+
+ OK
+
+For more complex tests with headers and status codes, check out the
+`MiniTwit Example`_ from the sources which contains a larger test
+suite.
+
+
+.. _MiniTwit Example:
+ http://github.com/mitsuhiko/flask/tree/master/examples/minitwit/
+
+
+Other Testing Tricks
+--------------------
+
+Besides using the test client as shown above, there is also the
+:meth:`~flask.Flask.test_request_context` method that can be used
+in combination with the `with` statement to activate a request context
+temporarily. With this you can access the :class:`~flask.request`,
+:class:`~flask.g` and :class:`~flask.session` objects like in view
+functions. Here is a full example that demonstrates this approach::
+
+ app = flask.Flask(__name__)
+
+ with app.test_request_context('/?name=Peter'):
+ assert flask.request.path == '/'
+ assert flask.request.args['name'] == 'Peter'
+
+All the other objects that are context bound can be used in the same
+way.
+
+If you want to test your application with different configurations and
+there does not seem to be a good way to do that, consider switching to
+application factories (see :ref:`app-factories`).
+
+Note however that if you are using a test request context, the
+:meth:`~flask.Flask.before_request` functions are not automatically called
+same for :meth:`~flask.Flask.after_request` functions. However
+:meth:`~flask.Flask.teardown_request` functions are indeed executed when
+the test request context leaves the `with` block. If you do want the
+:meth:`~flask.Flask.before_request` functions to be called as well, you
+need to call :meth:`~flask.Flask.preprocess_request` yourself::
+
+ app = flask.Flask(__name__)
+
+ with app.test_request_context('/?name=Peter'):
+ app.preprocess_request()
+ ...
+
+This can be necessary to open database connections or something similar
+depending on how your application was designed.
+
+If you want to call the :meth:`~flask.Flask.after_request` functions you
+need to call into :meth:`~flask.Flask.process_response` which however
+requires that you pass it a response object::
+
+ app = flask.Flask(__name__)
+
+ with app.test_request_context('/?name=Peter'):
+ resp = Response('...')
+ resp = app.process_response(resp)
+ ...
+
+This in general is less useful because at that point you can directly
+start using the test client.
+
+
+Keeping the Context Around
+--------------------------
+
+.. versionadded:: 0.4
+
+Sometimes it is helpful to trigger a regular request but still keep the
+context around for a little longer so that additional introspection can
+happen. With Flask 0.4 this is possible by using the
+:meth:`~flask.Flask.test_client` with a `with` block::
+
+ app = flask.Flask(__name__)
+
+ with app.test_client() as c:
+ rv = c.get('/?tequila=42')
+ assert request.args['tequila'] == '42'
+
+If you were to use just the :meth:`~flask.Flask.test_client` without
+the `with` block, the `assert` would fail with an error because `request`
+is no longer available (because you are trying to use it outside of the actual request).
+However, keep in mind that any :meth:`~flask.Flask.after_request` functions
+are already called at this point so your database connection and
+everything involved is probably already closed down.
+
+
+Accessing and Modifying Sessions
+--------------------------------
+
+.. versionadded:: 0.8
+
+Sometimes it can be very helpful to access or modify the sessions from the
+test client. Generally there are two ways for this. If you just want to
+ensure that a session has certain keys set to certain values you can just
+keep the context around and access :data:`flask.session`::
+
+ with app.test_client() as c:
+ rv = c.get('/')
+ assert flask.session['foo'] == 42
+
+This however does not make it possible to also modify the session or to
+access the session before a request was fired. Starting with Flask 0.8 we
+provide a so called “session transaction” which simulates the appropriate
+calls to open a session in the context of the test client and to modify
+it. At the end of the transaction the session is stored. This works
+independently of the session backend used::
+
+ with app.test_client() as c:
+ with c.session_transaction() as sess:
+ sess['a_key'] = 'a value'
+
+ # once this is reached the session was stored
+
+Note that in this case you have to use the ``sess`` object instead of the
+:data:`flask.session` proxy. The object however itself will provide the
+same interface.
diff --git a/app/static/doc/flask-docs/_sources/tutorial/css.txt b/app/static/doc/flask-docs/_sources/tutorial/css.txt
new file mode 100644
index 0000000..03f62ed
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/tutorial/css.txt
@@ -0,0 +1,31 @@
+.. _tutorial-css:
+
+Step 7: Adding Style
+====================
+
+Now that everything else works, it's time to add some style to the
+application. Just create a stylesheet called `style.css` in the `static`
+folder we created before:
+
+.. sourcecode:: css
+
+ body { font-family: sans-serif; background: #eee; }
+ a, h1, h2 { color: #377BA8; }
+ h1, h2 { font-family: 'Georgia', serif; margin: 0; }
+ h1 { border-bottom: 2px solid #eee; }
+ h2 { font-size: 1.2em; }
+
+ .page { margin: 2em auto; width: 35em; border: 5px solid #ccc;
+ padding: 0.8em; background: white; }
+ .entries { list-style: none; margin: 0; padding: 0; }
+ .entries li { margin: 0.8em 1.2em; }
+ .entries li h2 { margin-left: -1em; }
+ .add-entry { font-size: 0.9em; border-bottom: 1px solid #ccc; }
+ .add-entry dl { font-weight: bold; }
+ .metanav { text-align: right; font-size: 0.8em; padding: 0.3em;
+ margin-bottom: 1em; background: #fafafa; }
+ .flash { background: #CEE5F5; padding: 0.5em;
+ border: 1px solid #AACBE2; }
+ .error { background: #F0D6D6; padding: 0.5em; }
+
+Continue with :ref:`tutorial-testing`.
diff --git a/app/static/doc/flask-docs/_sources/tutorial/dbcon.txt b/app/static/doc/flask-docs/_sources/tutorial/dbcon.txt
new file mode 100644
index 0000000..99391a2
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/tutorial/dbcon.txt
@@ -0,0 +1,57 @@
+.. _tutorial-dbcon:
+
+Step 4: Request Database Connections
+------------------------------------
+
+Now we know how we can open database connections and use them for scripts,
+but how can we elegantly do that for requests? We will need the database
+connection in all our functions so it makes sense to initialize them
+before each request and shut them down afterwards.
+
+Flask allows us to do that with the :meth:`~flask.Flask.before_request`,
+:meth:`~flask.Flask.after_request` and :meth:`~flask.Flask.teardown_request`
+decorators::
+
+ @app.before_request
+ def before_request():
+ g.db = connect_db()
+
+ @app.teardown_request
+ def teardown_request(exception):
+ g.db.close()
+
+Functions marked with :meth:`~flask.Flask.before_request` are called before
+a request and passed no arguments. Functions marked with
+:meth:`~flask.Flask.after_request` are called after a request and
+passed the response that will be sent to the client. They have to return
+that response object or a different one. They are however not guaranteed
+to be executed if an exception is raised, this is where functions marked with
+:meth:`~flask.Flask.teardown_request` come in. They get called after the
+response has been constructed. They are not allowed to modify the request, and
+their return values are ignored. If an exception occurred while the request was
+being processed, it is passed to each function; otherwise, `None` is passed in.
+
+We store our current database connection on the special :data:`~flask.g`
+object that Flask provides for us. This object stores information for one
+request only and is available from within each function. Never store such
+things on other objects because this would not work with threaded
+environments. That special :data:`~flask.g` object does some magic behind
+the scenes to ensure it does the right thing.
+
+Continue to :ref:`tutorial-views`.
+
+.. hint:: Where do I put this code?
+
+ If you've been following along in this tutorial, you might be wondering
+ where to put the code from this step and the next. A logical place is to
+ group these module-level functions together, and put your new
+ ``before_request`` and ``teardown_request`` functions below your existing
+ ``init_db`` function (following the tutorial line-by-line).
+
+ If you need a moment to find your bearings, take a look at how the `example
+ source`_ is organized. In Flask, you can put all of your application code
+ into a single Python module. You don't have to, and if your app :ref:`grows
+ larger <larger-applications>`, it's a good idea not to.
+
+.. _example source:
+ http://github.com/mitsuhiko/flask/tree/master/examples/flaskr/
diff --git a/app/static/doc/flask-docs/_sources/tutorial/dbinit.txt b/app/static/doc/flask-docs/_sources/tutorial/dbinit.txt
new file mode 100644
index 0000000..b546a1a
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/tutorial/dbinit.txt
@@ -0,0 +1,67 @@
+.. _tutorial-dbinit:
+
+Step 3: Creating The Database
+=============================
+
+Flaskr is a database powered application as outlined earlier, and more
+precisely, an application powered by a relational database system. Such
+systems need a schema that tells them how to store that information. So
+before starting the server for the first time it's important to create
+that schema.
+
+Such a schema can be created by piping the `schema.sql` file into the
+`sqlite3` command as follows::
+
+ sqlite3 /tmp/flaskr.db < schema.sql
+
+The downside of this is that it requires the sqlite3 command to be
+installed which is not necessarily the case on every system. Also one has
+to provide the path to the database there which leaves some place for
+errors. It's a good idea to add a function that initializes the database
+for you to the application.
+
+If you want to do that, you first have to import the
+:func:`contextlib.closing` function from the contextlib package. If you
+want to use Python 2.5 it's also necessary to enable the `with` statement
+first (`__future__` imports must be the very first import)::
+
+ from __future__ import with_statement
+ from contextlib import closing
+
+Next we can create a function called `init_db` that initializes the
+database. For this we can use the `connect_db` function we defined
+earlier. Just add that function below the `connect_db` function::
+
+ def init_db():
+ with closing(connect_db()) as db:
+ with app.open_resource('schema.sql') as f:
+ db.cursor().executescript(f.read())
+ db.commit()
+
+The :func:`~contextlib.closing` helper function allows us to keep a
+connection open for the duration of the `with` block. The
+:func:`~flask.Flask.open_resource` method of the application object
+supports that functionality out of the box, so it can be used in the
+`with` block directly. This function opens a file from the resource
+location (your `flaskr` folder) and allows you to read from it. We are
+using this here to execute a script on the database connection.
+
+When we connect to a database we get a connection object (here called
+`db`) that can give us a cursor. On that cursor there is a method to
+execute a complete script. Finally we only have to commit the changes.
+SQLite 3 and other transactional databases will not commit unless you
+explicitly tell it to.
+
+Now it is possible to create a database by starting up a Python shell and
+importing and calling that function::
+
+>>> from flaskr import init_db
+>>> init_db()
+
+.. admonition:: Troubleshooting
+
+ If you get an exception later that a table cannot be found check that
+ you did call the `init_db` function and that your table names are
+ correct (singular vs. plural for example).
+
+Continue with :ref:`tutorial-dbcon`
diff --git a/app/static/doc/flask-docs/_sources/tutorial/folders.txt b/app/static/doc/flask-docs/_sources/tutorial/folders.txt
new file mode 100644
index 0000000..6108093
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/tutorial/folders.txt
@@ -0,0 +1,23 @@
+.. _tutorial-folders:
+
+Step 0: Creating The Folders
+============================
+
+Before we get started, let's create the folders needed for this
+application::
+
+ /flaskr
+ /static
+ /templates
+
+The `flaskr` folder is not a python package, but just something where we
+drop our files. Directly into this folder we will then put our database
+schema as well as main module in the following steps. The files inside
+the `static` folder are available to users of the application via `HTTP`.
+This is the place where css and javascript files go. Inside the
+`templates` folder Flask will look for `Jinja2`_ templates. The
+templates you create later in the tutorial will go in this directory.
+
+Continue with :ref:`tutorial-schema`.
+
+.. _Jinja2: http://jinja.pocoo.org/2/
diff --git a/app/static/doc/flask-docs/_sources/tutorial/index.txt b/app/static/doc/flask-docs/_sources/tutorial/index.txt
new file mode 100644
index 0000000..3f2d659
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/tutorial/index.txt
@@ -0,0 +1,32 @@
+.. _tutorial:
+
+Tutorial
+========
+
+You want to develop an application with Python and Flask? Here you have
+the chance to learn that by example. In this tutorial we will create a
+simple microblog application. It only supports one user that can create
+text-only entries and there are no feeds or comments, but it still
+features everything you need to get started. We will use Flask and SQLite
+as database which comes out of the box with Python, so there is nothing
+else you need.
+
+If you want the full sourcecode in advance or for comparison, check out
+the `example source`_.
+
+.. _example source:
+ http://github.com/mitsuhiko/flask/tree/master/examples/flaskr/
+
+.. toctree::
+ :maxdepth: 2
+
+ introduction
+ folders
+ schema
+ setup
+ dbinit
+ dbcon
+ views
+ templates
+ css
+ testing
diff --git a/app/static/doc/flask-docs/_sources/tutorial/introduction.txt b/app/static/doc/flask-docs/_sources/tutorial/introduction.txt
new file mode 100644
index 0000000..c72bbd7
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/tutorial/introduction.txt
@@ -0,0 +1,33 @@
+.. _tutorial-introduction:
+
+Introducing Flaskr
+==================
+
+We will call our blogging application flaskr here, feel free to chose a
+less web-2.0-ish name ;) Basically we want it to do the following things:
+
+1. let the user sign in and out with credentials specified in the
+ configuration. Only one user is supported.
+2. when the user is logged in they can add new entries to the page
+ consisting of a text-only title and some HTML for the text. This HTML
+ is not sanitized because we trust the user here.
+3. the page shows all entries so far in reverse order (newest on top) and
+ the user can add new ones from there if logged in.
+
+We will be using SQLite3 directly for that application because it's good
+enough for an application of that size. For larger applications however
+it makes a lot of sense to use `SQLAlchemy`_ that handles database
+connections in a more intelligent way, allows you to target different
+relational databases at once and more. You might also want to consider
+one of the popular NoSQL databases if your data is more suited for those.
+
+Here a screenshot from the final application:
+
+.. image:: ../_static/flaskr.png
+ :align: center
+ :class: screenshot
+ :alt: screenshot of the final application
+
+Continue with :ref:`tutorial-folders`.
+
+.. _SQLAlchemy: http://www.sqlalchemy.org/
diff --git a/app/static/doc/flask-docs/_sources/tutorial/schema.txt b/app/static/doc/flask-docs/_sources/tutorial/schema.txt
new file mode 100644
index 0000000..c078667
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/tutorial/schema.txt
@@ -0,0 +1,25 @@
+.. _tutorial-schema:
+
+Step 1: Database Schema
+=======================
+
+First we want to create the database schema. For this application only a
+single table is needed and we only want to support SQLite so that is quite
+easy. Just put the following contents into a file named `schema.sql` in
+the just created `flaskr` folder:
+
+.. sourcecode:: sql
+
+ drop table if exists entries;
+ create table entries (
+ id integer primary key autoincrement,
+ title string not null,
+ text string not null
+ );
+
+This schema consists of a single table called `entries` and each row in
+this table has an `id`, a `title` and a `text`. The `id` is an
+automatically incrementing integer and a primary key, the other two are
+strings that must not be null.
+
+Continue with :ref:`tutorial-setup`.
diff --git a/app/static/doc/flask-docs/_sources/tutorial/setup.txt b/app/static/doc/flask-docs/_sources/tutorial/setup.txt
new file mode 100644
index 0000000..e9e4d67
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/tutorial/setup.txt
@@ -0,0 +1,90 @@
+.. _tutorial-setup:
+
+Step 2: Application Setup Code
+==============================
+
+Now that we have the schema in place we can create the application module.
+Let's call it `flaskr.py` inside the `flaskr` folder. For starters we
+will add the imports we will need as well as the config section. For
+small applications it's a possibility to drop the configuration directly
+into the module which we will be doing here. However a cleaner solution
+would be to create a separate `.ini` or `.py` file and load that or import
+the values from there.
+
+::
+
+ # all the imports
+ import sqlite3
+ from flask import Flask, request, session, g, redirect, url_for, \
+ abort, render_template, flash
+
+ # configuration
+ DATABASE = '/tmp/flaskr.db'
+ DEBUG = True
+ SECRET_KEY = 'development key'
+ USERNAME = 'admin'
+ PASSWORD = 'default'
+
+Next we can create our actual application and initialize it with the
+config from the same file::
+
+ # create our little application :)
+ app = Flask(__name__)
+ app.config.from_object(__name__)
+
+:meth:`~flask.Config.from_object` will look at the given object (if it's a
+string it will import it) and then look for all uppercase variables
+defined there. In our case, the configuration we just wrote a few lines
+of code above. You can also move that into a separate file.
+
+It is also a good idea to be able to load a configuration from a
+configurable file. This is what :meth:`~flask.Config.from_envvar` can
+do::
+
+ app.config.from_envvar('FLASKR_SETTINGS', silent=True)
+
+That way someone can set an environment variable called
+:envvar:`FLASKR_SETTINGS` to specify a config file to be loaded which will
+then override the default values. The silent switch just tells Flask to
+not complain if no such environment key is set.
+
+The `secret_key` is needed to keep the client-side sessions secure.
+Choose that key wisely and as hard to guess and complex as possible. The
+debug flag enables or disables the interactive debugger. Never leave
+debug mode activated in a production system because it will allow users to
+execute code on the server!
+
+We also add a method to easily connect to the database specified. That
+can be used to open a connection on request and also from the interactive
+Python shell or a script. This will come in handy later.
+
+::
+
+ def connect_db():
+ return sqlite3.connect(app.config['DATABASE'])
+
+Finally we just add a line to the bottom of the file that fires up the
+server if we want to run that file as a standalone application::
+
+ if __name__ == '__main__':
+ app.run()
+
+With that out of the way you should be able to start up the application
+without problems. Do this with the following command::
+
+ python flaskr.py
+
+You will see a message telling you that server has started along with
+the address at which you can access it.
+
+When you head over to the server in your browser you will get an 404
+page not found error because we don't have any views yet. But we will
+focus on that a little later. First we should get the database working.
+
+.. admonition:: Externally Visible Server
+
+ Want your server to be publicly available? Check out the
+ :ref:`externally visible server <public-server>` section for more
+ information.
+
+Continue with :ref:`tutorial-dbinit`.
diff --git a/app/static/doc/flask-docs/_sources/tutorial/templates.txt b/app/static/doc/flask-docs/_sources/tutorial/templates.txt
new file mode 100644
index 0000000..5ec5584
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/tutorial/templates.txt
@@ -0,0 +1,111 @@
+.. _tutorial-templates:
+
+Step 6: The Templates
+=====================
+
+Now we should start working on the templates. If we request the URLs now
+we would only get an exception that Flask cannot find the templates. The
+templates are using `Jinja2`_ syntax and have autoescaping enabled by
+default. This means that unless you mark a value in the code with
+:class:`~flask.Markup` or with the ``|safe`` filter in the template,
+Jinja2 will ensure that special characters such as ``<`` or ``>`` are
+escaped with their XML equivalents.
+
+We are also using template inheritance which makes it possible to reuse
+the layout of the website in all pages.
+
+Put the following templates into the `templates` folder:
+
+.. _Jinja2: http://jinja.pocoo.org/2/documentation/templates
+
+layout.html
+-----------
+
+This template contains the HTML skeleton, the header and a link to log in
+(or log out if the user was already logged in). It also displays the
+flashed messages if there are any. The ``{% block body %}`` block can be
+replaced by a block of the same name (``body``) in a child template.
+
+The :class:`~flask.session` dict is available in the template as well and
+you can use that to check if the user is logged in or not. Note that in
+Jinja you can access missing attributes and items of objects / dicts which
+makes the following code work, even if there is no ``'logged_in'`` key in
+the session:
+
+.. sourcecode:: html+jinja
+
+ <!doctype html>
+ <title>Flaskr</title>
+ <link rel=stylesheet type=text/css href="{{ url_for('static', filename='style.css') }}">
+ <div class=page>
+ <h1>Flaskr</h1>
+ <div class=metanav>
+ {% if not session.logged_in %}
+ <a href="{{ url_for('login') }}">log in</a>
+ {% else %}
+ <a href="{{ url_for('logout') }}">log out</a>
+ {% endif %}
+ </div>
+ {% for message in get_flashed_messages() %}
+ <div class=flash>{{ message }}</div>
+ {% endfor %}
+ {% block body %}{% endblock %}
+ </div>
+
+show_entries.html
+-----------------
+
+This template extends the `layout.html` template from above to display the
+messages. Note that the `for` loop iterates over the messages we passed
+in with the :func:`~flask.render_template` function. We also tell the
+form to submit to your `add_entry` function and use `POST` as `HTTP`
+method:
+
+.. sourcecode:: html+jinja
+
+ {% extends "layout.html" %}
+ {% block body %}
+ {% if session.logged_in %}
+ <form action="{{ url_for('add_entry') }}" method=post class=add-entry>
+ <dl>
+ <dt>Title:
+ <dd><input type=text size=30 name=title>
+ <dt>Text:
+ <dd><textarea name=text rows=5 cols=40></textarea>
+ <dd><input type=submit value=Share>
+ </dl>
+ </form>
+ {% endif %}
+ <ul class=entries>
+ {% for entry in entries %}
+ <li><h2>{{ entry.title }}</h2>{{ entry.text|safe }}
+ {% else %}
+ <li><em>Unbelievable. No entries here so far</em>
+ {% endfor %}
+ </ul>
+ {% endblock %}
+
+login.html
+----------
+
+Finally the login template which basically just displays a form to allow
+the user to login:
+
+.. sourcecode:: html+jinja
+
+ {% extends "layout.html" %}
+ {% block body %}
+ <h2>Login</h2>
+ {% if error %}<p class=error><strong>Error:</strong> {{ error }}{% endif %}
+ <form action="{{ url_for('login') }}" method=post>
+ <dl>
+ <dt>Username:
+ <dd><input type=text name=username>
+ <dt>Password:
+ <dd><input type=password name=password>
+ <dd><input type=submit value=Login>
+ </dl>
+ </form>
+ {% endblock %}
+
+Continue with :ref:`tutorial-css`.
diff --git a/app/static/doc/flask-docs/_sources/tutorial/testing.txt b/app/static/doc/flask-docs/_sources/tutorial/testing.txt
new file mode 100644
index 0000000..34edd79
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/tutorial/testing.txt
@@ -0,0 +1,10 @@
+.. _tutorial-testing:
+
+Bonus: Testing the Application
+==============================
+
+Now that you have finished the application and everything works as
+expected, it's probably not a bad idea to add automated tests to simplify
+modifications in the future. The application above is used as a basic
+example of how to perform unittesting in the :ref:`testing` section of the
+documentation. Go there to see how easy it is to test Flask applications.
diff --git a/app/static/doc/flask-docs/_sources/tutorial/views.txt b/app/static/doc/flask-docs/_sources/tutorial/views.txt
new file mode 100644
index 0000000..93bec3b
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/tutorial/views.txt
@@ -0,0 +1,98 @@
+.. _tutorial-views:
+
+Step 5: The View Functions
+==========================
+
+Now that the database connections are working we can start writing the
+view functions. We will need four of them:
+
+Show Entries
+------------
+
+This view shows all the entries stored in the database. It listens on the
+root of the application and will select title and text from the database.
+The one with the highest id (the newest entry) will be on top. The rows
+returned from the cursor are tuples with the columns ordered like specified
+in the select statement. This is good enough for small applications like
+here, but you might want to convert them into a dict. If you are
+interested in how to do that, check out the :ref:`easy-querying` example.
+
+The view function will pass the entries as dicts to the
+`show_entries.html` template and return the rendered one::
+
+ @app.route('/')
+ def show_entries():
+ cur = g.db.execute('select title, text from entries order by id desc')
+ entries = [dict(title=row[0], text=row[1]) for row in cur.fetchall()]
+ return render_template('show_entries.html', entries=entries)
+
+Add New Entry
+-------------
+
+This view lets the user add new entries if they are logged in. This only
+responds to `POST` requests, the actual form is shown on the
+`show_entries` page. If everything worked out well we will
+:func:`~flask.flash` an information message to the next request and
+redirect back to the `show_entries` page::
+
+ @app.route('/add', methods=['POST'])
+ def add_entry():
+ if not session.get('logged_in'):
+ abort(401)
+ g.db.execute('insert into entries (title, text) values (?, ?)',
+ [request.form['title'], request.form['text']])
+ g.db.commit()
+ flash('New entry was successfully posted')
+ return redirect(url_for('show_entries'))
+
+Note that we check that the user is logged in here (the `logged_in` key is
+present in the session and `True`).
+
+.. admonition:: Security Note
+
+ Be sure to use question marks when building SQL statements, as done in the
+ example above. Otherwise, your app will be vulnerable to SQL injection when
+ you use string formatting to build SQL statements.
+ See :ref:`sqlite3` for more.
+
+Login and Logout
+----------------
+
+These functions are used to sign the user in and out. Login checks the
+username and password against the ones from the configuration and sets the
+`logged_in` key in the session. If the user logged in successfully, that
+key is set to `True`, and the user is redirected back to the `show_entries`
+page. In addition, a message is flashed that informs the user that he or
+she was logged in successfully. If an error occurred, the template is
+notified about that, and the user is asked again::
+
+ @app.route('/login', methods=['GET', 'POST'])
+ def login():
+ error = None
+ if request.method == 'POST':
+ if request.form['username'] != app.config['USERNAME']:
+ error = 'Invalid username'
+ elif request.form['password'] != app.config['PASSWORD']:
+ error = 'Invalid password'
+ else:
+ session['logged_in'] = True
+ flash('You were logged in')
+ return redirect(url_for('show_entries'))
+ return render_template('login.html', error=error)
+
+The logout function, on the other hand, removes that key from the session
+again. We use a neat trick here: if you use the :meth:`~dict.pop` method
+of the dict and pass a second parameter to it (the default), the method
+will delete the key from the dictionary if present or do nothing when that
+key is not in there. This is helpful because now we don't have to check
+if the user was logged in.
+
+::
+
+ @app.route('/logout')
+ def logout():
+ session.pop('logged_in', None)
+ flash('You were logged out')
+ return redirect(url_for('show_entries'))
+
+Continue with :ref:`tutorial-templates`.
diff --git a/app/static/doc/flask-docs/_sources/unicode.txt b/app/static/doc/flask-docs/_sources/unicode.txt
new file mode 100644
index 0000000..413ea84
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/unicode.txt
@@ -0,0 +1,107 @@
+Unicode in Flask
+================
+
+Flask like Jinja2 and Werkzeug is totally Unicode based when it comes to
+text. Not only these libraries, also the majority of web related Python
+libraries that deal with text. If you don't know Unicode so far, you
+should probably read `The Absolute Minimum Every Software Developer
+Absolutely, Positively Must Know About Unicode and Character Sets
+<http://www.joelonsoftware.com/articles/Unicode.html>`_. This part of the
+documentation just tries to cover the very basics so that you have a
+pleasant experience with Unicode related things.
+
+Automatic Conversion
+--------------------
+
+Flask has a few assumptions about your application (which you can change
+of course) that give you basic and painless Unicode support:
+
+- the encoding for text on your website is UTF-8
+- internally you will always use Unicode exclusively for text except
+ for literal strings with only ASCII character points.
+- encoding and decoding happens whenever you are talking over a protocol
+ that requires bytes to be transmitted.
+
+So what does this mean to you?
+
+HTTP is based on bytes. Not only the protocol, also the system used to
+address documents on servers (so called URIs or URLs). However HTML which
+is usually transmitted on top of HTTP supports a large variety of
+character sets and which ones are used, are transmitted in an HTTP header.
+To not make this too complex Flask just assumes that if you are sending
+Unicode out you want it to be UTF-8 encoded. Flask will do the encoding
+and setting of the appropriate headers for you.
+
+The same is true if you are talking to databases with the help of
+SQLAlchemy or a similar ORM system. Some databases have a protocol that
+already transmits Unicode and if they do not, SQLAlchemy or your other ORM
+should take care of that.
+
+The Golden Rule
+---------------
+
+So the rule of thumb: if you are not dealing with binary data, work with
+Unicode. What does working with Unicode in Python 2.x mean?
+
+- as long as you are using ASCII charpoints only (basically numbers,
+ some special characters of latin letters without umlauts or anything
+ fancy) you can use regular string literals (``'Hello World'``).
+- if you need anything else than ASCII in a string you have to mark
+ this string as Unicode string by prefixing it with a lowercase `u`.
+ (like ``u'Hänsel und Gretel'``)
+- if you are using non-Unicode characters in your Python files you have
+ to tell Python which encoding your file uses. Again, I recommend
+ UTF-8 for this purpose. To tell the interpreter your encoding you can
+ put the ``# -*- coding: utf-8 -*-`` into the first or second line of
+ your Python source file.
+- Jinja is configured to decode the template files from UTF-8. So make
+ sure to tell your editor to save the file as UTF-8 there as well.
+
+Encoding and Decoding Yourself
+------------------------------
+
+If you are talking with a filesystem or something that is not really based
+on Unicode you will have to ensure that you decode properly when working
+with Unicode interface. So for example if you want to load a file on the
+filesystem and embed it into a Jinja2 template you will have to decode it
+from the encoding of that file. Here the old problem that text files do
+not specify their encoding comes into play. So do yourself a favour and
+limit yourself to UTF-8 for text files as well.
+
+Anyways. To load such a file with Unicode you can use the built-in
+:meth:`str.decode` method::
+
+ def read_file(filename, charset='utf-8'):
+ with open(filename, 'r') as f:
+ return f.read().decode(charset)
+
+To go from Unicode into a specific charset such as UTF-8 you can use the
+:meth:`unicode.encode` method::
+
+ def write_file(filename, contents, charset='utf-8'):
+ with open(filename, 'w') as f:
+ f.write(contents.encode(charset))
+
+Configuring Editors
+-------------------
+
+Most editors save as UTF-8 by default nowadays but in case your editor is
+not configured to do this you have to change it. Here some common ways to
+set your editor to store as UTF-8:
+
+- Vim: put ``set enc=utf-8`` to your ``.vimrc`` file.
+
+- Emacs: either use an encoding cookie or put this into your ``.emacs``
+ file::
+
+ (prefer-coding-system 'utf-8)
+ (setq default-buffer-file-coding-system 'utf-8)
+
+- Notepad++:
+
+ 1. Go to *Settings -> Preferences ...*
+ 2. Select the "New Document/Default Directory" tab
+ 3. Select "UTF-8 without BOM" as encoding
+
+ It is also recommended to use the Unix newline format, you can select
+ it in the same panel but this is not a requirement.
diff --git a/app/static/doc/flask-docs/_sources/upgrading.txt b/app/static/doc/flask-docs/_sources/upgrading.txt
new file mode 100644
index 0000000..0ba46c1
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/upgrading.txt
@@ -0,0 +1,324 @@
+Upgrading to Newer Releases
+===========================
+
+Flask itself is changing like any software is changing over time. Most of
+the changes are the nice kind, the kind where you don't have to change
+anything in your code to profit from a new release.
+
+However every once in a while there are changes that do require some
+changes in your code or there are changes that make it possible for you to
+improve your own code quality by taking advantage of new features in
+Flask.
+
+This section of the documentation enumerates all the changes in Flask from
+release to release and how you can change your code to have a painless
+updating experience.
+
+If you want to use the `easy_install` command to upgrade your Flask
+installation, make sure to pass it the ``-U`` parameter::
+
+ $ easy_install -U Flask
+
+Version 0.8
+-----------
+
+Flask introduced a new session interface system. We also noticed that
+there was a naming collision between `flask.session` the module that
+implements sessions and :data:`flask.session` which is the global session
+object. With that introduction we moved the implementation details for
+the session system into a new module called :mod:`flask.sessions`. If you
+used the previously undocumented session support we urge you to upgrade.
+
+If invalid JSON data was submitted Flask will now raise a
+:exc:`~werkzeug.exceptions.BadRequest` exception instead of letting the
+default :exc:`ValueError` bubble up. This has the advantage that you no
+longer have to handle that error to avoid an internal server error showing
+up for the user. If you were catching this down explicitly in the past
+as `ValueError` you will need to change this.
+
+Due to a bug in the test client Flask 0.7 did not trigger teardown
+handlers when the test client was used in a with statement. This was
+since fixed but might require some changes in your testsuites if you
+relied on this behavior.
+
+Version 0.7
+-----------
+
+In Flask 0.7 we cleaned up the code base internally a lot and did some
+backwards incompatible changes that make it easier to implement larger
+applications with Flask. Because we want to make upgrading as easy as
+possible we tried to counter the problems arising from these changes by
+providing a script that can ease the transition.
+
+The script scans your whole application and generates an unified diff with
+changes it assumes are safe to apply. However as this is an automated
+tool it won't be able to find all use cases and it might miss some. We
+internally spread a lot of deprecation warnings all over the place to make
+it easy to find pieces of code that it was unable to upgrade.
+
+We strongly recommend that you hand review the generated patchfile and
+only apply the chunks that look good.
+
+If you are using git as version control system for your project we
+recommend applying the patch with ``path -p1 < patchfile.diff`` and then
+using the interactive commit feature to only apply the chunks that look
+good.
+
+To apply the upgrade script do the following:
+
+1. Download the script: `flask-07-upgrade.py
+ <https://raw.github.com/mitsuhiko/flask/master/scripts/flask-07-upgrade.py>`_
+2. Run it in the directory of your application::
+
+ python flask-07-upgrade.py > patchfile.diff
+
+3. Review the generated patchfile.
+4. Apply the patch::
+
+ patch -p1 < patchfile.diff
+
+5. If you were using per-module template folders you need to move some
+ templates around. Previously if you had a folder named ``templates``
+ next to a blueprint named ``admin`` the implicit template path
+ automatically was ``admin/index.html`` for a template file called
+ ``templates/index.html``. This no longer is the case. Now you need
+ to name the template ``templates/admin/index.html``. The tool will
+ not detect this so you will have to do that on your own.
+
+Please note that deprecation warnings are disabled by default starting
+with Python 2.7. In order to see the deprecation warnings that might be
+emitted you have to enabled them with the :mod:`warnings` module.
+
+If you are working with windows and you lack the `patch` command line
+utility you can get it as part of various Unix runtime environments for
+windows including cygwin, msysgit or ming32. Also source control systems
+like svn, hg or git have builtin support for applying unified diffs as
+generated by the tool. Check the manual of your version control system
+for more information.
+
+Bug in Request Locals
+`````````````````````
+
+Due to a bug in earlier implementations the request local proxies now
+raise a :exc:`RuntimeError` instead of an :exc:`AttributeError` when they
+are unbound. If you caught these exceptions with :exc:`AttributeError`
+before, you should catch them with :exc:`RuntimeError` now.
+
+Additionally the :func:`~flask.send_file` function is now issuing
+deprecation warnings if you depend on functionality that will be removed
+in Flask 1.0. Previously it was possible to use etags and mimetypes
+when file objects were passed. This was unreliable and caused issues
+for a few setups. If you get a deprecation warning, make sure to
+update your application to work with either filenames there or disable
+etag attaching and attach them yourself.
+
+Old code::
+
+ return send_file(my_file_object)
+ return send_file(my_file_object)
+
+New code::
+
+ return send_file(my_file_object, add_etags=False)
+
+.. _upgrading-to-new-teardown-handling:
+
+Upgrading to new Teardown Handling
+``````````````````````````````````
+
+We streamlined the behavior of the callbacks for request handling. For
+things that modify the response the :meth:`~flask.Flask.after_request`
+decorators continue to work as expected, but for things that absolutely
+must happen at the end of request we introduced the new
+:meth:`~flask.Flask.teardown_request` decorator. Unfortunately that
+change also made after-request work differently under error conditions.
+It's not consistently skipped if exceptions happen whereas previously it
+might have been called twice to ensure it is executed at the end of the
+request.
+
+If you have database connection code that looks like this::
+
+ @app.after_request
+ def after_request(response):
+ g.db.close()
+ return response
+
+You are now encouraged to use this instead::
+
+ @app.teardown_request
+ def after_request(exception):
+ if hasattr(g, 'db'):
+ g.db.close()
+
+On the upside this change greatly improves the internal code flow and
+makes it easier to customize the dispatching and error handling. This
+makes it now a lot easier to write unit tests as you can prevent closing
+down of database connections for a while. You can take advantage of the
+fact that the teardown callbacks are called when the response context is
+removed from the stack so a test can query the database after request
+handling::
+
+ with app.test_client() as client:
+ resp = client.get('/')
+ # g.db is still bound if there is such a thing
+
+ # and here it's gone
+
+Manual Error Handler Attaching
+``````````````````````````````
+
+While it is still possible to attach error handlers to
+:attr:`Flask.error_handlers` it's discouraged to do so and in fact
+deprecated. In generaly we no longer recommend custom error handler
+attaching via assignments to the underlying dictionary due to the more
+complex internal handling to support arbitrary exception classes and
+blueprints. See :meth:`Flask.errorhandler` for more information.
+
+The proper upgrade is to change this::
+
+ app.error_handlers[403] = handle_error
+
+Into this::
+
+ app.register_error_handler(403, handle_error)
+
+Alternatively you should just attach the function with a decorator::
+
+ @app.errorhandler(403)
+ def handle_error(e):
+ ...
+
+(Note that :meth:`register_error_handler` is new in Flask 0.7)
+
+Blueprint Support
+`````````````````
+
+Blueprints replace the previous concept of “Modules” in Flask. They
+provide better semantics for various features and work better with large
+applications. The update script provided should be able to upgrade your
+applications automatically, but there might be some cases where it fails
+to upgrade. What changed?
+
+- Blueprints need explicit names. Modules had an automatic name
+ guesssing scheme where the shortname for the module was taken from the
+ last part of the import module. The upgrade script tries to guess
+ that name but it might fail as this information could change at
+ runtime.
+- Blueprints have an inverse behavior for :meth:`url_for`. Previously
+ ``.foo`` told :meth:`url_for` that it should look for the endpoint
+ `foo` on the application. Now it means “relative to current module”.
+ The script will inverse all calls to :meth:`url_for` automatically for
+ you. It will do this in a very eager way so you might end up with
+ some unnecessary leading dots in your code if you're not using
+ modules.
+- Blueprints do not automatically provide static folders. They will
+ also no longer automatically export templates from a folder called
+ `templates` next to their location however but it can be enabled from
+ the constructor. Same with static files: if you want to continue
+ serving static files you need to tell the constructor explicitly the
+ path to the static folder (which can be relative to the blueprint's
+ module path).
+- Rendering templates was simplified. Now the blueprints can provide
+ template folders which are added to a general template searchpath.
+ This means that you need to add another subfolder with the blueprint's
+ name into that folder if you want ``blueprintname/template.html`` as
+ the template name.
+
+If you continue to use the `Module` object which is deprecated, Flask will
+restore the previous behavior as good as possible. However we strongly
+recommend upgrading to the new blueprints as they provide a lot of useful
+improvement such as the ability to attach a blueprint multiple times,
+blueprint specific error handlers and a lot more.
+
+
+Version 0.6
+-----------
+
+Flask 0.6 comes with a backwards incompatible change which affects the
+order of after-request handlers. Previously they were called in the order
+of the registration, now they are called in reverse order. This change
+was made so that Flask behaves more like people expected it to work and
+how other systems handle request pre- and postprocessing. If you
+depend on the order of execution of post-request functions, be sure to
+change the order.
+
+Another change that breaks backwards compatibility is that context
+processors will no longer override values passed directly to the template
+rendering function. If for example `request` is as variable passed
+directly to the template, the default context processor will not override
+it with the current request object. This makes it easier to extend
+context processors later to inject additional variables without breaking
+existing template not expecting them.
+
+Version 0.5
+-----------
+
+Flask 0.5 is the first release that comes as a Python package instead of a
+single module. There were a couple of internal refactoring so if you
+depend on undocumented internal details you probably have to adapt the
+imports.
+
+The following changes may be relevant to your application:
+
+- autoescaping no longer happens for all templates. Instead it is
+ configured to only happen on files ending with ``.html``, ``.htm``,
+ ``.xml`` and ``.xhtml``. If you have templates with different
+ extensions you should override the
+ :meth:`~flask.Flask.select_jinja_autoescape` method.
+- Flask no longer supports zipped applications in this release. This
+ functionality might come back in future releases if there is demand
+ for this feature. Removing support for this makes the Flask internal
+ code easier to understand and fixes a couple of small issues that make
+ debugging harder than necessary.
+- The `create_jinja_loader` function is gone. If you want to customize
+ the Jinja loader now, use the
+ :meth:`~flask.Flask.create_jinja_environment` method instead.
+
+Version 0.4
+-----------
+
+For application developers there are no changes that require changes in
+your code. In case you are developing on a Flask extension however, and
+that extension has a unittest-mode you might want to link the activation
+of that mode to the new ``TESTING`` flag.
+
+Version 0.3
+-----------
+
+Flask 0.3 introduces configuration support and logging as well as
+categories for flashing messages. All these are features that are 100%
+backwards compatible but you might want to take advantage of them.
+
+Configuration Support
+`````````````````````
+
+The configuration support makes it easier to write any kind of application
+that requires some sort of configuration. (Which most likely is the case
+for any application out there).
+
+If you previously had code like this::
+
+ app.debug = DEBUG
+ app.secret_key = SECRET_KEY
+
+You no longer have to do that, instead you can just load a configuration
+into the config object. How this works is outlined in :ref:`config`.
+
+Logging Integration
+```````````````````
+
+Flask now configures a logger for you with some basic and useful defaults.
+If you run your application in production and want to profit from
+automatic error logging, you might be interested in attaching a proper log
+handler. Also you can start logging warnings and errors into the logger
+when appropriately. For more information on that, read
+:ref:`application-errors`.
+
+Categories for Flash Messages
+`````````````````````````````
+
+Flash messages can now have categories attached. This makes it possible
+to render errors, warnings or regular messages differently for example.
+This is an opt-in feature because it requires some rethinking in the code.
+
+Read all about that in the :ref:`message-flashing-pattern` pattern.
diff --git a/app/static/doc/flask-docs/_sources/views.txt b/app/static/doc/flask-docs/_sources/views.txt
new file mode 100644
index 0000000..441620a
--- /dev/null
+++ b/app/static/doc/flask-docs/_sources/views.txt
@@ -0,0 +1,227 @@
+.. _views:
+
+Pluggable Views
+===============
+
+.. versionadded:: 0.7
+
+Flask 0.7 introduces pluggable views inspired by the generic views from
+Django which are based on classes instead of functions. The main
+intention is that you can replace parts of the implementations and this
+way have customizable pluggable views.
+
+Basic Principle
+---------------
+
+Consider you have a function that loads a list of objects from the
+database and renders into a template::
+
+ @app.route('/users/')
+ def show_users(page):
+ users = User.query.all()
+ return render_template('users.html', users=users)
+
+This is simple and flexible, but if you want to provide this view in a
+generic fashion that can be adapted to other models and templates as well
+you might want more flexibility. This is where pluggable class based
+views come into place. As the first step to convert this into a class
+based view you would do this::
+
+
+ from flask.views import View
+
+ class ShowUsers(View):
+
+ def dispatch_request(self):
+ users = User.query.all()
+ return render_template('users.html', objects=users)
+
+ app.add_url_rule('/users/', ShowUsers.as_view('show_users'))
+
+As you can see what you have to do is to create a subclass of
+:class:`flask.views.View` and implement
+:meth:`~flask.views.View.dispatch_request`. Then we have to convert that
+class into an actual view function by using the
+:meth:`~flask.views.View.as_view` class method. The string you pass to
+that function is the name of the endpoint that view will then have. But
+this by itself is not helpful, so let's refactor the code a bit::
+
+
+ from flask.views import View
+
+ class ListView(View):
+
+ def get_template_name(self):
+ raise NotImplementedError()
+
+ def render_template(self, context):
+ return render_template(self.get_template_name(), **context)
+
+ def dispatch_request(self):
+ context = {'objects': self.get_objects()}
+ return self.render_template(context)
+
+ class UserView(ListView):
+
+ def get_template_name(self):
+ return 'users.html'
+
+ def get_objects(self):
+ return User.query.all()
+
+This of course is not that helpful for such a small example, but it's good
+enough to explain the basic principle. When you have a class based view
+the question comes up what `self` points to. The way this works is that
+whenever the request is dispatched a new instance of the class is created
+and the :meth:`~flask.views.View.dispatch_request` method is called with
+the parameters from the URL rule. The class itself is instanciated with
+the parameters passed to the :meth:`~flask.views.View.as_view` function.
+For instance you can write a class like this::
+
+ class RenderTemplateView(View):
+ def __init__(self, template_name):
+ self.template_name = template_name
+ def dispatch_request(self):
+ return render_template(self.template_name)
+
+And then you can register it like this::
+
+ app.add_url_rule('/about', view_func=RenderTemplateView.as_view(
+ 'about_page', template_name='about.html'))
+
+Method Hints
+------------
+
+Pluggable views are attached to the application like a regular function by
+either using :func:`~flask.Flask.route` or better
+:meth:`~flask.Flask.add_url_rule`. That however also means that you would
+have to provide the names of the HTTP methods the view supports when you
+attach this. In order to move that information to the class you can
+provide a :attr:`~flask.views.View.methods` attribute that has this
+information::
+
+ class MyView(View):
+ methods = ['GET', 'POST']
+
+ def dispatch_request(self):
+ if request.method == 'POST':
+ ...
+ ...
+
+ app.add_url_rule('/myview', view_func=MyView.as_view('myview'))
+
+Method Based Dispatching
+------------------------
+
+For RESTful APIs it's especially helpful to execute a different function
+for each HTTP method. With the :class:`flask.views.MethodView` you can
+easily do that. Each HTTP method maps to a function with the same name
+(just in lowercase)::
+
+ from flask.views import MethodView
+
+ class UserAPI(MethodView):
+
+ def get(self):
+ users = User.query.all()
+ ...
+
+ def post(self):
+ user = User.from_form_data(request.form)
+ ...
+
+ app.add_url_rule('/users/', view_func=UserAPI.as_view('users'))
+
+That way you also don't have to provide the
+:attr:`~flask.views.View.methods` attribute. It's automatically set based
+on the methods defined in the class.
+
+Decorating Views
+----------------
+
+Since the view class itself is not the view function that is added to the
+routing system it does not make much sense to decorate the class itself.
+Instead you either have to decorate the return value of
+:meth:`~flask.views.View.as_view` by hand::
+
+ view = rate_limited(UserAPI.as_view('users'))
+ app.add_url_rule('/users/', view_func=view)
+
+Starting with Flask 0.8 there is also an alternative way where you can
+specify a list of decorators to apply in the class declaration::
+
+ class UserAPI(MethodView):
+ decorators = [rate_limited]
+
+Due to the implicit self from the caller's perspective you cannot use
+regular view decorators on the individual methods of the view however,
+keep this in mind.
+
+Method Views for APIs
+---------------------
+
+Web APIs are often working very closely with HTTP verbs so it makes a lot
+of sense to implement such an API based on the
+:class:`~flask.views.MethodView`. That said, you will notice that the API
+will require different URL rules that go to the same method view most of
+the time. For instance consider that you are exposing a user object on
+the web:
+
+=============== =============== ======================================
+URL Method Description
+--------------- --------------- --------------------------------------
+``/users/`` ``GET`` Gives a list of all users
+``/users/`` ``POST`` Creates a new user
+``/users/<id>`` ``GET`` Shows a single user
+``/users/<id>`` ``PUT`` Updates a single user
+``/users/<id>`` ``DELETE`` Deletes a single user
+=============== =============== ======================================
+
+So how would you go about doing that with the
+:class:`~flask.views.MethodView`? The trick is to take advantage of the
+fact that you can provide multiple rules to the same view.
+
+Let's assume for the moment the view would look like this::
+
+ class UserAPI(MethodView):
+
+ def get(self, user_id):
+ if user_id is None:
+ # return a list of users
+ pass
+ else:
+ # expose a single user
+ pass
+
+ def post(self):
+ # create a new user
+ pass
+
+ def delete(self, user_id):
+ # delete a single user
+ pass
+
+ def put(self, user_id):
+ # update a single user
+ pass
+
+So how do we hook this up with the routing system? By adding two rules
+and explicitly mentioning the methods for each::
+
+ user_view = UserAPI.as_view('user_api')
+ app.add_url_rule('/users/', defaults={'user_id': None},
+ view_func=user_view, methods=['GET', 'POST'])
+ app.add_url_rule('/users/<int:user_id>', view_func=user_view,
+ methods=['GET', 'PUT', 'DELETE'])
+
+If you have a lot of APIs that look similar you can refactor that
+registration code::
+
+ def register_api(view, endpoint, url, pk='id', pk_type='int'):
+ view_func = view.as_view(endpoint)
+ app.add_url_rule(url, defaults={pk: None},
+ view_func=view_func, methods=['GET', 'POST'])
+ app.add_url_rule('%s<%s:%s>' % (url, pk), view_func=view_func,
+ methods=['GET', 'PUT', 'DELETE'])
+
+ register_api(UserAPI, 'user_api', '/users/', pk='user_id')
diff --git a/app/static/doc/flask-docs/_static/ajax-loader.gif b/app/static/doc/flask-docs/_static/ajax-loader.gif
new file mode 100644
index 0000000..61faf8c
--- /dev/null
+++ b/app/static/doc/flask-docs/_static/ajax-loader.gif
Binary files differ
diff --git a/app/static/doc/flask-docs/_static/basic.css b/app/static/doc/flask-docs/_static/basic.css
new file mode 100644
index 0000000..f0379f3
--- /dev/null
+++ b/app/static/doc/flask-docs/_static/basic.css
@@ -0,0 +1,540 @@
+/*
+ * basic.css
+ * ~~~~~~~~~
+ *
+ * Sphinx stylesheet -- basic theme.
+ *
+ * :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS.
+ * :license: BSD, see LICENSE for details.
+ *
+ */
+
+/* -- main layout ----------------------------------------------------------- */
+
+div.clearer {
+ clear: both;
+}
+
+/* -- relbar ---------------------------------------------------------------- */
+
+div.related {
+ width: 100%;
+ font-size: 90%;
+}
+
+div.related h3 {
+ display: none;
+}
+
+div.related ul {
+ margin: 0;
+ padding: 0 0 0 10px;
+ list-style: none;
+}
+
+div.related li {
+ display: inline;
+}
+
+div.related li.right {
+ float: right;
+ margin-right: 5px;
+}
+
+/* -- sidebar --------------------------------------------------------------- */
+
+div.sphinxsidebarwrapper {
+ padding: 10px 5px 0 10px;
+}
+
+div.sphinxsidebar {
+ float: left;
+ width: 230px;
+ margin-left: -100%;
+ font-size: 90%;
+}
+
+div.sphinxsidebar ul {
+ list-style: none;
+}
+
+div.sphinxsidebar ul ul,
+div.sphinxsidebar ul.want-points {
+ margin-left: 20px;
+ list-style: square;
+}
+
+div.sphinxsidebar ul ul {
+ margin-top: 0;
+ margin-bottom: 0;
+}
+
+div.sphinxsidebar form {
+ margin-top: 10px;
+}
+
+div.sphinxsidebar input {
+ border: 1px solid #98dbcc;
+ font-family: sans-serif;
+ font-size: 1em;
+}
+
+div.sphinxsidebar input[type="text"] {
+ width: 170px;
+}
+
+div.sphinxsidebar input[type="submit"] {
+ width: 30px;
+}
+
+img {
+ border: 0;
+}
+
+/* -- search page ----------------------------------------------------------- */
+
+ul.search {
+ margin: 10px 0 0 20px;
+ padding: 0;
+}
+
+ul.search li {
+ padding: 5px 0 5px 20px;
+ background-image: url(file.png);
+ background-repeat: no-repeat;
+ background-position: 0 7px;
+}
+
+ul.search li a {
+ font-weight: bold;
+}
+
+ul.search li div.context {
+ color: #888;
+ margin: 2px 0 0 30px;
+ text-align: left;
+}
+
+ul.keywordmatches li.goodmatch a {
+ font-weight: bold;
+}
+
+/* -- index page ------------------------------------------------------------ */
+
+table.contentstable {
+ width: 90%;
+}
+
+table.contentstable p.biglink {
+ line-height: 150%;
+}
+
+a.biglink {
+ font-size: 1.3em;
+}
+
+span.linkdescr {
+ font-style: italic;
+ padding-top: 5px;
+ font-size: 90%;
+}
+
+/* -- general index --------------------------------------------------------- */
+
+table.indextable {
+ width: 100%;
+}
+
+table.indextable td {
+ text-align: left;
+ vertical-align: top;
+}
+
+table.indextable dl, table.indextable dd {
+ margin-top: 0;
+ margin-bottom: 0;
+}
+
+table.indextable tr.pcap {
+ height: 10px;
+}
+
+table.indextable tr.cap {
+ margin-top: 10px;
+ background-color: #f2f2f2;
+}
+
+img.toggler {
+ margin-right: 3px;
+ margin-top: 3px;
+ cursor: pointer;
+}
+
+div.modindex-jumpbox {
+ border-top: 1px solid #ddd;
+ border-bottom: 1px solid #ddd;
+ margin: 1em 0 1em 0;
+ padding: 0.4em;
+}
+
+div.genindex-jumpbox {
+ border-top: 1px solid #ddd;
+ border-bottom: 1px solid #ddd;
+ margin: 1em 0 1em 0;
+ padding: 0.4em;
+}
+
+/* -- general body styles --------------------------------------------------- */
+
+a.headerlink {
+ visibility: hidden;
+}
+
+h1:hover > a.headerlink,
+h2:hover > a.headerlink,
+h3:hover > a.headerlink,
+h4:hover > a.headerlink,
+h5:hover > a.headerlink,
+h6:hover > a.headerlink,
+dt:hover > a.headerlink {
+ visibility: visible;
+}
+
+div.body p.caption {
+ text-align: inherit;
+}
+
+div.body td {
+ text-align: left;
+}
+
+.field-list ul {
+ padding-left: 1em;
+}
+
+.first {
+ margin-top: 0 !important;
+}
+
+p.rubric {
+ margin-top: 30px;
+ font-weight: bold;
+}
+
+img.align-left, .figure.align-left, object.align-left {
+ clear: left;
+ float: left;
+ margin-right: 1em;
+}
+
+img.align-right, .figure.align-right, object.align-right {
+ clear: right;
+ float: right;
+ margin-left: 1em;
+}
+
+img.align-center, .figure.align-center, object.align-center {
+ display: block;
+ margin-left: auto;
+ margin-right: auto;
+}
+
+.align-left {
+ text-align: left;
+}
+
+.align-center {
+ text-align: center;
+}
+
+.align-right {
+ text-align: right;
+}
+
+/* -- sidebars -------------------------------------------------------------- */
+
+div.sidebar {
+ margin: 0 0 0.5em 1em;
+ border: 1px solid #ddb;
+ padding: 7px 7px 0 7px;
+ background-color: #ffe;
+ width: 40%;
+ float: right;
+}
+
+p.sidebar-title {
+ font-weight: bold;
+}
+
+/* -- topics ---------------------------------------------------------------- */
+
+div.topic {
+ border: 1px solid #ccc;
+ padding: 7px 7px 0 7px;
+ margin: 10px 0 10px 0;
+}
+
+p.topic-title {
+ font-size: 1.1em;
+ font-weight: bold;
+ margin-top: 10px;
+}
+
+/* -- admonitions ----------------------------------------------------------- */
+
+div.admonition {
+ margin-top: 10px;
+ margin-bottom: 10px;
+ padding: 7px;
+}
+
+div.admonition dt {
+ font-weight: bold;
+}
+
+div.admonition dl {
+ margin-bottom: 0;
+}
+
+p.admonition-title {
+ margin: 0px 10px 5px 0px;
+ font-weight: bold;
+}
+
+div.body p.centered {
+ text-align: center;
+ margin-top: 25px;
+}
+
+/* -- tables ---------------------------------------------------------------- */
+
+table.docutils {
+ border: 0;
+ border-collapse: collapse;
+}
+
+table.docutils td, table.docutils th {
+ padding: 1px 8px 1px 5px;
+ border-top: 0;
+ border-left: 0;
+ border-right: 0;
+ border-bottom: 1px solid #aaa;
+}
+
+table.field-list td, table.field-list th {
+ border: 0 !important;
+}
+
+table.footnote td, table.footnote th {
+ border: 0 !important;
+}
+
+th {
+ text-align: left;
+ padding-right: 5px;
+}
+
+table.citation {
+ border-left: solid 1px gray;
+ margin-left: 1px;
+}
+
+table.citation td {
+ border-bottom: none;
+}
+
+/* -- other body styles ----------------------------------------------------- */
+
+ol.arabic {
+ list-style: decimal;
+}
+
+ol.loweralpha {
+ list-style: lower-alpha;
+}
+
+ol.upperalpha {
+ list-style: upper-alpha;
+}
+
+ol.lowerroman {
+ list-style: lower-roman;
+}
+
+ol.upperroman {
+ list-style: upper-roman;
+}
+
+dl {
+ margin-bottom: 15px;
+}
+
+dd p {
+ margin-top: 0px;
+}
+
+dd ul, dd table {
+ margin-bottom: 10px;
+}
+
+dd {
+ margin-top: 3px;
+ margin-bottom: 10px;
+ margin-left: 30px;
+}
+
+dt:target, .highlighted {
+ background-color: #fbe54e;
+}
+
+dl.glossary dt {
+ font-weight: bold;
+ font-size: 1.1em;
+}
+
+.field-list ul {
+ margin: 0;
+ padding-left: 1em;
+}
+
+.field-list p {
+ margin: 0;
+}
+
+.refcount {
+ color: #060;
+}
+
+.optional {
+ font-size: 1.3em;
+}
+
+.versionmodified {
+ font-style: italic;
+}
+
+.system-message {
+ background-color: #fda;
+ padding: 5px;
+ border: 3px solid red;
+}
+
+.footnote:target {
+ background-color: #ffa;
+}
+
+.line-block {
+ display: block;
+ margin-top: 1em;
+ margin-bottom: 1em;
+}
+
+.line-block .line-block {
+ margin-top: 0;
+ margin-bottom: 0;
+ margin-left: 1.5em;
+}
+
+.guilabel, .menuselection {
+ font-family: sans-serif;
+}
+
+.accelerator {
+ text-decoration: underline;
+}
+
+.classifier {
+ font-style: oblique;
+}
+
+abbr, acronym {
+ border-bottom: dotted 1px;
+ cursor: help;
+}
+
+/* -- code displays --------------------------------------------------------- */
+
+pre {
+ overflow: auto;
+ overflow-y: hidden; /* fixes display issues on Chrome browsers */
+}
+
+td.linenos pre {
+ padding: 5px 0px;
+ border: 0;
+ background-color: transparent;
+ color: #aaa;
+}
+
+table.highlighttable {
+ margin-left: 0.5em;
+}
+
+table.highlighttable td {
+ padding: 0 0.5em 0 0.5em;
+}
+
+tt.descname {
+ background-color: transparent;
+ font-weight: bold;
+ font-size: 1.2em;
+}
+
+tt.descclassname {
+ background-color: transparent;
+}
+
+tt.xref, a tt {
+ background-color: transparent;
+ font-weight: bold;
+}
+
+h1 tt, h2 tt, h3 tt, h4 tt, h5 tt, h6 tt {
+ background-color: transparent;
+}
+
+.viewcode-link {
+ float: right;
+}
+
+.viewcode-back {
+ float: right;
+ font-family: sans-serif;
+}
+
+div.viewcode-block:target {
+ margin: -1px -10px;
+ padding: 0 10px;
+}
+
+/* -- math display ---------------------------------------------------------- */
+
+img.math {
+ vertical-align: middle;
+}
+
+div.body div.math p {
+ text-align: center;
+}
+
+span.eqno {
+ float: right;
+}
+
+/* -- printout stylesheet --------------------------------------------------- */
+
+@media print {
+ div.document,
+ div.documentwrapper,
+ div.bodywrapper {
+ margin: 0 !important;
+ width: 100%;
+ }
+
+ div.sphinxsidebar,
+ div.related,
+ div.footer,
+ #top-link {
+ display: none;
+ }
+} \ No newline at end of file
diff --git a/app/static/doc/flask-docs/_static/comment-bright.png b/app/static/doc/flask-docs/_static/comment-bright.png
new file mode 100644
index 0000000..551517b
--- /dev/null
+++ b/app/static/doc/flask-docs/_static/comment-bright.png
Binary files differ
diff --git a/app/static/doc/flask-docs/_static/comment-close.png b/app/static/doc/flask-docs/_static/comment-close.png
new file mode 100644
index 0000000..09b54be
--- /dev/null
+++ b/app/static/doc/flask-docs/_static/comment-close.png
Binary files differ
diff --git a/app/static/doc/flask-docs/_static/comment.png b/app/static/doc/flask-docs/_static/comment.png
new file mode 100644
index 0000000..92feb52
--- /dev/null
+++ b/app/static/doc/flask-docs/_static/comment.png
Binary files differ
diff --git a/app/static/doc/flask-docs/_static/debugger.png b/app/static/doc/flask-docs/_static/debugger.png
new file mode 100644
index 0000000..4f47229
--- /dev/null
+++ b/app/static/doc/flask-docs/_static/debugger.png
Binary files differ
diff --git a/app/static/doc/flask-docs/_static/doctools.js b/app/static/doc/flask-docs/_static/doctools.js
new file mode 100644
index 0000000..8b9bd2c
--- /dev/null
+++ b/app/static/doc/flask-docs/_static/doctools.js
@@ -0,0 +1,247 @@
+/*
+ * doctools.js
+ * ~~~~~~~~~~~
+ *
+ * Sphinx JavaScript utilties for all documentation.
+ *
+ * :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS.
+ * :license: BSD, see LICENSE for details.
+ *
+ */
+
+/**
+ * select a different prefix for underscore
+ */
+$u = _.noConflict();
+
+/**
+ * make the code below compatible with browsers without
+ * an installed firebug like debugger
+if (!window.console || !console.firebug) {
+ var names = ["log", "debug", "info", "warn", "error", "assert", "dir",
+ "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace",
+ "profile", "profileEnd"];
+ window.console = {};
+ for (var i = 0; i < names.length; ++i)
+ window.console[names[i]] = function() {};
+}
+ */
+
+/**
+ * small helper function to urldecode strings
+ */
+jQuery.urldecode = function(x) {
+ return decodeURIComponent(x).replace(/\+/g, ' ');
+}
+
+/**
+ * small helper function to urlencode strings
+ */
+jQuery.urlencode = encodeURIComponent;
+
+/**
+ * This function returns the parsed url parameters of the
+ * current request. Multiple values per key are supported,
+ * it will always return arrays of strings for the value parts.
+ */
+jQuery.getQueryParameters = function(s) {
+ if (typeof s == 'undefined')
+ s = document.location.search;
+ var parts = s.substr(s.indexOf('?') + 1).split('&');
+ var result = {};
+ for (var i = 0; i < parts.length; i++) {
+ var tmp = parts[i].split('=', 2);
+ var key = jQuery.urldecode(tmp[0]);
+ var value = jQuery.urldecode(tmp[1]);
+ if (key in result)
+ result[key].push(value);
+ else
+ result[key] = [value];
+ }
+ return result;
+};
+
+/**
+ * small function to check if an array contains
+ * a given item.
+ */
+jQuery.contains = function(arr, item) {
+ for (var i = 0; i < arr.length; i++) {
+ if (arr[i] == item)
+ return true;
+ }
+ return false;
+};
+
+/**
+ * highlight a given string on a jquery object by wrapping it in
+ * span elements with the given class name.
+ */
+jQuery.fn.highlightText = function(text, className) {
+ function highlight(node) {
+ if (node.nodeType == 3) {
+ var val = node.nodeValue;
+ var pos = val.toLowerCase().indexOf(text);
+ if (pos >= 0 && !jQuery(node.parentNode).hasClass(className)) {
+ var span = document.createElement("span");
+ span.className = className;
+ span.appendChild(document.createTextNode(val.substr(pos, text.length)));
+ node.parentNode.insertBefore(span, node.parentNode.insertBefore(
+ document.createTextNode(val.substr(pos + text.length)),
+ node.nextSibling));
+ node.nodeValue = val.substr(0, pos);
+ }
+ }
+ else if (!jQuery(node).is("button, select, textarea")) {
+ jQuery.each(node.childNodes, function() {
+ highlight(this);
+ });
+ }
+ }
+ return this.each(function() {
+ highlight(this);
+ });
+};
+
+/**
+ * Small JavaScript module for the documentation.
+ */
+var Documentation = {
+
+ init : function() {
+ this.fixFirefoxAnchorBug();
+ this.highlightSearchWords();
+ this.initIndexTable();
+ },
+
+ /**
+ * i18n support
+ */
+ TRANSLATIONS : {},
+ PLURAL_EXPR : function(n) { return n == 1 ? 0 : 1; },
+ LOCALE : 'unknown',
+
+ // gettext and ngettext don't access this so that the functions
+ // can safely bound to a different name (_ = Documentation.gettext)
+ gettext : function(string) {
+ var translated = Documentation.TRANSLATIONS[string];
+ if (typeof translated == 'undefined')
+ return string;
+ return (typeof translated == 'string') ? translated : translated[0];
+ },
+
+ ngettext : function(singular, plural, n) {
+ var translated = Documentation.TRANSLATIONS[singular];
+ if (typeof translated == 'undefined')
+ return (n == 1) ? singular : plural;
+ return translated[Documentation.PLURALEXPR(n)];
+ },
+
+ addTranslations : function(catalog) {
+ for (var key in catalog.messages)
+ this.TRANSLATIONS[key] = catalog.messages[key];
+ this.PLURAL_EXPR = new Function('n', 'return +(' + catalog.plural_expr + ')');
+ this.LOCALE = catalog.locale;
+ },
+
+ /**
+ * add context elements like header anchor links
+ */
+ addContextElements : function() {
+ $('div[id] > :header:first').each(function() {
+ $('<a class="headerlink">\u00B6</a>').
+ attr('href', '#' + this.id).
+ attr('title', _('Permalink to this headline')).
+ appendTo(this);
+ });
+ $('dt[id]').each(function() {
+ $('<a class="headerlink">\u00B6</a>').
+ attr('href', '#' + this.id).
+ attr('title', _('Permalink to this definition')).
+ appendTo(this);
+ });
+ },
+
+ /**
+ * workaround a firefox stupidity
+ */
+ fixFirefoxAnchorBug : function() {
+ if (document.location.hash && $.browser.mozilla)
+ window.setTimeout(function() {
+ document.location.href += '';
+ }, 10);
+ },
+
+ /**
+ * highlight the search words provided in the url in the text
+ */
+ highlightSearchWords : function() {
+ var params = $.getQueryParameters();
+ var terms = (params.highlight) ? params.highlight[0].split(/\s+/) : [];
+ if (terms.length) {
+ var body = $('div.body');
+ window.setTimeout(function() {
+ $.each(terms, function() {
+ body.highlightText(this.toLowerCase(), 'highlighted');
+ });
+ }, 10);
+ $('<li class="highlight-link"><a href="javascript:Documentation.' +
+ 'hideSearchWords()">' + _('Hide Search Matches') + '</a></li>')
+ .appendTo($('.sidebar .this-page-menu'));
+ }
+ },
+
+ /**
+ * init the domain index toggle buttons
+ */
+ initIndexTable : function() {
+ var togglers = $('img.toggler').click(function() {
+ var src = $(this).attr('src');
+ var idnum = $(this).attr('id').substr(7);
+ $('tr.cg-' + idnum).toggle();
+ if (src.substr(-9) == 'minus.png')
+ $(this).attr('src', src.substr(0, src.length-9) + 'plus.png');
+ else
+ $(this).attr('src', src.substr(0, src.length-8) + 'minus.png');
+ }).css('display', '');
+ if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) {
+ togglers.click();
+ }
+ },
+
+ /**
+ * helper function to hide the search marks again
+ */
+ hideSearchWords : function() {
+ $('.sidebar .this-page-menu li.highlight-link').fadeOut(300);
+ $('span.highlighted').removeClass('highlighted');
+ },
+
+ /**
+ * make the url absolute
+ */
+ makeURL : function(relativeURL) {
+ return DOCUMENTATION_OPTIONS.URL_ROOT + '/' + relativeURL;
+ },
+
+ /**
+ * get the current relative url
+ */
+ getCurrentURL : function() {
+ var path = document.location.pathname;
+ var parts = path.split(/\//);
+ $.each(DOCUMENTATION_OPTIONS.URL_ROOT.split(/\//), function() {
+ if (this == '..')
+ parts.pop();
+ });
+ var url = parts.join('/');
+ return path.substring(url.lastIndexOf('/') + 1, path.length - 1);
+ }
+};
+
+// quick alias for translations
+_ = Documentation.gettext;
+
+$(document).ready(function() {
+ Documentation.init();
+});
diff --git a/app/static/doc/flask-docs/_static/down-pressed.png b/app/static/doc/flask-docs/_static/down-pressed.png
new file mode 100644
index 0000000..6f7ad78
--- /dev/null
+++ b/app/static/doc/flask-docs/_static/down-pressed.png
Binary files differ
diff --git a/app/static/doc/flask-docs/_static/down.png b/app/static/doc/flask-docs/_static/down.png
new file mode 100644
index 0000000..3003a88
--- /dev/null
+++ b/app/static/doc/flask-docs/_static/down.png
Binary files differ
diff --git a/app/static/doc/flask-docs/_static/file.png b/app/static/doc/flask-docs/_static/file.png
new file mode 100644
index 0000000..d18082e
--- /dev/null
+++ b/app/static/doc/flask-docs/_static/file.png
Binary files differ
diff --git a/app/static/doc/flask-docs/_static/flask.png b/app/static/doc/flask-docs/_static/flask.png
new file mode 100644
index 0000000..5c603cc
--- /dev/null
+++ b/app/static/doc/flask-docs/_static/flask.png
Binary files differ
diff --git a/app/static/doc/flask-docs/_static/flaskr.png b/app/static/doc/flask-docs/_static/flaskr.png
new file mode 100644
index 0000000..07d027d
--- /dev/null
+++ b/app/static/doc/flask-docs/_static/flaskr.png
Binary files differ
diff --git a/app/static/doc/flask-docs/_static/flasky.css b/app/static/doc/flask-docs/_static/flasky.css
new file mode 100644
index 0000000..48bebc8
--- /dev/null
+++ b/app/static/doc/flask-docs/_static/flasky.css
@@ -0,0 +1,387 @@
+/*
+ * flasky.css_t
+ * ~~~~~~~~~~~~
+ *
+ * :copyright: Copyright 2010 by Armin Ronacher.
+ * :license: Flask Design License, see LICENSE for details.
+ */
+
+
+
+
+@import url("basic.css");
+
+/* -- page layout ----------------------------------------------------------- */
+
+body {
+ font-family: 'Georgia', serif;
+ font-size: 17px;
+ background-color: #c0c0c0;
+ color: #000;
+ margin: 0;
+ padding: 0;
+}
+
+div.document {
+ width: 940px;
+ margin: 30px auto 0 auto;
+}
+
+div.documentwrapper {
+ float: left;
+ width: 100%;
+}
+
+div.bodywrapper {
+ margin: 0 0 0 220px;
+}
+
+div.sphinxsidebar {
+ width: 220px;
+}
+
+hr {
+ border: 1px solid #B1B4B6;
+}
+
+div.body {
+ background-color: #ffffff;
+ color: #3E4349;
+ padding: 0 30px 0 30px;
+}
+
+img.floatingflask {
+ padding: 0 0 10px 10px;
+ float: right;
+}
+
+div.footer {
+ width: 940px;
+ margin: 20px auto 30px auto;
+ font-size: 14px;
+ color: #888;
+ text-align: right;
+}
+
+div.footer a {
+ color: #888;
+}
+
+div.related {
+ display: none;
+}
+
+div.sphinxsidebar a {
+ color: #444;
+ text-decoration: none;
+ border-bottom: 1px dotted #999;
+}
+
+div.sphinxsidebar a:hover {
+ border-bottom: 1px solid #999;
+}
+
+div.sphinxsidebar {
+ font-size: 14px;
+ line-height: 1.5;
+}
+
+div.sphinxsidebarwrapper {
+ padding: 18px 10px;
+}
+
+div.sphinxsidebarwrapper p.logo {
+ padding: 0 0 20px 0;
+ margin: 0;
+ text-align: center;
+}
+
+div.sphinxsidebar h3,
+div.sphinxsidebar h4 {
+ font-family: 'Garamond', 'Georgia', serif;
+ color: #444;
+ font-size: 24px;
+ font-weight: normal;
+ margin: 0 0 5px 0;
+ padding: 0;
+}
+
+div.sphinxsidebar h4 {
+ font-size: 20px;
+}
+
+div.sphinxsidebar h3 a {
+ color: #444;
+}
+
+div.sphinxsidebar p.logo a,
+div.sphinxsidebar h3 a,
+div.sphinxsidebar p.logo a:hover,
+div.sphinxsidebar h3 a:hover {
+ border: none;
+}
+
+div.sphinxsidebar p {
+ color: #555;
+ margin: 10px 0;
+}
+
+div.sphinxsidebar ul {
+ margin: 10px 0;
+ padding: 0;
+ color: #000;
+}
+
+div.sphinxsidebar input {
+ border: 1px solid #ccc;
+ font-family: 'Georgia', serif;
+ font-size: 1em;
+}
+
+/* -- body styles ----------------------------------------------------------- */
+
+a {
+ color: #004B6B;
+ text-decoration: underline;
+}
+
+a:hover {
+ color: #6D4100;
+ text-decoration: underline;
+}
+
+div.body h1,
+div.body h2,
+div.body h3,
+div.body h4,
+div.body h5,
+div.body h6 {
+ font-family: 'Garamond', 'Georgia', serif;
+ font-weight: normal;
+ margin: 30px 0px 10px 0px;
+ padding: 0;
+}
+
+div.body h1 { margin-top: 0; padding-top: 0; font-size: 240%; }
+div.body h2 { font-size: 180%; }
+div.body h3 { font-size: 150%; }
+div.body h4 { font-size: 130%; }
+div.body h5 { font-size: 100%; }
+div.body h6 { font-size: 100%; }
+
+a.headerlink {
+ color: #ddd;
+ padding: 0 4px;
+ text-decoration: none;
+}
+
+a.headerlink:hover {
+ color: #444;
+ background: #eaeaea;
+}
+
+div.body p, div.body dd, div.body li {
+ line-height: 1.4em;
+}
+
+div.admonition {
+ background: #fafafa;
+ margin: 20px -30px;
+ padding: 10px 30px;
+ border-top: 1px solid #ccc;
+ border-bottom: 1px solid #ccc;
+}
+
+div.admonition tt.xref, div.admonition a tt {
+ border-bottom: 1px solid #fafafa;
+}
+
+dd div.admonition {
+ margin-left: -60px;
+ padding-left: 60px;
+}
+
+div.admonition p.admonition-title {
+ font-family: 'Garamond', 'Georgia', serif;
+ font-weight: normal;
+ font-size: 24px;
+ margin: 0 0 10px 0;
+ padding: 0;
+ line-height: 1;
+}
+
+div.admonition p.last {
+ margin-bottom: 0;
+}
+
+div.highlight {
+ background-color: white;
+}
+
+dt:target, .highlight {
+ background: #FAF3E8;
+}
+
+div.note {
+ background-color: #eee;
+ border: 1px solid #ccc;
+}
+
+div.seealso {
+ background-color: #ffc;
+ border: 1px solid #ff6;
+}
+
+div.topic {
+ background-color: #eee;
+}
+
+p.admonition-title {
+ display: inline;
+}
+
+p.admonition-title:after {
+ content: ":";
+}
+
+pre, tt {
+ font-family: 'Consolas', 'Menlo', 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
+ font-size: 0.9em;
+}
+
+img.screenshot {
+}
+
+tt.descname, tt.descclassname {
+ font-size: 0.95em;
+}
+
+tt.descname {
+ padding-right: 0.08em;
+}
+
+img.screenshot {
+ -moz-box-shadow: 2px 2px 4px #eee;
+ -webkit-box-shadow: 2px 2px 4px #eee;
+ box-shadow: 2px 2px 4px #eee;
+}
+
+table.docutils {
+ border: 1px solid #888;
+ -moz-box-shadow: 2px 2px 4px #eee;
+ -webkit-box-shadow: 2px 2px 4px #eee;
+ box-shadow: 2px 2px 4px #eee;
+}
+
+table.docutils td, table.docutils th {
+ border: 1px solid #888;
+ padding: 0.25em 0.7em;
+}
+
+table.field-list, table.footnote {
+ border: none;
+ -moz-box-shadow: none;
+ -webkit-box-shadow: none;
+ box-shadow: none;
+}
+
+table.footnote {
+ margin: 15px 0;
+ width: 100%;
+ border: 1px solid #eee;
+ background: #fdfdfd;
+ font-size: 0.9em;
+}
+
+table.footnote + table.footnote {
+ margin-top: -15px;
+ border-top: none;
+}
+
+table.field-list th {
+ padding: 0 0.8em 0 0;
+}
+
+table.field-list td {
+ padding: 0;
+}
+
+table.footnote td.label {
+ width: 0px;
+ padding: 0.3em 0 0.3em 0.5em;
+}
+
+table.footnote td {
+ padding: 0.3em 0.5em;
+}
+
+dl {
+ margin: 0;
+ padding: 0;
+}
+
+dl dd {
+ margin-left: 30px;
+}
+
+blockquote {
+ margin: 0 0 0 30px;
+ padding: 0;
+}
+
+ul, ol {
+ margin: 10px 0 10px 30px;
+ padding: 0;
+}
+
+pre {
+ background: #eee;
+ padding: 7px 30px;
+ margin: 15px -30px;
+ line-height: 1.3em;
+}
+
+dl pre, blockquote pre, li pre {
+ margin-left: -60px;
+ padding-left: 60px;
+}
+
+dl dl pre {
+ margin-left: -90px;
+ padding-left: 90px;
+}
+
+tt {
+ background-color: #ecf0f3;
+ color: #222;
+ /* padding: 1px 2px; */
+}
+
+tt.xref, a tt {
+ background-color: #FBFBFB;
+ border-bottom: 1px solid white;
+}
+
+a.reference {
+ text-decoration: none;
+ border-bottom: 1px dotted #004B6B;
+}
+
+a.reference:hover {
+ border-bottom: 1px solid #6D4100;
+}
+
+a.footnote-reference {
+ text-decoration: none;
+ font-size: 0.7em;
+ vertical-align: top;
+ border-bottom: 1px dotted #004B6B;
+}
+
+a.footnote-reference:hover {
+ border-bottom: 1px solid #6D4100;
+}
+
+a:hover tt {
+ background: #EEE;
+}
diff --git a/app/static/doc/flask-docs/_static/jquery.js b/app/static/doc/flask-docs/_static/jquery.js
new file mode 100644
index 0000000..7c24308
--- /dev/null
+++ b/app/static/doc/flask-docs/_static/jquery.js
@@ -0,0 +1,154 @@
+/*!
+ * jQuery JavaScript Library v1.4.2
+ * http://jquery.com/
+ *
+ * Copyright 2010, John Resig
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * Includes Sizzle.js
+ * http://sizzlejs.com/
+ * Copyright 2010, The Dojo Foundation
+ * Released under the MIT, BSD, and GPL Licenses.
+ *
+ * Date: Sat Feb 13 22:33:48 2010 -0500
+ */
+(function(A,w){function ma(){if(!c.isReady){try{s.documentElement.doScroll("left")}catch(a){setTimeout(ma,1);return}c.ready()}}function Qa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function X(a,b,d,f,e,j){var i=a.length;if(typeof b==="object"){for(var o in b)X(a,o,b[o],f,e,d);return a}if(d!==w){f=!j&&f&&c.isFunction(d);for(o=0;o<i;o++)e(a[o],b,f?d.call(a[o],o,e(a[o],b)):d,j);return a}return i?
+e(a[0],b):w}function J(){return(new Date).getTime()}function Y(){return false}function Z(){return true}function na(a,b,d){d[0].type=a;return c.event.handle.apply(b,d)}function oa(a){var b,d=[],f=[],e=arguments,j,i,o,k,n,r;i=c.data(this,"events");if(!(a.liveFired===this||!i||!i.live||a.button&&a.type==="click")){a.liveFired=this;var u=i.live.slice(0);for(k=0;k<u.length;k++){i=u[k];i.origType.replace(O,"")===a.type?f.push(i.selector):u.splice(k--,1)}j=c(a.target).closest(f,a.currentTarget);n=0;for(r=
+j.length;n<r;n++)for(k=0;k<u.length;k++){i=u[k];if(j[n].selector===i.selector){o=j[n].elem;f=null;if(i.preType==="mouseenter"||i.preType==="mouseleave")f=c(a.relatedTarget).closest(i.selector)[0];if(!f||f!==o)d.push({elem:o,handleObj:i})}}n=0;for(r=d.length;n<r;n++){j=d[n];a.currentTarget=j.elem;a.data=j.handleObj.data;a.handleObj=j.handleObj;if(j.handleObj.origHandler.apply(j.elem,e)===false){b=false;break}}return b}}function pa(a,b){return"live."+(a&&a!=="*"?a+".":"")+b.replace(/\./g,"`").replace(/ /g,
+"&")}function qa(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function ra(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var f=c.data(a[d++]),e=c.data(this,f);if(f=f&&f.events){delete e.handle;e.events={};for(var j in f)for(var i in f[j])c.event.add(this,j,f[j][i],f[j][i].data)}}})}function sa(a,b,d){var f,e,j;b=b&&b[0]?b[0].ownerDocument||b[0]:s;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&b===s&&!ta.test(a[0])&&(c.support.checkClone||!ua.test(a[0]))){e=
+true;if(j=c.fragments[a[0]])if(j!==1)f=j}if(!f){f=b.createDocumentFragment();c.clean(a,b,f,d)}if(e)c.fragments[a[0]]=j?f:1;return{fragment:f,cacheable:e}}function K(a,b){var d={};c.each(va.concat.apply([],va.slice(0,b)),function(){d[this]=a});return d}function wa(a){return"scrollTo"in a&&a.document?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var c=function(a,b){return new c.fn.init(a,b)},Ra=A.jQuery,Sa=A.$,s=A.document,T,Ta=/^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/,Ua=/^.[^:#\[\.,]*$/,Va=/\S/,
+Wa=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,Xa=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,P=navigator.userAgent,xa=false,Q=[],L,$=Object.prototype.toString,aa=Object.prototype.hasOwnProperty,ba=Array.prototype.push,R=Array.prototype.slice,ya=Array.prototype.indexOf;c.fn=c.prototype={init:function(a,b){var d,f;if(!a)return this;if(a.nodeType){this.context=this[0]=a;this.length=1;return this}if(a==="body"&&!b){this.context=s;this[0]=s.body;this.selector="body";this.length=1;return this}if(typeof a==="string")if((d=Ta.exec(a))&&
+(d[1]||!b))if(d[1]){f=b?b.ownerDocument||b:s;if(a=Xa.exec(a))if(c.isPlainObject(b)){a=[s.createElement(a[1])];c.fn.attr.call(a,b,true)}else a=[f.createElement(a[1])];else{a=sa([d[1]],[f]);a=(a.cacheable?a.fragment.cloneNode(true):a.fragment).childNodes}return c.merge(this,a)}else{if(b=s.getElementById(d[2])){if(b.id!==d[2])return T.find(a);this.length=1;this[0]=b}this.context=s;this.selector=a;return this}else if(!b&&/^\w+$/.test(a)){this.selector=a;this.context=s;a=s.getElementsByTagName(a);return c.merge(this,
+a)}else return!b||b.jquery?(b||T).find(a):c(b).find(a);else if(c.isFunction(a))return T.ready(a);if(a.selector!==w){this.selector=a.selector;this.context=a.context}return c.makeArray(a,this)},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length},toArray:function(){return R.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this.slice(a)[0]:this[a]},pushStack:function(a,b,d){var f=c();c.isArray(a)?ba.apply(f,a):c.merge(f,a);f.prevObject=this;f.context=this.context;if(b===
+"find")f.selector=this.selector+(this.selector?" ":"")+d;else if(b)f.selector=this.selector+"."+b+"("+d+")";return f},each:function(a,b){return c.each(this,a,b)},ready:function(a){c.bindReady();if(c.isReady)a.call(s,c);else Q&&Q.push(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(R.apply(this,arguments),"slice",R.call(arguments).join(","))},map:function(a){return this.pushStack(c.map(this,
+function(b,d){return a.call(b,d,b)}))},end:function(){return this.prevObject||c(null)},push:ba,sort:[].sort,splice:[].splice};c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a=arguments[0]||{},b=1,d=arguments.length,f=false,e,j,i,o;if(typeof a==="boolean"){f=a;a=arguments[1]||{};b=2}if(typeof a!=="object"&&!c.isFunction(a))a={};if(d===b){a=this;--b}for(;b<d;b++)if((e=arguments[b])!=null)for(j in e){i=a[j];o=e[j];if(a!==o)if(f&&o&&(c.isPlainObject(o)||c.isArray(o))){i=i&&(c.isPlainObject(i)||
+c.isArray(i))?i:c.isArray(o)?[]:{};a[j]=c.extend(f,i,o)}else if(o!==w)a[j]=o}return a};c.extend({noConflict:function(a){A.$=Sa;if(a)A.jQuery=Ra;return c},isReady:false,ready:function(){if(!c.isReady){if(!s.body)return setTimeout(c.ready,13);c.isReady=true;if(Q){for(var a,b=0;a=Q[b++];)a.call(s,c);Q=null}c.fn.triggerHandler&&c(s).triggerHandler("ready")}},bindReady:function(){if(!xa){xa=true;if(s.readyState==="complete")return c.ready();if(s.addEventListener){s.addEventListener("DOMContentLoaded",
+L,false);A.addEventListener("load",c.ready,false)}else if(s.attachEvent){s.attachEvent("onreadystatechange",L);A.attachEvent("onload",c.ready);var a=false;try{a=A.frameElement==null}catch(b){}s.documentElement.doScroll&&a&&ma()}}},isFunction:function(a){return $.call(a)==="[object Function]"},isArray:function(a){return $.call(a)==="[object Array]"},isPlainObject:function(a){if(!a||$.call(a)!=="[object Object]"||a.nodeType||a.setInterval)return false;if(a.constructor&&!aa.call(a,"constructor")&&!aa.call(a.constructor.prototype,
+"isPrototypeOf"))return false;var b;for(b in a);return b===w||aa.call(a,b)},isEmptyObject:function(a){for(var b in a)return false;return true},error:function(a){throw a;},parseJSON:function(a){if(typeof a!=="string"||!a)return null;a=c.trim(a);if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return A.JSON&&A.JSON.parse?A.JSON.parse(a):(new Function("return "+
+a))();else c.error("Invalid JSON: "+a)},noop:function(){},globalEval:function(a){if(a&&Va.test(a)){var b=s.getElementsByTagName("head")[0]||s.documentElement,d=s.createElement("script");d.type="text/javascript";if(c.support.scriptEval)d.appendChild(s.createTextNode(a));else d.text=a;b.insertBefore(d,b.firstChild);b.removeChild(d)}},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,b,d){var f,e=0,j=a.length,i=j===w||c.isFunction(a);if(d)if(i)for(f in a){if(b.apply(a[f],
+d)===false)break}else for(;e<j;){if(b.apply(a[e++],d)===false)break}else if(i)for(f in a){if(b.call(a[f],f,a[f])===false)break}else for(d=a[0];e<j&&b.call(d,e,d)!==false;d=a[++e]);return a},trim:function(a){return(a||"").replace(Wa,"")},makeArray:function(a,b){b=b||[];if(a!=null)a.length==null||typeof a==="string"||c.isFunction(a)||typeof a!=="function"&&a.setInterval?ba.call(b,a):c.merge(b,a);return b},inArray:function(a,b){if(b.indexOf)return b.indexOf(a);for(var d=0,f=b.length;d<f;d++)if(b[d]===
+a)return d;return-1},merge:function(a,b){var d=a.length,f=0;if(typeof b.length==="number")for(var e=b.length;f<e;f++)a[d++]=b[f];else for(;b[f]!==w;)a[d++]=b[f++];a.length=d;return a},grep:function(a,b,d){for(var f=[],e=0,j=a.length;e<j;e++)!d!==!b(a[e],e)&&f.push(a[e]);return f},map:function(a,b,d){for(var f=[],e,j=0,i=a.length;j<i;j++){e=b(a[j],j,d);if(e!=null)f[f.length]=e}return f.concat.apply([],f)},guid:1,proxy:function(a,b,d){if(arguments.length===2)if(typeof b==="string"){d=a;a=d[b];b=w}else if(b&&
+!c.isFunction(b)){d=b;b=w}if(!b&&a)b=function(){return a.apply(d||this,arguments)};if(a)b.guid=a.guid=a.guid||b.guid||c.guid++;return b},uaMatch:function(a){a=a.toLowerCase();a=/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version)?[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||!/compatible/.test(a)&&/(mozilla)(?:.*? rv:([\w.]+))?/.exec(a)||[];return{browser:a[1]||"",version:a[2]||"0"}},browser:{}});P=c.uaMatch(P);if(P.browser){c.browser[P.browser]=true;c.browser.version=P.version}if(c.browser.webkit)c.browser.safari=
+true;if(ya)c.inArray=function(a,b){return ya.call(b,a)};T=c(s);if(s.addEventListener)L=function(){s.removeEventListener("DOMContentLoaded",L,false);c.ready()};else if(s.attachEvent)L=function(){if(s.readyState==="complete"){s.detachEvent("onreadystatechange",L);c.ready()}};(function(){c.support={};var a=s.documentElement,b=s.createElement("script"),d=s.createElement("div"),f="script"+J();d.style.display="none";d.innerHTML=" <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
+var e=d.getElementsByTagName("*"),j=d.getElementsByTagName("a")[0];if(!(!e||!e.length||!j)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(j.getAttribute("style")),hrefNormalized:j.getAttribute("href")==="/a",opacity:/^0.55$/.test(j.style.opacity),cssFloat:!!j.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:s.createElement("select").appendChild(s.createElement("option")).selected,
+parentNode:d.removeChild(d.appendChild(s.createElement("div"))).parentNode===null,deleteExpando:true,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};b.type="text/javascript";try{b.appendChild(s.createTextNode("window."+f+"=1;"))}catch(i){}a.insertBefore(b,a.firstChild);if(A[f]){c.support.scriptEval=true;delete A[f]}try{delete b.test}catch(o){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function k(){c.support.noCloneEvent=
+false;d.detachEvent("onclick",k)});d.cloneNode(true).fireEvent("onclick")}d=s.createElement("div");d.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";a=s.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var k=s.createElement("div");k.style.width=k.style.paddingLeft="1px";s.body.appendChild(k);c.boxModel=c.support.boxModel=k.offsetWidth===2;s.body.removeChild(k).style.display="none"});a=function(k){var n=
+s.createElement("div");k="on"+k;var r=k in n;if(!r){n.setAttribute(k,"return;");r=typeof n[k]==="function"}return r};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=e=j=null}})();c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var G="jQuery"+J(),Ya=0,za={};c.extend({cache:{},expando:G,noData:{embed:true,object:true,
+applet:true},data:function(a,b,d){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var f=a[G],e=c.cache;if(!f&&typeof b==="string"&&d===w)return null;f||(f=++Ya);if(typeof b==="object"){a[G]=f;e[f]=c.extend(true,{},b)}else if(!e[f]){a[G]=f;e[f]={}}a=e[f];if(d!==w)a[b]=d;return typeof b==="string"?a[b]:a}},removeData:function(a,b){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var d=a[G],f=c.cache,e=f[d];if(b){if(e){delete e[b];c.isEmptyObject(e)&&c.removeData(a)}}else{if(c.support.deleteExpando)delete a[c.expando];
+else a.removeAttribute&&a.removeAttribute(c.expando);delete f[d]}}}});c.fn.extend({data:function(a,b){if(typeof a==="undefined"&&this.length)return c.data(this[0]);else if(typeof a==="object")return this.each(function(){c.data(this,a)});var d=a.split(".");d[1]=d[1]?"."+d[1]:"";if(b===w){var f=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(f===w&&this.length)f=c.data(this[0],a);return f===w&&d[1]?this.data(d[0]):f}else return this.trigger("setData"+d[1]+"!",[d[0],b]).each(function(){c.data(this,
+a,b)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var f=c.data(a,b);if(!d)return f||[];if(!f||c.isArray(d))f=c.data(a,b,c.makeArray(d));else f.push(d);return f}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),f=d.shift();if(f==="inprogress")f=d.shift();if(f){b==="fx"&&d.unshift("inprogress");f.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b===
+w)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var Aa=/[\n\t]/g,ca=/\s+/,Za=/\r/g,$a=/href|src|style/,ab=/(button|input)/i,bb=/(button|input|object|select|textarea)/i,
+cb=/^(a|area)$/i,Ba=/radio|checkbox/;c.fn.extend({attr:function(a,b){return X(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(n){var r=c(this);r.addClass(a.call(this,n,r.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ca),d=0,f=this.length;d<f;d++){var e=this[d];if(e.nodeType===1)if(e.className){for(var j=" "+e.className+" ",
+i=e.className,o=0,k=b.length;o<k;o++)if(j.indexOf(" "+b[o]+" ")<0)i+=" "+b[o];e.className=c.trim(i)}else e.className=a}return this},removeClass:function(a){if(c.isFunction(a))return this.each(function(k){var n=c(this);n.removeClass(a.call(this,k,n.attr("class")))});if(a&&typeof a==="string"||a===w)for(var b=(a||"").split(ca),d=0,f=this.length;d<f;d++){var e=this[d];if(e.nodeType===1&&e.className)if(a){for(var j=(" "+e.className+" ").replace(Aa," "),i=0,o=b.length;i<o;i++)j=j.replace(" "+b[i]+" ",
+" ");e.className=c.trim(j)}else e.className=""}return this},toggleClass:function(a,b){var d=typeof a,f=typeof b==="boolean";if(c.isFunction(a))return this.each(function(e){var j=c(this);j.toggleClass(a.call(this,e,j.attr("class"),b),b)});return this.each(function(){if(d==="string")for(var e,j=0,i=c(this),o=b,k=a.split(ca);e=k[j++];){o=f?o:!i.hasClass(e);i[o?"addClass":"removeClass"](e)}else if(d==="undefined"||d==="boolean"){this.className&&c.data(this,"__className__",this.className);this.className=
+this.className||a===false?"":c.data(this,"__className__")||""}})},hasClass:function(a){a=" "+a+" ";for(var b=0,d=this.length;b<d;b++)if((" "+this[b].className+" ").replace(Aa," ").indexOf(a)>-1)return true;return false},val:function(a){if(a===w){var b=this[0];if(b){if(c.nodeName(b,"option"))return(b.attributes.value||{}).specified?b.value:b.text;if(c.nodeName(b,"select")){var d=b.selectedIndex,f=[],e=b.options;b=b.type==="select-one";if(d<0)return null;var j=b?d:0;for(d=b?d+1:e.length;j<d;j++){var i=
+e[j];if(i.selected){a=c(i).val();if(b)return a;f.push(a)}}return f}if(Ba.test(b.type)&&!c.support.checkOn)return b.getAttribute("value")===null?"on":b.value;return(b.value||"").replace(Za,"")}return w}var o=c.isFunction(a);return this.each(function(k){var n=c(this),r=a;if(this.nodeType===1){if(o)r=a.call(this,k,n.val());if(typeof r==="number")r+="";if(c.isArray(r)&&Ba.test(this.type))this.checked=c.inArray(n.val(),r)>=0;else if(c.nodeName(this,"select")){var u=c.makeArray(r);c("option",this).each(function(){this.selected=
+c.inArray(c(this).val(),u)>=0});if(!u.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,f){if(!a||a.nodeType===3||a.nodeType===8)return w;if(f&&b in c.attrFn)return c(a)[b](d);f=a.nodeType!==1||!c.isXMLDoc(a);var e=d!==w;b=f&&c.props[b]||b;if(a.nodeType===1){var j=$a.test(b);if(b in a&&f&&!j){if(e){b==="type"&&ab.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed");
+a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:bb.test(a.nodeName)||cb.test(a.nodeName)&&a.href?0:w;return a[b]}if(!c.support.style&&f&&b==="style"){if(e)a.style.cssText=""+d;return a.style.cssText}e&&a.setAttribute(b,""+d);a=!c.support.hrefNormalized&&f&&j?a.getAttribute(b,2):a.getAttribute(b);return a===null?w:a}return c.style(a,b,d)}});var O=/\.(.*)$/,db=function(a){return a.replace(/[^\w\s\.\|`]/g,
+function(b){return"\\"+b})};c.event={add:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){if(a.setInterval&&a!==A&&!a.frameElement)a=A;var e,j;if(d.handler){e=d;d=e.handler}if(!d.guid)d.guid=c.guid++;if(j=c.data(a)){var i=j.events=j.events||{},o=j.handle;if(!o)j.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem,arguments):w};o.elem=a;b=b.split(" ");for(var k,n=0,r;k=b[n++];){j=e?c.extend({},e):{handler:d,data:f};if(k.indexOf(".")>-1){r=k.split(".");
+k=r.shift();j.namespace=r.slice(0).sort().join(".")}else{r=[];j.namespace=""}j.type=k;j.guid=d.guid;var u=i[k],z=c.event.special[k]||{};if(!u){u=i[k]=[];if(!z.setup||z.setup.call(a,f,r,o)===false)if(a.addEventListener)a.addEventListener(k,o,false);else a.attachEvent&&a.attachEvent("on"+k,o)}if(z.add){z.add.call(a,j);if(!j.handler.guid)j.handler.guid=d.guid}u.push(j);c.event.global[k]=true}a=null}}},global:{},remove:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){var e,j=0,i,o,k,n,r,u,z=c.data(a),
+C=z&&z.events;if(z&&C){if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(e in C)c.event.remove(a,e+b)}else{for(b=b.split(" ");e=b[j++];){n=e;i=e.indexOf(".")<0;o=[];if(!i){o=e.split(".");e=o.shift();k=new RegExp("(^|\\.)"+c.map(o.slice(0).sort(),db).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(r=C[e])if(d){n=c.event.special[e]||{};for(B=f||0;B<r.length;B++){u=r[B];if(d.guid===u.guid){if(i||k.test(u.namespace)){f==null&&r.splice(B--,1);n.remove&&n.remove.call(a,u)}if(f!=
+null)break}}if(r.length===0||f!=null&&r.length===1){if(!n.teardown||n.teardown.call(a,o)===false)Ca(a,e,z.handle);delete C[e]}}else for(var B=0;B<r.length;B++){u=r[B];if(i||k.test(u.namespace)){c.event.remove(a,n,u.handler,B);r.splice(B--,1)}}}if(c.isEmptyObject(C)){if(b=z.handle)b.elem=null;delete z.events;delete z.handle;c.isEmptyObject(z)&&c.removeData(a)}}}}},trigger:function(a,b,d,f){var e=a.type||a;if(!f){a=typeof a==="object"?a[G]?a:c.extend(c.Event(e),a):c.Event(e);if(e.indexOf("!")>=0){a.type=
+e=e.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[e]&&c.each(c.cache,function(){this.events&&this.events[e]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===8)return w;a.result=w;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(f=c.data(d,"handle"))&&f.apply(d,b);f=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+e]&&d["on"+e].apply(d,b)===false)a.result=false}catch(j){}if(!a.isPropagationStopped()&&
+f)c.event.trigger(a,b,f,true);else if(!a.isDefaultPrevented()){f=a.target;var i,o=c.nodeName(f,"a")&&e==="click",k=c.event.special[e]||{};if((!k._default||k._default.call(d,a)===false)&&!o&&!(f&&f.nodeName&&c.noData[f.nodeName.toLowerCase()])){try{if(f[e]){if(i=f["on"+e])f["on"+e]=null;c.event.triggered=true;f[e]()}}catch(n){}if(i)f["on"+e]=i;c.event.triggered=false}}},handle:function(a){var b,d,f,e;a=arguments[0]=c.event.fix(a||A.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive;
+if(!b){d=a.type.split(".");a.type=d.shift();f=new RegExp("(^|\\.)"+d.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)")}e=c.data(this,"events");d=e[a.type];if(e&&d){d=d.slice(0);e=0;for(var j=d.length;e<j;e++){var i=d[e];if(b||f.test(i.namespace)){a.handler=i.handler;a.data=i.data;a.handleObj=i;i=i.handler.apply(this,arguments);if(i!==w){a.result=i;if(i===false){a.preventDefault();a.stopPropagation()}}if(a.isImmediatePropagationStopped())break}}}return a.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
+fix:function(a){if(a[G])return a;var b=a;a=c.Event(b);for(var d=this.props.length,f;d;){f=this.props[--d];a[f]=b[f]}if(!a.target)a.target=a.srcElement||s;if(a.target.nodeType===3)a.target=a.target.parentNode;if(!a.relatedTarget&&a.fromElement)a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement;if(a.pageX==null&&a.clientX!=null){b=s.documentElement;d=s.body;a.pageX=a.clientX+(b&&b.scrollLeft||d&&d.scrollLeft||0)-(b&&b.clientLeft||d&&d.clientLeft||0);a.pageY=a.clientY+(b&&b.scrollTop||
+d&&d.scrollTop||0)-(b&&b.clientTop||d&&d.clientTop||0)}if(!a.which&&(a.charCode||a.charCode===0?a.charCode:a.keyCode))a.which=a.charCode||a.keyCode;if(!a.metaKey&&a.ctrlKey)a.metaKey=a.ctrlKey;if(!a.which&&a.button!==w)a.which=a.button&1?1:a.button&2?3:a.button&4?2:0;return a},guid:1E8,proxy:c.proxy,special:{ready:{setup:c.bindReady,teardown:c.noop},live:{add:function(a){c.event.add(this,a.origType,c.extend({},a,{handler:oa}))},remove:function(a){var b=true,d=a.origType.replace(O,"");c.each(c.data(this,
+"events").live||[],function(){if(d===this.origType.replace(O,""))return b=false});b&&c.event.remove(this,a.origType,oa)}},beforeunload:{setup:function(a,b,d){if(this.setInterval)this.onbeforeunload=d;return false},teardown:function(a,b){if(this.onbeforeunload===b)this.onbeforeunload=null}}}};var Ca=s.removeEventListener?function(a,b,d){a.removeEventListener(b,d,false)}:function(a,b,d){a.detachEvent("on"+b,d)};c.Event=function(a){if(!this.preventDefault)return new c.Event(a);if(a&&a.type){this.originalEvent=
+a;this.type=a.type}else this.type=a;this.timeStamp=J();this[G]=true};c.Event.prototype={preventDefault:function(){this.isDefaultPrevented=Z;var a=this.originalEvent;if(a){a.preventDefault&&a.preventDefault();a.returnValue=false}},stopPropagation:function(){this.isPropagationStopped=Z;var a=this.originalEvent;if(a){a.stopPropagation&&a.stopPropagation();a.cancelBubble=true}},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=Z;this.stopPropagation()},isDefaultPrevented:Y,isPropagationStopped:Y,
+isImmediatePropagationStopped:Y};var Da=function(a){var b=a.relatedTarget;try{for(;b&&b!==this;)b=b.parentNode;if(b!==this){a.type=a.data;c.event.handle.apply(this,arguments)}}catch(d){}},Ea=function(a){a.type=a.data;c.event.handle.apply(this,arguments)};c.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){c.event.special[a]={setup:function(d){c.event.add(this,b,d&&d.selector?Ea:Da,a)},teardown:function(d){c.event.remove(this,b,d&&d.selector?Ea:Da)}}});if(!c.support.submitBubbles)c.event.special.submit=
+{setup:function(){if(this.nodeName.toLowerCase()!=="form"){c.event.add(this,"click.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="submit"||d==="image")&&c(b).closest("form").length)return na("submit",this,arguments)});c.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="text"||d==="password")&&c(b).closest("form").length&&a.keyCode===13)return na("submit",this,arguments)})}else return false},teardown:function(){c.event.remove(this,".specialSubmit")}};
+if(!c.support.changeBubbles){var da=/textarea|input|select/i,ea,Fa=function(a){var b=a.type,d=a.value;if(b==="radio"||b==="checkbox")d=a.checked;else if(b==="select-multiple")d=a.selectedIndex>-1?c.map(a.options,function(f){return f.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},fa=function(a,b){var d=a.target,f,e;if(!(!da.test(d.nodeName)||d.readOnly)){f=c.data(d,"_change_data");e=Fa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data",
+e);if(!(f===w||e===f))if(f!=null||e){a.type="change";return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:fa,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return fa.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return fa.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a,
+"_change_data",Fa(a))}},setup:function(){if(this.type==="file")return false;for(var a in ea)c.event.add(this,a+".specialChange",ea[a]);return da.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return da.test(this.nodeName)}};ea=c.event.special.change.filters}s.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(f){f=c.event.fix(f);f.type=b;return c.event.handle.call(this,f)}c.event.special[b]={setup:function(){this.addEventListener(a,
+d,true)},teardown:function(){this.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,f,e){if(typeof d==="object"){for(var j in d)this[b](j,f,d[j],e);return this}if(c.isFunction(f)){e=f;f=w}var i=b==="one"?c.proxy(e,function(k){c(this).unbind(k,i);return e.apply(this,arguments)}):e;if(d==="unload"&&b!=="one")this.one(d,f,e);else{j=0;for(var o=this.length;j<o;j++)c.event.add(this[j],d,i,f)}return this}});c.fn.extend({unbind:function(a,b){if(typeof a==="object"&&
+!a.preventDefault)for(var d in a)this.unbind(d,a[d]);else{d=0;for(var f=this.length;d<f;d++)c.event.remove(this[d],a,b)}return this},delegate:function(a,b,d,f){return this.live(b,d,f,a)},undelegate:function(a,b,d){return arguments.length===0?this.unbind("live"):this.die(b,null,d,a)},trigger:function(a,b){return this.each(function(){c.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0]){a=c.Event(a);a.preventDefault();a.stopPropagation();c.event.trigger(a,b,this[0]);return a.result}},
+toggle:function(a){for(var b=arguments,d=1;d<b.length;)c.proxy(a,b[d++]);return this.click(c.proxy(a,function(f){var e=(c.data(this,"lastToggle"+a.guid)||0)%d;c.data(this,"lastToggle"+a.guid,e+1);f.preventDefault();return b[e].apply(this,arguments)||false}))},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var Ga={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};c.each(["live","die"],function(a,b){c.fn[b]=function(d,f,e,j){var i,o=0,k,n,r=j||this.selector,
+u=j?this:c(this.context);if(c.isFunction(f)){e=f;f=w}for(d=(d||"").split(" ");(i=d[o++])!=null;){j=O.exec(i);k="";if(j){k=j[0];i=i.replace(O,"")}if(i==="hover")d.push("mouseenter"+k,"mouseleave"+k);else{n=i;if(i==="focus"||i==="blur"){d.push(Ga[i]+k);i+=k}else i=(Ga[i]||i)+k;b==="live"?u.each(function(){c.event.add(this,pa(i,r),{data:f,selector:r,handler:e,origType:i,origHandler:e,preType:n})}):u.unbind(pa(i,r),e)}}return this}});c.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),
+function(a,b){c.fn[b]=function(d){return d?this.bind(b,d):this.trigger(b)};if(c.attrFn)c.attrFn[b]=true});A.attachEvent&&!A.addEventListener&&A.attachEvent("onunload",function(){for(var a in c.cache)if(c.cache[a].handle)try{c.event.remove(c.cache[a].handle.elem)}catch(b){}});(function(){function a(g){for(var h="",l,m=0;g[m];m++){l=g[m];if(l.nodeType===3||l.nodeType===4)h+=l.nodeValue;else if(l.nodeType!==8)h+=a(l.childNodes)}return h}function b(g,h,l,m,q,p){q=0;for(var v=m.length;q<v;q++){var t=m[q];
+if(t){t=t[g];for(var y=false;t;){if(t.sizcache===l){y=m[t.sizset];break}if(t.nodeType===1&&!p){t.sizcache=l;t.sizset=q}if(t.nodeName.toLowerCase()===h){y=t;break}t=t[g]}m[q]=y}}}function d(g,h,l,m,q,p){q=0;for(var v=m.length;q<v;q++){var t=m[q];if(t){t=t[g];for(var y=false;t;){if(t.sizcache===l){y=m[t.sizset];break}if(t.nodeType===1){if(!p){t.sizcache=l;t.sizset=q}if(typeof h!=="string"){if(t===h){y=true;break}}else if(k.filter(h,[t]).length>0){y=t;break}}t=t[g]}m[q]=y}}}var f=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
+e=0,j=Object.prototype.toString,i=false,o=true;[0,0].sort(function(){o=false;return 0});var k=function(g,h,l,m){l=l||[];var q=h=h||s;if(h.nodeType!==1&&h.nodeType!==9)return[];if(!g||typeof g!=="string")return l;for(var p=[],v,t,y,S,H=true,M=x(h),I=g;(f.exec(""),v=f.exec(I))!==null;){I=v[3];p.push(v[1]);if(v[2]){S=v[3];break}}if(p.length>1&&r.exec(g))if(p.length===2&&n.relative[p[0]])t=ga(p[0]+p[1],h);else for(t=n.relative[p[0]]?[h]:k(p.shift(),h);p.length;){g=p.shift();if(n.relative[g])g+=p.shift();
+t=ga(g,t)}else{if(!m&&p.length>1&&h.nodeType===9&&!M&&n.match.ID.test(p[0])&&!n.match.ID.test(p[p.length-1])){v=k.find(p.shift(),h,M);h=v.expr?k.filter(v.expr,v.set)[0]:v.set[0]}if(h){v=m?{expr:p.pop(),set:z(m)}:k.find(p.pop(),p.length===1&&(p[0]==="~"||p[0]==="+")&&h.parentNode?h.parentNode:h,M);t=v.expr?k.filter(v.expr,v.set):v.set;if(p.length>0)y=z(t);else H=false;for(;p.length;){var D=p.pop();v=D;if(n.relative[D])v=p.pop();else D="";if(v==null)v=h;n.relative[D](y,v,M)}}else y=[]}y||(y=t);y||k.error(D||
+g);if(j.call(y)==="[object Array]")if(H)if(h&&h.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&E(h,y[g])))l.push(t[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&l.push(t[g]);else l.push.apply(l,y);else z(y,l);if(S){k(S,q,l,m);k.uniqueSort(l)}return l};k.uniqueSort=function(g){if(B){i=o;g.sort(B);if(i)for(var h=1;h<g.length;h++)g[h]===g[h-1]&&g.splice(h--,1)}return g};k.matches=function(g,h){return k(g,null,null,h)};k.find=function(g,h,l){var m,q;if(!g)return[];
+for(var p=0,v=n.order.length;p<v;p++){var t=n.order[p];if(q=n.leftMatch[t].exec(g)){var y=q[1];q.splice(1,1);if(y.substr(y.length-1)!=="\\"){q[1]=(q[1]||"").replace(/\\/g,"");m=n.find[t](q,h,l);if(m!=null){g=g.replace(n.match[t],"");break}}}}m||(m=h.getElementsByTagName("*"));return{set:m,expr:g}};k.filter=function(g,h,l,m){for(var q=g,p=[],v=h,t,y,S=h&&h[0]&&x(h[0]);g&&h.length;){for(var H in n.filter)if((t=n.leftMatch[H].exec(g))!=null&&t[2]){var M=n.filter[H],I,D;D=t[1];y=false;t.splice(1,1);if(D.substr(D.length-
+1)!=="\\"){if(v===p)p=[];if(n.preFilter[H])if(t=n.preFilter[H](t,v,l,p,m,S)){if(t===true)continue}else y=I=true;if(t)for(var U=0;(D=v[U])!=null;U++)if(D){I=M(D,t,U,v);var Ha=m^!!I;if(l&&I!=null)if(Ha)y=true;else v[U]=false;else if(Ha){p.push(D);y=true}}if(I!==w){l||(v=p);g=g.replace(n.match[H],"");if(!y)return[];break}}}if(g===q)if(y==null)k.error(g);else break;q=g}return v};k.error=function(g){throw"Syntax error, unrecognized expression: "+g;};var n=k.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF-]|\\.)+)/,
+CLASS:/\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(g){return g.getAttribute("href")}},
+relative:{"+":function(g,h){var l=typeof h==="string",m=l&&!/\W/.test(h);l=l&&!m;if(m)h=h.toLowerCase();m=0;for(var q=g.length,p;m<q;m++)if(p=g[m]){for(;(p=p.previousSibling)&&p.nodeType!==1;);g[m]=l||p&&p.nodeName.toLowerCase()===h?p||false:p===h}l&&k.filter(h,g,true)},">":function(g,h){var l=typeof h==="string";if(l&&!/\W/.test(h)){h=h.toLowerCase();for(var m=0,q=g.length;m<q;m++){var p=g[m];if(p){l=p.parentNode;g[m]=l.nodeName.toLowerCase()===h?l:false}}}else{m=0;for(q=g.length;m<q;m++)if(p=g[m])g[m]=
+l?p.parentNode:p.parentNode===h;l&&k.filter(h,g,true)}},"":function(g,h,l){var m=e++,q=d;if(typeof h==="string"&&!/\W/.test(h)){var p=h=h.toLowerCase();q=b}q("parentNode",h,m,g,p,l)},"~":function(g,h,l){var m=e++,q=d;if(typeof h==="string"&&!/\W/.test(h)){var p=h=h.toLowerCase();q=b}q("previousSibling",h,m,g,p,l)}},find:{ID:function(g,h,l){if(typeof h.getElementById!=="undefined"&&!l)return(g=h.getElementById(g[1]))?[g]:[]},NAME:function(g,h){if(typeof h.getElementsByName!=="undefined"){var l=[];
+h=h.getElementsByName(g[1]);for(var m=0,q=h.length;m<q;m++)h[m].getAttribute("name")===g[1]&&l.push(h[m]);return l.length===0?null:l}},TAG:function(g,h){return h.getElementsByTagName(g[1])}},preFilter:{CLASS:function(g,h,l,m,q,p){g=" "+g[1].replace(/\\/g,"")+" ";if(p)return g;p=0;for(var v;(v=h[p])!=null;p++)if(v)if(q^(v.className&&(" "+v.className+" ").replace(/[\t\n]/g," ").indexOf(g)>=0))l||m.push(v);else if(l)h[p]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()},
+CHILD:function(g){if(g[1]==="nth"){var h=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=h[1]+(h[2]||1)-0;g[3]=h[3]-0}g[0]=e++;return g},ATTR:function(g,h,l,m,q,p){h=g[1].replace(/\\/g,"");if(!p&&n.attrMap[h])g[1]=n.attrMap[h];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,h,l,m,q){if(g[1]==="not")if((f.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,h);else{g=k.filter(g[3],h,l,true^q);l||m.push.apply(m,
+g);return false}else if(n.match.POS.test(g[0])||n.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,h,l){return!!k(l[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)},
+text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}},
+setFilters:{first:function(g,h){return h===0},last:function(g,h,l,m){return h===m.length-1},even:function(g,h){return h%2===0},odd:function(g,h){return h%2===1},lt:function(g,h,l){return h<l[3]-0},gt:function(g,h,l){return h>l[3]-0},nth:function(g,h,l){return l[3]-0===h},eq:function(g,h,l){return l[3]-0===h}},filter:{PSEUDO:function(g,h,l,m){var q=h[1],p=n.filters[q];if(p)return p(g,l,h,m);else if(q==="contains")return(g.textContent||g.innerText||a([g])||"").indexOf(h[3])>=0;else if(q==="not"){h=
+h[3];l=0;for(m=h.length;l<m;l++)if(h[l]===g)return false;return true}else k.error("Syntax error, unrecognized expression: "+q)},CHILD:function(g,h){var l=h[1],m=g;switch(l){case "only":case "first":for(;m=m.previousSibling;)if(m.nodeType===1)return false;if(l==="first")return true;m=g;case "last":for(;m=m.nextSibling;)if(m.nodeType===1)return false;return true;case "nth":l=h[2];var q=h[3];if(l===1&&q===0)return true;h=h[0];var p=g.parentNode;if(p&&(p.sizcache!==h||!g.nodeIndex)){var v=0;for(m=p.firstChild;m;m=
+m.nextSibling)if(m.nodeType===1)m.nodeIndex=++v;p.sizcache=h}g=g.nodeIndex-q;return l===0?g===0:g%l===0&&g/l>=0}},ID:function(g,h){return g.nodeType===1&&g.getAttribute("id")===h},TAG:function(g,h){return h==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===h},CLASS:function(g,h){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(h)>-1},ATTR:function(g,h){var l=h[1];g=n.attrHandle[l]?n.attrHandle[l](g):g[l]!=null?g[l]:g.getAttribute(l);l=g+"";var m=h[2];h=h[4];return g==null?m==="!=":m===
+"="?l===h:m==="*="?l.indexOf(h)>=0:m==="~="?(" "+l+" ").indexOf(h)>=0:!h?l&&g!==false:m==="!="?l!==h:m==="^="?l.indexOf(h)===0:m==="$="?l.substr(l.length-h.length)===h:m==="|="?l===h||l.substr(0,h.length+1)===h+"-":false},POS:function(g,h,l,m){var q=n.setFilters[h[2]];if(q)return q(g,l,h,m)}}},r=n.match.POS;for(var u in n.match){n.match[u]=new RegExp(n.match[u].source+/(?![^\[]*\])(?![^\(]*\))/.source);n.leftMatch[u]=new RegExp(/(^(?:.|\r|\n)*?)/.source+n.match[u].source.replace(/\\(\d+)/g,function(g,
+h){return"\\"+(h-0+1)}))}var z=function(g,h){g=Array.prototype.slice.call(g,0);if(h){h.push.apply(h,g);return h}return g};try{Array.prototype.slice.call(s.documentElement.childNodes,0)}catch(C){z=function(g,h){h=h||[];if(j.call(g)==="[object Array]")Array.prototype.push.apply(h,g);else if(typeof g.length==="number")for(var l=0,m=g.length;l<m;l++)h.push(g[l]);else for(l=0;g[l];l++)h.push(g[l]);return h}}var B;if(s.documentElement.compareDocumentPosition)B=function(g,h){if(!g.compareDocumentPosition||
+!h.compareDocumentPosition){if(g==h)i=true;return g.compareDocumentPosition?-1:1}g=g.compareDocumentPosition(h)&4?-1:g===h?0:1;if(g===0)i=true;return g};else if("sourceIndex"in s.documentElement)B=function(g,h){if(!g.sourceIndex||!h.sourceIndex){if(g==h)i=true;return g.sourceIndex?-1:1}g=g.sourceIndex-h.sourceIndex;if(g===0)i=true;return g};else if(s.createRange)B=function(g,h){if(!g.ownerDocument||!h.ownerDocument){if(g==h)i=true;return g.ownerDocument?-1:1}var l=g.ownerDocument.createRange(),m=
+h.ownerDocument.createRange();l.setStart(g,0);l.setEnd(g,0);m.setStart(h,0);m.setEnd(h,0);g=l.compareBoundaryPoints(Range.START_TO_END,m);if(g===0)i=true;return g};(function(){var g=s.createElement("div"),h="script"+(new Date).getTime();g.innerHTML="<a name='"+h+"'/>";var l=s.documentElement;l.insertBefore(g,l.firstChild);if(s.getElementById(h)){n.find.ID=function(m,q,p){if(typeof q.getElementById!=="undefined"&&!p)return(q=q.getElementById(m[1]))?q.id===m[1]||typeof q.getAttributeNode!=="undefined"&&
+q.getAttributeNode("id").nodeValue===m[1]?[q]:w:[]};n.filter.ID=function(m,q){var p=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&p&&p.nodeValue===q}}l.removeChild(g);l=g=null})();(function(){var g=s.createElement("div");g.appendChild(s.createComment(""));if(g.getElementsByTagName("*").length>0)n.find.TAG=function(h,l){l=l.getElementsByTagName(h[1]);if(h[1]==="*"){h=[];for(var m=0;l[m];m++)l[m].nodeType===1&&h.push(l[m]);l=h}return l};g.innerHTML="<a href='#'></a>";
+if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")n.attrHandle.href=function(h){return h.getAttribute("href",2)};g=null})();s.querySelectorAll&&function(){var g=k,h=s.createElement("div");h.innerHTML="<p class='TEST'></p>";if(!(h.querySelectorAll&&h.querySelectorAll(".TEST").length===0)){k=function(m,q,p,v){q=q||s;if(!v&&q.nodeType===9&&!x(q))try{return z(q.querySelectorAll(m),p)}catch(t){}return g(m,q,p,v)};for(var l in g)k[l]=g[l];h=null}}();
+(function(){var g=s.createElement("div");g.innerHTML="<div class='test e'></div><div class='test'></div>";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){n.order.splice(1,0,"CLASS");n.find.CLASS=function(h,l,m){if(typeof l.getElementsByClassName!=="undefined"&&!m)return l.getElementsByClassName(h[1])};g=null}}})();var E=s.compareDocumentPosition?function(g,h){return!!(g.compareDocumentPosition(h)&16)}:
+function(g,h){return g!==h&&(g.contains?g.contains(h):true)},x=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false},ga=function(g,h){var l=[],m="",q;for(h=h.nodeType?[h]:h;q=n.match.PSEUDO.exec(g);){m+=q[0];g=g.replace(n.match.PSEUDO,"")}g=n.relative[g]?g+"*":g;q=0;for(var p=h.length;q<p;q++)k(g,h[q],l);return k.filter(m,l)};c.find=k;c.expr=k.selectors;c.expr[":"]=c.expr.filters;c.unique=k.uniqueSort;c.text=a;c.isXMLDoc=x;c.contains=E})();var eb=/Until$/,fb=/^(?:parents|prevUntil|prevAll)/,
+gb=/,/;R=Array.prototype.slice;var Ia=function(a,b,d){if(c.isFunction(b))return c.grep(a,function(e,j){return!!b.call(e,j,e)===d});else if(b.nodeType)return c.grep(a,function(e){return e===b===d});else if(typeof b==="string"){var f=c.grep(a,function(e){return e.nodeType===1});if(Ua.test(b))return c.filter(b,f,!d);else b=c.filter(b,f)}return c.grep(a,function(e){return c.inArray(e,b)>=0===d})};c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,f=0,e=this.length;f<e;f++){d=b.length;
+c.find(a,this[f],b);if(f>0)for(var j=d;j<b.length;j++)for(var i=0;i<d;i++)if(b[i]===b[j]){b.splice(j--,1);break}}return b},has:function(a){var b=c(a);return this.filter(function(){for(var d=0,f=b.length;d<f;d++)if(c.contains(this,b[d]))return true})},not:function(a){return this.pushStack(Ia(this,a,false),"not",a)},filter:function(a){return this.pushStack(Ia(this,a,true),"filter",a)},is:function(a){return!!a&&c.filter(a,this).length>0},closest:function(a,b){if(c.isArray(a)){var d=[],f=this[0],e,j=
+{},i;if(f&&a.length){e=0;for(var o=a.length;e<o;e++){i=a[e];j[i]||(j[i]=c.expr.match.POS.test(i)?c(i,b||this.context):i)}for(;f&&f.ownerDocument&&f!==b;){for(i in j){e=j[i];if(e.jquery?e.index(f)>-1:c(f).is(e)){d.push({selector:i,elem:f});delete j[i]}}f=f.parentNode}}return d}var k=c.expr.match.POS.test(a)?c(a,b||this.context):null;return this.map(function(n,r){for(;r&&r.ownerDocument&&r!==b;){if(k?k.index(r)>-1:c(r).is(a))return r;r=r.parentNode}return null})},index:function(a){if(!a||typeof a===
+"string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){a=typeof a==="string"?c(a,b||this.context):c.makeArray(a);b=c.merge(this.get(),a);return this.pushStack(qa(a[0])||qa(b[0])?b:c.unique(b))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode",
+d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")?
+a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,f){var e=c.map(this,b,d);eb.test(a)||(f=d);if(f&&typeof f==="string")e=c.filter(f,e);e=this.length>1?c.unique(e):e;if((this.length>1||gb.test(f))&&fb.test(a))e=e.reverse();return this.pushStack(e,a,R.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return c.find.matches(a,b)},dir:function(a,b,d){var f=[];for(a=a[b];a&&a.nodeType!==9&&(d===w||a.nodeType!==1||!c(a).is(d));){a.nodeType===
+1&&f.push(a);a=a[b]}return f},nth:function(a,b,d){b=b||1;for(var f=0;a;a=a[d])if(a.nodeType===1&&++f===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var Ja=/ jQuery\d+="(?:\d+|null)"/g,V=/^\s+/,Ka=/(<([\w:]+)[^>]*?)\/>/g,hb=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,La=/<([\w:]+)/,ib=/<tbody/i,jb=/<|&#?\w+;/,ta=/<script|<object|<embed|<option|<style/i,ua=/checked\s*(?:[^=]|=\s*.checked.)/i,Ma=function(a,b,d){return hb.test(d)?
+a:b+"></"+d+">"},F={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};F.optgroup=F.option;F.tbody=F.tfoot=F.colgroup=F.caption=F.thead;F.th=F.td;if(!c.support.htmlSerialize)F._default=[1,"div<div>","</div>"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d=
+c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==w)return this.empty().append((this[0]&&this[0].ownerDocument||s).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this},
+wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})},
+prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,
+this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,f;(f=this[d])!=null;d++)if(!a||c.filter(a,[f]).length){if(!b&&f.nodeType===1){c.cleanData(f.getElementsByTagName("*"));c.cleanData([f])}f.parentNode&&f.parentNode.removeChild(f)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild);
+return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,f=this.ownerDocument;if(!d){d=f.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(Ja,"").replace(/=([^="'>\s]+\/)>/g,'="$1">').replace(V,"")],f)[0]}else return this.cloneNode(true)});if(a===true){ra(this,b);ra(this.find("*"),b.find("*"))}return b},html:function(a){if(a===w)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Ja,
+""):null;else if(typeof a==="string"&&!ta.test(a)&&(c.support.leadingWhitespace||!V.test(a))&&!F[(La.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Ka,Ma);try{for(var b=0,d=this.length;b<d;b++)if(this[b].nodeType===1){c.cleanData(this[b].getElementsByTagName("*"));this[b].innerHTML=a}}catch(f){this.empty().append(a)}}else c.isFunction(a)?this.each(function(e){var j=c(this),i=j.html();j.empty().append(function(){return a.call(this,e,i)})}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&
+this[0].parentNode){if(c.isFunction(a))return this.each(function(b){var d=c(this),f=d.html();d.replaceWith(a.call(this,b,f))});if(typeof a!=="string")a=c(a).detach();return this.each(function(){var b=this.nextSibling,d=this.parentNode;c(this).remove();b?c(b).before(a):c(d).append(a)})}else return this.pushStack(c(c.isFunction(a)?a():a),"replaceWith",a)},detach:function(a){return this.remove(a,true)},domManip:function(a,b,d){function f(u){return c.nodeName(u,"table")?u.getElementsByTagName("tbody")[0]||
+u.appendChild(u.ownerDocument.createElement("tbody")):u}var e,j,i=a[0],o=[],k;if(!c.support.checkClone&&arguments.length===3&&typeof i==="string"&&ua.test(i))return this.each(function(){c(this).domManip(a,b,d,true)});if(c.isFunction(i))return this.each(function(u){var z=c(this);a[0]=i.call(this,u,b?z.html():w);z.domManip(a,b,d)});if(this[0]){e=i&&i.parentNode;e=c.support.parentNode&&e&&e.nodeType===11&&e.childNodes.length===this.length?{fragment:e}:sa(a,this,o);k=e.fragment;if(j=k.childNodes.length===
+1?(k=k.firstChild):k.firstChild){b=b&&c.nodeName(j,"tr");for(var n=0,r=this.length;n<r;n++)d.call(b?f(this[n],j):this[n],n>0||e.cacheable||this.length>1?k.cloneNode(true):k)}o.length&&c.each(o,Qa)}return this}});c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var f=[];d=c(d);var e=this.length===1&&this[0].parentNode;if(e&&e.nodeType===11&&e.childNodes.length===1&&d.length===1){d[b](this[0]);
+return this}else{e=0;for(var j=d.length;e<j;e++){var i=(e>0?this.clone(true):this).get();c.fn[b].apply(c(d[e]),i);f=f.concat(i)}return this.pushStack(f,a,d.selector)}}});c.extend({clean:function(a,b,d,f){b=b||s;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||s;for(var e=[],j=0,i;(i=a[j])!=null;j++){if(typeof i==="number")i+="";if(i){if(typeof i==="string"&&!jb.test(i))i=b.createTextNode(i);else if(typeof i==="string"){i=i.replace(Ka,Ma);var o=(La.exec(i)||["",
+""])[1].toLowerCase(),k=F[o]||F._default,n=k[0],r=b.createElement("div");for(r.innerHTML=k[1]+i+k[2];n--;)r=r.lastChild;if(!c.support.tbody){n=ib.test(i);o=o==="table"&&!n?r.firstChild&&r.firstChild.childNodes:k[1]==="<table>"&&!n?r.childNodes:[];for(k=o.length-1;k>=0;--k)c.nodeName(o[k],"tbody")&&!o[k].childNodes.length&&o[k].parentNode.removeChild(o[k])}!c.support.leadingWhitespace&&V.test(i)&&r.insertBefore(b.createTextNode(V.exec(i)[0]),r.firstChild);i=r.childNodes}if(i.nodeType)e.push(i);else e=
+c.merge(e,i)}}if(d)for(j=0;e[j];j++)if(f&&c.nodeName(e[j],"script")&&(!e[j].type||e[j].type.toLowerCase()==="text/javascript"))f.push(e[j].parentNode?e[j].parentNode.removeChild(e[j]):e[j]);else{e[j].nodeType===1&&e.splice.apply(e,[j+1,0].concat(c.makeArray(e[j].getElementsByTagName("script"))));d.appendChild(e[j])}return e},cleanData:function(a){for(var b,d,f=c.cache,e=c.event.special,j=c.support.deleteExpando,i=0,o;(o=a[i])!=null;i++)if(d=o[c.expando]){b=f[d];if(b.events)for(var k in b.events)e[k]?
+c.event.remove(o,k):Ca(o,k,b.handle);if(j)delete o[c.expando];else o.removeAttribute&&o.removeAttribute(c.expando);delete f[d]}}});var kb=/z-?index|font-?weight|opacity|zoom|line-?height/i,Na=/alpha\([^)]*\)/,Oa=/opacity=([^)]*)/,ha=/float/i,ia=/-([a-z])/ig,lb=/([A-Z])/g,mb=/^-?\d+(?:px)?$/i,nb=/^-?\d/,ob={position:"absolute",visibility:"hidden",display:"block"},pb=["Left","Right"],qb=["Top","Bottom"],rb=s.defaultView&&s.defaultView.getComputedStyle,Pa=c.support.cssFloat?"cssFloat":"styleFloat",ja=
+function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){return X(this,a,b,true,function(d,f,e){if(e===w)return c.curCSS(d,f);if(typeof e==="number"&&!kb.test(f))e+="px";c.style(d,f,e)})};c.extend({style:function(a,b,d){if(!a||a.nodeType===3||a.nodeType===8)return w;if((b==="width"||b==="height")&&parseFloat(d)<0)d=w;var f=a.style||a,e=d!==w;if(!c.support.opacity&&b==="opacity"){if(e){f.zoom=1;b=parseInt(d,10)+""==="NaN"?"":"alpha(opacity="+d*100+")";a=f.filter||c.curCSS(a,"filter")||"";f.filter=
+Na.test(a)?a.replace(Na,b):b}return f.filter&&f.filter.indexOf("opacity=")>=0?parseFloat(Oa.exec(f.filter)[1])/100+"":""}if(ha.test(b))b=Pa;b=b.replace(ia,ja);if(e)f[b]=d;return f[b]},css:function(a,b,d,f){if(b==="width"||b==="height"){var e,j=b==="width"?pb:qb;function i(){e=b==="width"?a.offsetWidth:a.offsetHeight;f!=="border"&&c.each(j,function(){f||(e-=parseFloat(c.curCSS(a,"padding"+this,true))||0);if(f==="margin")e+=parseFloat(c.curCSS(a,"margin"+this,true))||0;else e-=parseFloat(c.curCSS(a,
+"border"+this+"Width",true))||0})}a.offsetWidth!==0?i():c.swap(a,ob,i);return Math.max(0,Math.round(e))}return c.curCSS(a,b,d)},curCSS:function(a,b,d){var f,e=a.style;if(!c.support.opacity&&b==="opacity"&&a.currentStyle){f=Oa.test(a.currentStyle.filter||"")?parseFloat(RegExp.$1)/100+"":"";return f===""?"1":f}if(ha.test(b))b=Pa;if(!d&&e&&e[b])f=e[b];else if(rb){if(ha.test(b))b="float";b=b.replace(lb,"-$1").toLowerCase();e=a.ownerDocument.defaultView;if(!e)return null;if(a=e.getComputedStyle(a,null))f=
+a.getPropertyValue(b);if(b==="opacity"&&f==="")f="1"}else if(a.currentStyle){d=b.replace(ia,ja);f=a.currentStyle[b]||a.currentStyle[d];if(!mb.test(f)&&nb.test(f)){b=e.left;var j=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;e.left=d==="fontSize"?"1em":f||0;f=e.pixelLeft+"px";e.left=b;a.runtimeStyle.left=j}}return f},swap:function(a,b,d){var f={};for(var e in b){f[e]=a.style[e];a.style[e]=b[e]}d.call(a);for(e in b)a.style[e]=f[e]}});if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b=
+a.offsetWidth,d=a.offsetHeight,f=a.nodeName.toLowerCase()==="tr";return b===0&&d===0&&!f?true:b>0&&d>0&&!f?false:c.curCSS(a,"display")==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var sb=J(),tb=/<script(.|\s)*?\/script>/gi,ub=/select|textarea/i,vb=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,N=/=\?(&|$)/,ka=/\?/,wb=/(\?|&)_=.*?(&|$)/,xb=/^(\w+:)?\/\/([^\/?#]+)/,yb=/%20/g,zb=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!==
+"string")return zb.call(this,a);else if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var e=a.slice(f,a.length);a=a.slice(0,f)}f="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b==="object"){b=c.param(b,c.ajaxSettings.traditional);f="POST"}var j=this;c.ajax({url:a,type:f,dataType:"html",data:b,complete:function(i,o){if(o==="success"||o==="notmodified")j.html(e?c("<div />").append(i.responseText.replace(tb,"")).find(e):i.responseText);d&&j.each(d,[i.responseText,o,i])}});return this},
+serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||ub.test(this.nodeName)||vb.test(this.type))}).map(function(a,b){a=c(this).val();return a==null?null:c.isArray(a)?c.map(a,function(d){return{name:b.name,value:d}}):{name:b.name,value:a}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),
+function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:f})},getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:f})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href,
+global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:A.XMLHttpRequest&&(A.location.protocol!=="file:"||!A.ActiveXObject)?function(){return new A.XMLHttpRequest}:function(){try{return new A.ActiveXObject("Microsoft.XMLHTTP")}catch(a){}},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},etag:{},ajax:function(a){function b(){e.success&&
+e.success.call(k,o,i,x);e.global&&f("ajaxSuccess",[x,e])}function d(){e.complete&&e.complete.call(k,x,i);e.global&&f("ajaxComplete",[x,e]);e.global&&!--c.active&&c.event.trigger("ajaxStop")}function f(q,p){(e.context?c(e.context):c.event).trigger(q,p)}var e=c.extend(true,{},c.ajaxSettings,a),j,i,o,k=a&&a.context||e,n=e.type.toUpperCase();if(e.data&&e.processData&&typeof e.data!=="string")e.data=c.param(e.data,e.traditional);if(e.dataType==="jsonp"){if(n==="GET")N.test(e.url)||(e.url+=(ka.test(e.url)?
+"&":"?")+(e.jsonp||"callback")+"=?");else if(!e.data||!N.test(e.data))e.data=(e.data?e.data+"&":"")+(e.jsonp||"callback")+"=?";e.dataType="json"}if(e.dataType==="json"&&(e.data&&N.test(e.data)||N.test(e.url))){j=e.jsonpCallback||"jsonp"+sb++;if(e.data)e.data=(e.data+"").replace(N,"="+j+"$1");e.url=e.url.replace(N,"="+j+"$1");e.dataType="script";A[j]=A[j]||function(q){o=q;b();d();A[j]=w;try{delete A[j]}catch(p){}z&&z.removeChild(C)}}if(e.dataType==="script"&&e.cache===null)e.cache=false;if(e.cache===
+false&&n==="GET"){var r=J(),u=e.url.replace(wb,"$1_="+r+"$2");e.url=u+(u===e.url?(ka.test(e.url)?"&":"?")+"_="+r:"")}if(e.data&&n==="GET")e.url+=(ka.test(e.url)?"&":"?")+e.data;e.global&&!c.active++&&c.event.trigger("ajaxStart");r=(r=xb.exec(e.url))&&(r[1]&&r[1]!==location.protocol||r[2]!==location.host);if(e.dataType==="script"&&n==="GET"&&r){var z=s.getElementsByTagName("head")[0]||s.documentElement,C=s.createElement("script");C.src=e.url;if(e.scriptCharset)C.charset=e.scriptCharset;if(!j){var B=
+false;C.onload=C.onreadystatechange=function(){if(!B&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){B=true;b();d();C.onload=C.onreadystatechange=null;z&&C.parentNode&&z.removeChild(C)}}}z.insertBefore(C,z.firstChild);return w}var E=false,x=e.xhr();if(x){e.username?x.open(n,e.url,e.async,e.username,e.password):x.open(n,e.url,e.async);try{if(e.data||a&&a.contentType)x.setRequestHeader("Content-Type",e.contentType);if(e.ifModified){c.lastModified[e.url]&&x.setRequestHeader("If-Modified-Since",
+c.lastModified[e.url]);c.etag[e.url]&&x.setRequestHeader("If-None-Match",c.etag[e.url])}r||x.setRequestHeader("X-Requested-With","XMLHttpRequest");x.setRequestHeader("Accept",e.dataType&&e.accepts[e.dataType]?e.accepts[e.dataType]+", */*":e.accepts._default)}catch(ga){}if(e.beforeSend&&e.beforeSend.call(k,x,e)===false){e.global&&!--c.active&&c.event.trigger("ajaxStop");x.abort();return false}e.global&&f("ajaxSend",[x,e]);var g=x.onreadystatechange=function(q){if(!x||x.readyState===0||q==="abort"){E||
+d();E=true;if(x)x.onreadystatechange=c.noop}else if(!E&&x&&(x.readyState===4||q==="timeout")){E=true;x.onreadystatechange=c.noop;i=q==="timeout"?"timeout":!c.httpSuccess(x)?"error":e.ifModified&&c.httpNotModified(x,e.url)?"notmodified":"success";var p;if(i==="success")try{o=c.httpData(x,e.dataType,e)}catch(v){i="parsererror";p=v}if(i==="success"||i==="notmodified")j||b();else c.handleError(e,x,i,p);d();q==="timeout"&&x.abort();if(e.async)x=null}};try{var h=x.abort;x.abort=function(){x&&h.call(x);
+g("abort")}}catch(l){}e.async&&e.timeout>0&&setTimeout(function(){x&&!E&&g("timeout")},e.timeout);try{x.send(n==="POST"||n==="PUT"||n==="DELETE"?e.data:null)}catch(m){c.handleError(e,x,null,m);d()}e.async||g();return x}},handleError:function(a,b,d,f){if(a.error)a.error.call(a.context||a,b,d,f);if(a.global)(a.context?c(a.context):c.event).trigger("ajaxError",[b,a,f])},active:0,httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status===
+1223||a.status===0}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),f=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(f)c.etag[b]=f;return a.status===304||a.status===0},httpData:function(a,b,d){var f=a.getResponseHeader("content-type")||"",e=b==="xml"||!b&&f.indexOf("xml")>=0;a=e?a.responseXML:a.responseText;e&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b===
+"json"||!b&&f.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&f.indexOf("javascript")>=0)c.globalEval(a);return a},param:function(a,b){function d(i,o){if(c.isArray(o))c.each(o,function(k,n){b||/\[\]$/.test(i)?f(i,n):d(i+"["+(typeof n==="object"||c.isArray(n)?k:"")+"]",n)});else!b&&o!=null&&typeof o==="object"?c.each(o,function(k,n){d(i+"["+k+"]",n)}):f(i,o)}function f(i,o){o=c.isFunction(o)?o():o;e[e.length]=encodeURIComponent(i)+"="+encodeURIComponent(o)}var e=[];if(b===w)b=c.ajaxSettings.traditional;
+if(c.isArray(a)||a.jquery)c.each(a,function(){f(this.name,this.value)});else for(var j in a)d(j,a[j]);return e.join("&").replace(yb,"+")}});var la={},Ab=/toggle|show|hide/,Bb=/^([+-]=)?([\d+-.]+)(.*)$/,W,va=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b){if(a||a===0)return this.animate(K("show",3),a,b);else{a=0;for(b=this.length;a<b;a++){var d=c.data(this[a],"olddisplay");
+this[a].style.display=d||"";if(c.css(this[a],"display")==="none"){d=this[a].nodeName;var f;if(la[d])f=la[d];else{var e=c("<"+d+" />").appendTo("body");f=e.css("display");if(f==="none")f="block";e.remove();la[d]=f}c.data(this[a],"olddisplay",f)}}a=0;for(b=this.length;a<b;a++)this[a].style.display=c.data(this[a],"olddisplay")||"";return this}},hide:function(a,b){if(a||a===0)return this.animate(K("hide",3),a,b);else{a=0;for(b=this.length;a<b;a++){var d=c.data(this[a],"olddisplay");!d&&d!=="none"&&c.data(this[a],
+"olddisplay",c.css(this[a],"display"))}a=0;for(b=this.length;a<b;a++)this[a].style.display="none";return this}},_toggle:c.fn.toggle,toggle:function(a,b){var d=typeof a==="boolean";if(c.isFunction(a)&&c.isFunction(b))this._toggle.apply(this,arguments);else a==null||d?this.each(function(){var f=d?a:c(this).is(":hidden");c(this)[f?"show":"hide"]()}):this.animate(K("toggle",3),a,b);return this},fadeTo:function(a,b,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,d)},
+animate:function(a,b,d,f){var e=c.speed(b,d,f);if(c.isEmptyObject(a))return this.each(e.complete);return this[e.queue===false?"each":"queue"](function(){var j=c.extend({},e),i,o=this.nodeType===1&&c(this).is(":hidden"),k=this;for(i in a){var n=i.replace(ia,ja);if(i!==n){a[n]=a[i];delete a[i];i=n}if(a[i]==="hide"&&o||a[i]==="show"&&!o)return j.complete.call(this);if((i==="height"||i==="width")&&this.style){j.display=c.css(this,"display");j.overflow=this.style.overflow}if(c.isArray(a[i])){(j.specialEasing=
+j.specialEasing||{})[i]=a[i][1];a[i]=a[i][0]}}if(j.overflow!=null)this.style.overflow="hidden";j.curAnim=c.extend({},a);c.each(a,function(r,u){var z=new c.fx(k,j,r);if(Ab.test(u))z[u==="toggle"?o?"show":"hide":u](a);else{var C=Bb.exec(u),B=z.cur(true)||0;if(C){u=parseFloat(C[2]);var E=C[3]||"px";if(E!=="px"){k.style[r]=(u||1)+E;B=(u||1)/z.cur(true)*B;k.style[r]=B+E}if(C[1])u=(C[1]==="-="?-1:1)*u+B;z.custom(B,u,E)}else z.custom(B,u,"")}});return true})},stop:function(a,b){var d=c.timers;a&&this.queue([]);
+this.each(function(){for(var f=d.length-1;f>=0;f--)if(d[f].elem===this){b&&d[f](true);d.splice(f,1)}});b||this.dequeue();return this}});c.each({slideDown:K("show",1),slideUp:K("hide",1),slideToggle:K("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(a,b){c.fn[a]=function(d,f){return this.animate(b,d,f)}});c.extend({speed:function(a,b,d){var f=a&&typeof a==="object"?a:{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};f.duration=c.fx.off?0:typeof f.duration===
+"number"?f.duration:c.fx.speeds[f.duration]||c.fx.speeds._default;f.old=f.complete;f.complete=function(){f.queue!==false&&c(this).dequeue();c.isFunction(f.old)&&f.old.call(this)};return f},easing:{linear:function(a,b,d,f){return d+f*a},swing:function(a,b,d,f){return(-Math.cos(a*Math.PI)/2+0.5)*f+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]||
+c.fx.step._default)(this);if((this.prop==="height"||this.prop==="width")&&this.elem.style)this.elem.style.display="block"},cur:function(a){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];return(a=parseFloat(c.css(this.elem,this.prop,a)))&&a>-10000?a:parseFloat(c.curCSS(this.elem,this.prop))||0},custom:function(a,b,d){function f(j){return e.step(j)}this.startTime=J();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start;
+this.pos=this.state=0;var e=this;f.elem=this.elem;if(f()&&c.timers.push(f)&&!W)W=setInterval(c.fx.tick,13)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(a){var b=J(),d=true;if(a||b>=this.options.duration+this.startTime){this.now=
+this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var f in this.options.curAnim)if(this.options.curAnim[f]!==true)d=false;if(d){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;a=c.data(this.elem,"olddisplay");this.elem.style.display=a?a:this.options.display;if(c.css(this.elem,"display")==="none")this.elem.style.display="block"}this.options.hide&&c(this.elem).hide();if(this.options.hide||this.options.show)for(var e in this.options.curAnim)c.style(this.elem,
+e,this.options.orig[e]);this.options.complete.call(this.elem)}return false}else{e=b-this.startTime;this.state=e/this.options.duration;a=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||a](this.state,e,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=c.timers,b=0;b<a.length;b++)a[b]()||a.splice(b--,1);a.length||
+c.fx.stop()},stop:function(){clearInterval(W);W=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){c.style(a.elem,"opacity",a.now)},_default:function(a){if(a.elem.style&&a.elem.style[a.prop]!=null)a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit;else a.elem[a.prop]=a.now}}});if(c.expr&&c.expr.filters)c.expr.filters.animated=function(a){return c.grep(c.timers,function(b){return a===b.elem}).length};c.fn.offset="getBoundingClientRect"in s.documentElement?
+function(a){var b=this[0];if(a)return this.each(function(e){c.offset.setOffset(this,a,e)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);var d=b.getBoundingClientRect(),f=b.ownerDocument;b=f.body;f=f.documentElement;return{top:d.top+(self.pageYOffset||c.support.boxModel&&f.scrollTop||b.scrollTop)-(f.clientTop||b.clientTop||0),left:d.left+(self.pageXOffset||c.support.boxModel&&f.scrollLeft||b.scrollLeft)-(f.clientLeft||b.clientLeft||0)}}:function(a){var b=
+this[0];if(a)return this.each(function(r){c.offset.setOffset(this,a,r)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);c.offset.initialize();var d=b.offsetParent,f=b,e=b.ownerDocument,j,i=e.documentElement,o=e.body;f=(e=e.defaultView)?e.getComputedStyle(b,null):b.currentStyle;for(var k=b.offsetTop,n=b.offsetLeft;(b=b.parentNode)&&b!==o&&b!==i;){if(c.offset.supportsFixedPosition&&f.position==="fixed")break;j=e?e.getComputedStyle(b,null):b.currentStyle;
+k-=b.scrollTop;n-=b.scrollLeft;if(b===d){k+=b.offsetTop;n+=b.offsetLeft;if(c.offset.doesNotAddBorder&&!(c.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(b.nodeName))){k+=parseFloat(j.borderTopWidth)||0;n+=parseFloat(j.borderLeftWidth)||0}f=d;d=b.offsetParent}if(c.offset.subtractsBorderForOverflowNotVisible&&j.overflow!=="visible"){k+=parseFloat(j.borderTopWidth)||0;n+=parseFloat(j.borderLeftWidth)||0}f=j}if(f.position==="relative"||f.position==="static"){k+=o.offsetTop;n+=o.offsetLeft}if(c.offset.supportsFixedPosition&&
+f.position==="fixed"){k+=Math.max(i.scrollTop,o.scrollTop);n+=Math.max(i.scrollLeft,o.scrollLeft)}return{top:k,left:n}};c.offset={initialize:function(){var a=s.body,b=s.createElement("div"),d,f,e,j=parseFloat(c.curCSS(a,"marginTop",true))||0;c.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"});b.innerHTML="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";
+a.insertBefore(b,a.firstChild);d=b.firstChild;f=d.firstChild;e=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=f.offsetTop!==5;this.doesAddBorderForTableAndCells=e.offsetTop===5;f.style.position="fixed";f.style.top="20px";this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15;f.style.position=f.style.top="";d.style.overflow="hidden";d.style.position="relative";this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==j;a.removeChild(b);
+c.offset.initialize=c.noop},bodyOffset:function(a){var b=a.offsetTop,d=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.curCSS(a,"marginTop",true))||0;d+=parseFloat(c.curCSS(a,"marginLeft",true))||0}return{top:b,left:d}},setOffset:function(a,b,d){if(/static/.test(c.curCSS(a,"position")))a.style.position="relative";var f=c(a),e=f.offset(),j=parseInt(c.curCSS(a,"top",true),10)||0,i=parseInt(c.curCSS(a,"left",true),10)||0;if(c.isFunction(b))b=b.call(a,
+d,e);d={top:b.top-e.top+j,left:b.left-e.left+i};"using"in b?b.using.call(a,d):f.css(d)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),f=/^body|html$/i.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.curCSS(a,"marginTop",true))||0;d.left-=parseFloat(c.curCSS(a,"marginLeft",true))||0;f.top+=parseFloat(c.curCSS(b[0],"borderTopWidth",true))||0;f.left+=parseFloat(c.curCSS(b[0],"borderLeftWidth",true))||0;return{top:d.top-
+f.top,left:d.left-f.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||s.body;a&&!/^body|html$/i.test(a.nodeName)&&c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(f){var e=this[0],j;if(!e)return null;if(f!==w)return this.each(function(){if(j=wa(this))j.scrollTo(!a?f:c(j).scrollLeft(),a?f:c(j).scrollTop());else this[d]=f});else return(j=wa(e))?"pageXOffset"in j?j[a?"pageYOffset":
+"pageXOffset"]:c.support.boxModel&&j.document.documentElement[d]||j.document.body[d]:e[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();c.fn["inner"+b]=function(){return this[0]?c.css(this[0],d,false,"padding"):null};c.fn["outer"+b]=function(f){return this[0]?c.css(this[0],d,false,f?"margin":"border"):null};c.fn[d]=function(f){var e=this[0];if(!e)return f==null?null:this;if(c.isFunction(f))return this.each(function(j){var i=c(this);i[d](f.call(this,j,i[d]()))});return"scrollTo"in
+e&&e.document?e.document.compatMode==="CSS1Compat"&&e.document.documentElement["client"+b]||e.document.body["client"+b]:e.nodeType===9?Math.max(e.documentElement["client"+b],e.body["scroll"+b],e.documentElement["scroll"+b],e.body["offset"+b],e.documentElement["offset"+b]):f===w?c.css(e,d):this.css(d,typeof f==="string"?f:f+"px")}});A.jQuery=A.$=c})(window);
diff --git a/app/static/doc/flask-docs/_static/logo-full.png b/app/static/doc/flask-docs/_static/logo-full.png
new file mode 100644
index 0000000..5deaf1b
--- /dev/null
+++ b/app/static/doc/flask-docs/_static/logo-full.png
Binary files differ
diff --git a/app/static/doc/flask-docs/_static/minus.png b/app/static/doc/flask-docs/_static/minus.png
new file mode 100644
index 0000000..da1c562
--- /dev/null
+++ b/app/static/doc/flask-docs/_static/minus.png
Binary files differ
diff --git a/app/static/doc/flask-docs/_static/no.png b/app/static/doc/flask-docs/_static/no.png
new file mode 100644
index 0000000..4ac1083
--- /dev/null
+++ b/app/static/doc/flask-docs/_static/no.png
Binary files differ
diff --git a/app/static/doc/flask-docs/_static/plus.png b/app/static/doc/flask-docs/_static/plus.png
new file mode 100644
index 0000000..b3cb374
--- /dev/null
+++ b/app/static/doc/flask-docs/_static/plus.png
Binary files differ
diff --git a/app/static/doc/flask-docs/_static/pygments.css b/app/static/doc/flask-docs/_static/pygments.css
new file mode 100644
index 0000000..ee96fae
--- /dev/null
+++ b/app/static/doc/flask-docs/_static/pygments.css
@@ -0,0 +1,70 @@
+.highlight .hll { background-color: #ffffcc }
+.highlight { background: #f8f8f8; }
+.highlight .c { color: #8f5902; font-style: italic } /* Comment */
+.highlight .err { color: #a40000; border: 1px solid #ef2929 } /* Error */
+.highlight .g { color: #000000 } /* Generic */
+.highlight .k { color: #004461; font-weight: bold } /* Keyword */
+.highlight .l { color: #000000 } /* Literal */
+.highlight .n { color: #000000 } /* Name */
+.highlight .o { color: #582800 } /* Operator */
+.highlight .x { color: #000000 } /* Other */
+.highlight .p { color: #000000; font-weight: bold } /* Punctuation */
+.highlight .cm { color: #8f5902; font-style: italic } /* Comment.Multiline */
+.highlight .cp { color: #8f5902 } /* Comment.Preproc */
+.highlight .c1 { color: #8f5902; font-style: italic } /* Comment.Single */
+.highlight .cs { color: #8f5902; font-style: italic } /* Comment.Special */
+.highlight .gd { color: #a40000 } /* Generic.Deleted */
+.highlight .ge { color: #000000; font-style: italic } /* Generic.Emph */
+.highlight .gr { color: #ef2929 } /* Generic.Error */
+.highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */
+.highlight .gi { color: #00A000 } /* Generic.Inserted */
+.highlight .go { color: #808080 } /* Generic.Output */
+.highlight .gp { color: #745334 } /* Generic.Prompt */
+.highlight .gs { color: #000000; font-weight: bold } /* Generic.Strong */
+.highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
+.highlight .gt { color: #a40000; font-weight: bold } /* Generic.Traceback */
+.highlight .kc { color: #004461; font-weight: bold } /* Keyword.Constant */
+.highlight .kd { color: #004461; font-weight: bold } /* Keyword.Declaration */
+.highlight .kn { color: #004461; font-weight: bold } /* Keyword.Namespace */
+.highlight .kp { color: #004461; font-weight: bold } /* Keyword.Pseudo */
+.highlight .kr { color: #004461; font-weight: bold } /* Keyword.Reserved */
+.highlight .kt { color: #004461; font-weight: bold } /* Keyword.Type */
+.highlight .ld { color: #000000 } /* Literal.Date */
+.highlight .m { color: #990000 } /* Literal.Number */
+.highlight .s { color: #4e9a06 } /* Literal.String */
+.highlight .na { color: #c4a000 } /* Name.Attribute */
+.highlight .nb { color: #004461 } /* Name.Builtin */
+.highlight .nc { color: #000000 } /* Name.Class */
+.highlight .no { color: #000000 } /* Name.Constant */
+.highlight .nd { color: #808080 } /* Name.Decorator */
+.highlight .ni { color: #ce5c00 } /* Name.Entity */
+.highlight .ne { color: #cc0000; font-weight: bold } /* Name.Exception */
+.highlight .nf { color: #000000 } /* Name.Function */
+.highlight .nl { color: #f57900 } /* Name.Label */
+.highlight .nn { color: #000000 } /* Name.Namespace */
+.highlight .nx { color: #000000 } /* Name.Other */
+.highlight .py { color: #000000 } /* Name.Property */
+.highlight .nt { color: #004461; font-weight: bold } /* Name.Tag */
+.highlight .nv { color: #000000 } /* Name.Variable */
+.highlight .ow { color: #004461; font-weight: bold } /* Operator.Word */
+.highlight .w { color: #f8f8f8; text-decoration: underline } /* Text.Whitespace */
+.highlight .mf { color: #990000 } /* Literal.Number.Float */
+.highlight .mh { color: #990000 } /* Literal.Number.Hex */
+.highlight .mi { color: #990000 } /* Literal.Number.Integer */
+.highlight .mo { color: #990000 } /* Literal.Number.Oct */
+.highlight .sb { color: #4e9a06 } /* Literal.String.Backtick */
+.highlight .sc { color: #4e9a06 } /* Literal.String.Char */
+.highlight .sd { color: #8f5902; font-style: italic } /* Literal.String.Doc */
+.highlight .s2 { color: #4e9a06 } /* Literal.String.Double */
+.highlight .se { color: #4e9a06 } /* Literal.String.Escape */
+.highlight .sh { color: #4e9a06 } /* Literal.String.Heredoc */
+.highlight .si { color: #4e9a06 } /* Literal.String.Interpol */
+.highlight .sx { color: #4e9a06 } /* Literal.String.Other */
+.highlight .sr { color: #4e9a06 } /* Literal.String.Regex */
+.highlight .s1 { color: #4e9a06 } /* Literal.String.Single */
+.highlight .ss { color: #4e9a06 } /* Literal.String.Symbol */
+.highlight .bp { color: #3465a4 } /* Name.Builtin.Pseudo */
+.highlight .vc { color: #000000 } /* Name.Variable.Class */
+.highlight .vg { color: #000000 } /* Name.Variable.Global */
+.highlight .vi { color: #000000 } /* Name.Variable.Instance */
+.highlight .il { color: #990000 } /* Literal.Number.Integer.Long */ \ No newline at end of file
diff --git a/app/static/doc/flask-docs/_static/searchtools.js b/app/static/doc/flask-docs/_static/searchtools.js
new file mode 100644
index 0000000..6ed5ac8
--- /dev/null
+++ b/app/static/doc/flask-docs/_static/searchtools.js
@@ -0,0 +1,556 @@
+/*
+ * searchtools.js_t
+ * ~~~~~~~~~~~~~~~~
+ *
+ * Sphinx JavaScript utilties for the full-text search.
+ *
+ * :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS.
+ * :license: BSD, see LICENSE for details.
+ *
+ */
+
+/**
+ * helper function to return a node containing the
+ * search summary for a given text. keywords is a list
+ * of stemmed words, hlwords is the list of normal, unstemmed
+ * words. the first one is used to find the occurance, the
+ * latter for highlighting it.
+ */
+
+jQuery.makeSearchSummary = function(text, keywords, hlwords) {
+ var textLower = text.toLowerCase();
+ var start = 0;
+ $.each(keywords, function() {
+ var i = textLower.indexOf(this.toLowerCase());
+ if (i > -1)
+ start = i;
+ });
+ start = Math.max(start - 120, 0);
+ var excerpt = ((start > 0) ? '...' : '') +
+ $.trim(text.substr(start, 240)) +
+ ((start + 240 - text.length) ? '...' : '');
+ var rv = $('<div class="context"></div>').text(excerpt);
+ $.each(hlwords, function() {
+ rv = rv.highlightText(this, 'highlighted');
+ });
+ return rv;
+}
+
+
+/**
+ * Porter Stemmer
+ */
+var Stemmer = function() {
+
+ var step2list = {
+ ational: 'ate',
+ tional: 'tion',
+ enci: 'ence',
+ anci: 'ance',
+ izer: 'ize',
+ bli: 'ble',
+ alli: 'al',
+ entli: 'ent',
+ eli: 'e',
+ ousli: 'ous',
+ ization: 'ize',
+ ation: 'ate',
+ ator: 'ate',
+ alism: 'al',
+ iveness: 'ive',
+ fulness: 'ful',
+ ousness: 'ous',
+ aliti: 'al',
+ iviti: 'ive',
+ biliti: 'ble',
+ logi: 'log'
+ };
+
+ var step3list = {
+ icate: 'ic',
+ ative: '',
+ alize: 'al',
+ iciti: 'ic',
+ ical: 'ic',
+ ful: '',
+ ness: ''
+ };
+
+ var c = "[^aeiou]"; // consonant
+ var v = "[aeiouy]"; // vowel
+ var C = c + "[^aeiouy]*"; // consonant sequence
+ var V = v + "[aeiou]*"; // vowel sequence
+
+ var mgr0 = "^(" + C + ")?" + V + C; // [C]VC... is m>0
+ var meq1 = "^(" + C + ")?" + V + C + "(" + V + ")?$"; // [C]VC[V] is m=1
+ var mgr1 = "^(" + C + ")?" + V + C + V + C; // [C]VCVC... is m>1
+ var s_v = "^(" + C + ")?" + v; // vowel in stem
+
+ this.stemWord = function (w) {
+ var stem;
+ var suffix;
+ var firstch;
+ var origword = w;
+
+ if (w.length < 3)
+ return w;
+
+ var re;
+ var re2;
+ var re3;
+ var re4;
+
+ firstch = w.substr(0,1);
+ if (firstch == "y")
+ w = firstch.toUpperCase() + w.substr(1);
+
+ // Step 1a
+ re = /^(.+?)(ss|i)es$/;
+ re2 = /^(.+?)([^s])s$/;
+
+ if (re.test(w))
+ w = w.replace(re,"$1$2");
+ else if (re2.test(w))
+ w = w.replace(re2,"$1$2");
+
+ // Step 1b
+ re = /^(.+?)eed$/;
+ re2 = /^(.+?)(ed|ing)$/;
+ if (re.test(w)) {
+ var fp = re.exec(w);
+ re = new RegExp(mgr0);
+ if (re.test(fp[1])) {
+ re = /.$/;
+ w = w.replace(re,"");
+ }
+ }
+ else if (re2.test(w)) {
+ var fp = re2.exec(w);
+ stem = fp[1];
+ re2 = new RegExp(s_v);
+ if (re2.test(stem)) {
+ w = stem;
+ re2 = /(at|bl|iz)$/;
+ re3 = new RegExp("([^aeiouylsz])\\1$");
+ re4 = new RegExp("^" + C + v + "[^aeiouwxy]$");
+ if (re2.test(w))
+ w = w + "e";
+ else if (re3.test(w)) {
+ re = /.$/;
+ w = w.replace(re,"");
+ }
+ else if (re4.test(w))
+ w = w + "e";
+ }
+ }
+
+ // Step 1c
+ re = /^(.+?)y$/;
+ if (re.test(w)) {
+ var fp = re.exec(w);
+ stem = fp[1];
+ re = new RegExp(s_v);
+ if (re.test(stem))
+ w = stem + "i";
+ }
+
+ // Step 2
+ re = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/;
+ if (re.test(w)) {
+ var fp = re.exec(w);
+ stem = fp[1];
+ suffix = fp[2];
+ re = new RegExp(mgr0);
+ if (re.test(stem))
+ w = stem + step2list[suffix];
+ }
+
+ // Step 3
+ re = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/;
+ if (re.test(w)) {
+ var fp = re.exec(w);
+ stem = fp[1];
+ suffix = fp[2];
+ re = new RegExp(mgr0);
+ if (re.test(stem))
+ w = stem + step3list[suffix];
+ }
+
+ // Step 4
+ re = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/;
+ re2 = /^(.+?)(s|t)(ion)$/;
+ if (re.test(w)) {
+ var fp = re.exec(w);
+ stem = fp[1];
+ re = new RegExp(mgr1);
+ if (re.test(stem))
+ w = stem;
+ }
+ else if (re2.test(w)) {
+ var fp = re2.exec(w);
+ stem = fp[1] + fp[2];
+ re2 = new RegExp(mgr1);
+ if (re2.test(stem))
+ w = stem;
+ }
+
+ // Step 5
+ re = /^(.+?)e$/;
+ if (re.test(w)) {
+ var fp = re.exec(w);
+ stem = fp[1];
+ re = new RegExp(mgr1);
+ re2 = new RegExp(meq1);
+ re3 = new RegExp("^" + C + v + "[^aeiouwxy]$");
+ if (re.test(stem) || (re2.test(stem) && !(re3.test(stem))))
+ w = stem;
+ }
+ re = /ll$/;
+ re2 = new RegExp(mgr1);
+ if (re.test(w) && re2.test(w)) {
+ re = /.$/;
+ w = w.replace(re,"");
+ }
+
+ // and turn initial Y back to y
+ if (firstch == "y")
+ w = firstch.toLowerCase() + w.substr(1);
+ return w;
+ }
+}
+
+
+/**
+ * Search Module
+ */
+var Search = {
+
+ _index : null,
+ _queued_query : null,
+ _pulse_status : -1,
+
+ init : function() {
+ var params = $.getQueryParameters();
+ if (params.q) {
+ var query = params.q[0];
+ $('input[name="q"]')[0].value = query;
+ this.performSearch(query);
+ }
+ },
+
+ loadIndex : function(url) {
+ $.ajax({type: "GET", url: url, data: null, success: null,
+ dataType: "script", cache: true});
+ },
+
+ setIndex : function(index) {
+ var q;
+ this._index = index;
+ if ((q = this._queued_query) !== null) {
+ this._queued_query = null;
+ Search.query(q);
+ }
+ },
+
+ hasIndex : function() {
+ return this._index !== null;
+ },
+
+ deferQuery : function(query) {
+ this._queued_query = query;
+ },
+
+ stopPulse : function() {
+ this._pulse_status = 0;
+ },
+
+ startPulse : function() {
+ if (this._pulse_status >= 0)
+ return;
+ function pulse() {
+ Search._pulse_status = (Search._pulse_status + 1) % 4;
+ var dotString = '';
+ for (var i = 0; i < Search._pulse_status; i++)
+ dotString += '.';
+ Search.dots.text(dotString);
+ if (Search._pulse_status > -1)
+ window.setTimeout(pulse, 500);
+ };
+ pulse();
+ },
+
+ /**
+ * perform a search for something
+ */
+ performSearch : function(query) {
+ // create the required interface elements
+ this.out = $('#search-results');
+ this.title = $('<h2>' + _('Searching') + '</h2>').appendTo(this.out);
+ this.dots = $('<span></span>').appendTo(this.title);
+ this.status = $('<p style="display: none"></p>').appendTo(this.out);
+ this.output = $('<ul class="search"/>').appendTo(this.out);
+
+ $('#search-progress').text(_('Preparing search...'));
+ this.startPulse();
+
+ // index already loaded, the browser was quick!
+ if (this.hasIndex())
+ this.query(query);
+ else
+ this.deferQuery(query);
+ },
+
+ query : function(query) {
+ var stopwords = ["and","then","into","it","as","are","in","if","for","no","there","their","was","is","be","to","that","but","they","not","such","with","by","a","on","these","of","will","this","near","the","or","at"];
+
+ // Stem the searchterms and add them to the correct list
+ var stemmer = new Stemmer();
+ var searchterms = [];
+ var excluded = [];
+ var hlterms = [];
+ var tmp = query.split(/\s+/);
+ var objectterms = [];
+ for (var i = 0; i < tmp.length; i++) {
+ if (tmp[i] != "") {
+ objectterms.push(tmp[i].toLowerCase());
+ }
+
+ if ($u.indexOf(stopwords, tmp[i]) != -1 || tmp[i].match(/^\d+$/) ||
+ tmp[i] == "") {
+ // skip this "word"
+ continue;
+ }
+ // stem the word
+ var word = stemmer.stemWord(tmp[i]).toLowerCase();
+ // select the correct list
+ if (word[0] == '-') {
+ var toAppend = excluded;
+ word = word.substr(1);
+ }
+ else {
+ var toAppend = searchterms;
+ hlterms.push(tmp[i].toLowerCase());
+ }
+ // only add if not already in the list
+ if (!$.contains(toAppend, word))
+ toAppend.push(word);
+ };
+ var highlightstring = '?highlight=' + $.urlencode(hlterms.join(" "));
+
+ // console.debug('SEARCH: searching for:');
+ // console.info('required: ', searchterms);
+ // console.info('excluded: ', excluded);
+
+ // prepare search
+ var filenames = this._index.filenames;
+ var titles = this._index.titles;
+ var terms = this._index.terms;
+ var fileMap = {};
+ var files = null;
+ // different result priorities
+ var importantResults = [];
+ var objectResults = [];
+ var regularResults = [];
+ var unimportantResults = [];
+ $('#search-progress').empty();
+
+ // lookup as object
+ for (var i = 0; i < objectterms.length; i++) {
+ var others = [].concat(objectterms.slice(0,i),
+ objectterms.slice(i+1, objectterms.length))
+ var results = this.performObjectSearch(objectterms[i], others);
+ // Assume first word is most likely to be the object,
+ // other words more likely to be in description.
+ // Therefore put matches for earlier words first.
+ // (Results are eventually used in reverse order).
+ objectResults = results[0].concat(objectResults);
+ importantResults = results[1].concat(importantResults);
+ unimportantResults = results[2].concat(unimportantResults);
+ }
+
+ // perform the search on the required terms
+ for (var i = 0; i < searchterms.length; i++) {
+ var word = searchterms[i];
+ // no match but word was a required one
+ if ((files = terms[word]) == null)
+ break;
+ if (files.length == undefined) {
+ files = [files];
+ }
+ // create the mapping
+ for (var j = 0; j < files.length; j++) {
+ var file = files[j];
+ if (file in fileMap)
+ fileMap[file].push(word);
+ else
+ fileMap[file] = [word];
+ }
+ }
+
+ // now check if the files don't contain excluded terms
+ for (var file in fileMap) {
+ var valid = true;
+
+ // check if all requirements are matched
+ if (fileMap[file].length != searchterms.length)
+ continue;
+
+ // ensure that none of the excluded terms is in the
+ // search result.
+ for (var i = 0; i < excluded.length; i++) {
+ if (terms[excluded[i]] == file ||
+ $.contains(terms[excluded[i]] || [], file)) {
+ valid = false;
+ break;
+ }
+ }
+
+ // if we have still a valid result we can add it
+ // to the result list
+ if (valid)
+ regularResults.push([filenames[file], titles[file], '', null]);
+ }
+
+ // delete unused variables in order to not waste
+ // memory until list is retrieved completely
+ delete filenames, titles, terms;
+
+ // now sort the regular results descending by title
+ regularResults.sort(function(a, b) {
+ var left = a[1].toLowerCase();
+ var right = b[1].toLowerCase();
+ return (left > right) ? -1 : ((left < right) ? 1 : 0);
+ });
+
+ // combine all results
+ var results = unimportantResults.concat(regularResults)
+ .concat(objectResults).concat(importantResults);
+
+ // print the results
+ var resultCount = results.length;
+ function displayNextItem() {
+ // results left, load the summary and display it
+ if (results.length) {
+ var item = results.pop();
+ var listItem = $('<li style="display:none"></li>');
+ if (DOCUMENTATION_OPTIONS.FILE_SUFFIX == '') {
+ // dirhtml builder
+ var dirname = item[0] + '/';
+ if (dirname.match(/\/index\/$/)) {
+ dirname = dirname.substring(0, dirname.length-6);
+ } else if (dirname == 'index/') {
+ dirname = '';
+ }
+ listItem.append($('<a/>').attr('href',
+ DOCUMENTATION_OPTIONS.URL_ROOT + dirname +
+ highlightstring + item[2]).html(item[1]));
+ } else {
+ // normal html builders
+ listItem.append($('<a/>').attr('href',
+ item[0] + DOCUMENTATION_OPTIONS.FILE_SUFFIX +
+ highlightstring + item[2]).html(item[1]));
+ }
+ if (item[3]) {
+ listItem.append($('<span> (' + item[3] + ')</span>'));
+ Search.output.append(listItem);
+ listItem.slideDown(5, function() {
+ displayNextItem();
+ });
+ } else if (DOCUMENTATION_OPTIONS.HAS_SOURCE) {
+ $.get(DOCUMENTATION_OPTIONS.URL_ROOT + '_sources/' +
+ item[0] + '.txt', function(data) {
+ if (data != '') {
+ listItem.append($.makeSearchSummary(data, searchterms, hlterms));
+ Search.output.append(listItem);
+ }
+ listItem.slideDown(5, function() {
+ displayNextItem();
+ });
+ }, "text");
+ } else {
+ // no source available, just display title
+ Search.output.append(listItem);
+ listItem.slideDown(5, function() {
+ displayNextItem();
+ });
+ }
+ }
+ // search finished, update title and status message
+ else {
+ Search.stopPulse();
+ Search.title.text(_('Search Results'));
+ if (!resultCount)
+ Search.status.text(_('Your search did not match any documents. Please make sure that all words are spelled correctly and that you\'ve selected enough categories.'));
+ else
+ Search.status.text(_('Search finished, found %s page(s) matching the search query.').replace('%s', resultCount));
+ Search.status.fadeIn(500);
+ }
+ }
+ displayNextItem();
+ },
+
+ performObjectSearch : function(object, otherterms) {
+ var filenames = this._index.filenames;
+ var objects = this._index.objects;
+ var objnames = this._index.objnames;
+ var titles = this._index.titles;
+
+ var importantResults = [];
+ var objectResults = [];
+ var unimportantResults = [];
+
+ for (var prefix in objects) {
+ for (var name in objects[prefix]) {
+ var fullname = (prefix ? prefix + '.' : '') + name;
+ if (fullname.toLowerCase().indexOf(object) > -1) {
+ var match = objects[prefix][name];
+ var objname = objnames[match[1]];
+ var title = titles[match[0]];
+ // If more than one term searched for, we require other words to be
+ // found in the name/title/description
+ if (otherterms.length > 0) {
+ var haystack = (prefix + ' ' + name + ' ' + objname + ' ' + title).toLowerCase();
+ var allfound = true;
+ for (var i = 0; i < otherterms.length; i++) {
+ if (haystack.indexOf(otherterms[i]) == -1) {
+ allfound = false;
+ break;
+ }
+ }
+ if (!allfound) {
+ continue;
+ }
+ }
+ var descr = objname + _(', in ') + title;
+ // XXX the generated anchors are not generally correct
+ // XXX there may be custom prefixes
+ result = [filenames[match[0]], fullname, '#'+fullname, descr];
+ switch (match[2]) {
+ case 1: objectResults.push(result); break;
+ case 0: importantResults.push(result); break;
+ case 2: unimportantResults.push(result); break;
+ }
+ }
+ }
+ }
+
+ // sort results descending
+ objectResults.sort(function(a, b) {
+ return (a[1] > b[1]) ? -1 : ((a[1] < b[1]) ? 1 : 0);
+ });
+
+ importantResults.sort(function(a, b) {
+ return (a[1] > b[1]) ? -1 : ((a[1] < b[1]) ? 1 : 0);
+ });
+
+ unimportantResults.sort(function(a, b) {
+ return (a[1] > b[1]) ? -1 : ((a[1] < b[1]) ? 1 : 0);
+ });
+
+ return [importantResults, objectResults, unimportantResults]
+ }
+}
+
+$(document).ready(function() {
+ Search.init();
+}); \ No newline at end of file
diff --git a/app/static/doc/flask-docs/_static/small_flask.css b/app/static/doc/flask-docs/_static/small_flask.css
new file mode 100644
index 0000000..1c6df30
--- /dev/null
+++ b/app/static/doc/flask-docs/_static/small_flask.css
@@ -0,0 +1,70 @@
+/*
+ * small_flask.css_t
+ * ~~~~~~~~~~~~~~~~~
+ *
+ * :copyright: Copyright 2010 by Armin Ronacher.
+ * :license: Flask Design License, see LICENSE for details.
+ */
+
+body {
+ margin: 0;
+ padding: 20px 30px;
+}
+
+div.documentwrapper {
+ float: none;
+ background: white;
+}
+
+div.sphinxsidebar {
+ display: block;
+ float: none;
+ width: 102.5%;
+ margin: 50px -30px -20px -30px;
+ padding: 10px 20px;
+ background: #333;
+ color: white;
+}
+
+div.sphinxsidebar h3, div.sphinxsidebar h4, div.sphinxsidebar p,
+div.sphinxsidebar h3 a {
+ color: white;
+}
+
+div.sphinxsidebar a {
+ color: #aaa;
+}
+
+div.sphinxsidebar p.logo {
+ display: none;
+}
+
+div.document {
+ width: 100%;
+ margin: 0;
+}
+
+div.related {
+ display: block;
+ margin: 0;
+ padding: 10px 0 20px 0;
+}
+
+div.related ul,
+div.related ul li {
+ margin: 0;
+ padding: 0;
+}
+
+div.footer {
+ display: none;
+}
+
+div.bodywrapper {
+ margin: 0;
+}
+
+div.body {
+ min-height: 0;
+ padding: 0;
+}
diff --git a/app/static/doc/flask-docs/_static/touch-icon.png b/app/static/doc/flask-docs/_static/touch-icon.png
new file mode 100644
index 0000000..cd1e91e
--- /dev/null
+++ b/app/static/doc/flask-docs/_static/touch-icon.png
Binary files differ
diff --git a/app/static/doc/flask-docs/_static/underscore.js b/app/static/doc/flask-docs/_static/underscore.js
new file mode 100644
index 0000000..5d89914
--- /dev/null
+++ b/app/static/doc/flask-docs/_static/underscore.js
@@ -0,0 +1,23 @@
+// Underscore.js 0.5.5
+// (c) 2009 Jeremy Ashkenas, DocumentCloud Inc.
+// Underscore is freely distributable under the terms of the MIT license.
+// Portions of Underscore are inspired by or borrowed from Prototype.js,
+// Oliver Steele's Functional, and John Resig's Micro-Templating.
+// For all details and documentation:
+// http://documentcloud.github.com/underscore/
+(function(){var j=this,n=j._,i=function(a){this._wrapped=a},m=typeof StopIteration!=="undefined"?StopIteration:"__break__",b=j._=function(a){return new i(a)};if(typeof exports!=="undefined")exports._=b;var k=Array.prototype.slice,o=Array.prototype.unshift,p=Object.prototype.toString,q=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;b.VERSION="0.5.5";b.each=function(a,c,d){try{if(a.forEach)a.forEach(c,d);else if(b.isArray(a)||b.isArguments(a))for(var e=0,f=a.length;e<f;e++)c.call(d,
+a[e],e,a);else{var g=b.keys(a);f=g.length;for(e=0;e<f;e++)c.call(d,a[g[e]],g[e],a)}}catch(h){if(h!=m)throw h;}return a};b.map=function(a,c,d){if(a&&b.isFunction(a.map))return a.map(c,d);var e=[];b.each(a,function(f,g,h){e.push(c.call(d,f,g,h))});return e};b.reduce=function(a,c,d,e){if(a&&b.isFunction(a.reduce))return a.reduce(b.bind(d,e),c);b.each(a,function(f,g,h){c=d.call(e,c,f,g,h)});return c};b.reduceRight=function(a,c,d,e){if(a&&b.isFunction(a.reduceRight))return a.reduceRight(b.bind(d,e),c);
+var f=b.clone(b.toArray(a)).reverse();b.each(f,function(g,h){c=d.call(e,c,g,h,a)});return c};b.detect=function(a,c,d){var e;b.each(a,function(f,g,h){if(c.call(d,f,g,h)){e=f;b.breakLoop()}});return e};b.select=function(a,c,d){if(a&&b.isFunction(a.filter))return a.filter(c,d);var e=[];b.each(a,function(f,g,h){c.call(d,f,g,h)&&e.push(f)});return e};b.reject=function(a,c,d){var e=[];b.each(a,function(f,g,h){!c.call(d,f,g,h)&&e.push(f)});return e};b.all=function(a,c,d){c=c||b.identity;if(a&&b.isFunction(a.every))return a.every(c,
+d);var e=true;b.each(a,function(f,g,h){(e=e&&c.call(d,f,g,h))||b.breakLoop()});return e};b.any=function(a,c,d){c=c||b.identity;if(a&&b.isFunction(a.some))return a.some(c,d);var e=false;b.each(a,function(f,g,h){if(e=c.call(d,f,g,h))b.breakLoop()});return e};b.include=function(a,c){if(b.isArray(a))return b.indexOf(a,c)!=-1;var d=false;b.each(a,function(e){if(d=e===c)b.breakLoop()});return d};b.invoke=function(a,c){var d=b.rest(arguments,2);return b.map(a,function(e){return(c?e[c]:e).apply(e,d)})};b.pluck=
+function(a,c){return b.map(a,function(d){return d[c]})};b.max=function(a,c,d){if(!c&&b.isArray(a))return Math.max.apply(Math,a);var e={computed:-Infinity};b.each(a,function(f,g,h){g=c?c.call(d,f,g,h):f;g>=e.computed&&(e={value:f,computed:g})});return e.value};b.min=function(a,c,d){if(!c&&b.isArray(a))return Math.min.apply(Math,a);var e={computed:Infinity};b.each(a,function(f,g,h){g=c?c.call(d,f,g,h):f;g<e.computed&&(e={value:f,computed:g})});return e.value};b.sortBy=function(a,c,d){return b.pluck(b.map(a,
+function(e,f,g){return{value:e,criteria:c.call(d,e,f,g)}}).sort(function(e,f){e=e.criteria;f=f.criteria;return e<f?-1:e>f?1:0}),"value")};b.sortedIndex=function(a,c,d){d=d||b.identity;for(var e=0,f=a.length;e<f;){var g=e+f>>1;d(a[g])<d(c)?(e=g+1):(f=g)}return e};b.toArray=function(a){if(!a)return[];if(a.toArray)return a.toArray();if(b.isArray(a))return a;if(b.isArguments(a))return k.call(a);return b.values(a)};b.size=function(a){return b.toArray(a).length};b.first=function(a,c,d){return c&&!d?k.call(a,
+0,c):a[0]};b.rest=function(a,c,d){return k.call(a,b.isUndefined(c)||d?1:c)};b.last=function(a){return a[a.length-1]};b.compact=function(a){return b.select(a,function(c){return!!c})};b.flatten=function(a){return b.reduce(a,[],function(c,d){if(b.isArray(d))return c.concat(b.flatten(d));c.push(d);return c})};b.without=function(a){var c=b.rest(arguments);return b.select(a,function(d){return!b.include(c,d)})};b.uniq=function(a,c){return b.reduce(a,[],function(d,e,f){if(0==f||(c===true?b.last(d)!=e:!b.include(d,
+e)))d.push(e);return d})};b.intersect=function(a){var c=b.rest(arguments);return b.select(b.uniq(a),function(d){return b.all(c,function(e){return b.indexOf(e,d)>=0})})};b.zip=function(){for(var a=b.toArray(arguments),c=b.max(b.pluck(a,"length")),d=new Array(c),e=0;e<c;e++)d[e]=b.pluck(a,String(e));return d};b.indexOf=function(a,c){if(a.indexOf)return a.indexOf(c);for(var d=0,e=a.length;d<e;d++)if(a[d]===c)return d;return-1};b.lastIndexOf=function(a,c){if(a.lastIndexOf)return a.lastIndexOf(c);for(var d=
+a.length;d--;)if(a[d]===c)return d;return-1};b.range=function(a,c,d){var e=b.toArray(arguments),f=e.length<=1;a=f?0:e[0];c=f?e[0]:e[1];d=e[2]||1;e=Math.ceil((c-a)/d);if(e<=0)return[];e=new Array(e);f=a;for(var g=0;1;f+=d){if((d>0?f-c:c-f)>=0)return e;e[g++]=f}};b.bind=function(a,c){var d=b.rest(arguments,2);return function(){return a.apply(c||j,d.concat(b.toArray(arguments)))}};b.bindAll=function(a){var c=b.rest(arguments);if(c.length==0)c=b.functions(a);b.each(c,function(d){a[d]=b.bind(a[d],a)});
+return a};b.delay=function(a,c){var d=b.rest(arguments,2);return setTimeout(function(){return a.apply(a,d)},c)};b.defer=function(a){return b.delay.apply(b,[a,1].concat(b.rest(arguments)))};b.wrap=function(a,c){return function(){var d=[a].concat(b.toArray(arguments));return c.apply(c,d)}};b.compose=function(){var a=b.toArray(arguments);return function(){for(var c=b.toArray(arguments),d=a.length-1;d>=0;d--)c=[a[d].apply(this,c)];return c[0]}};b.keys=function(a){if(b.isArray(a))return b.range(0,a.length);
+var c=[];for(var d in a)q.call(a,d)&&c.push(d);return c};b.values=function(a){return b.map(a,b.identity)};b.functions=function(a){return b.select(b.keys(a),function(c){return b.isFunction(a[c])}).sort()};b.extend=function(a,c){for(var d in c)a[d]=c[d];return a};b.clone=function(a){if(b.isArray(a))return a.slice(0);return b.extend({},a)};b.tap=function(a,c){c(a);return a};b.isEqual=function(a,c){if(a===c)return true;var d=typeof a;if(d!=typeof c)return false;if(a==c)return true;if(!a&&c||a&&!c)return false;
+if(a.isEqual)return a.isEqual(c);if(b.isDate(a)&&b.isDate(c))return a.getTime()===c.getTime();if(b.isNaN(a)&&b.isNaN(c))return true;if(b.isRegExp(a)&&b.isRegExp(c))return a.source===c.source&&a.global===c.global&&a.ignoreCase===c.ignoreCase&&a.multiline===c.multiline;if(d!=="object")return false;if(a.length&&a.length!==c.length)return false;d=b.keys(a);var e=b.keys(c);if(d.length!=e.length)return false;for(var f in a)if(!b.isEqual(a[f],c[f]))return false;return true};b.isEmpty=function(a){return b.keys(a).length==
+0};b.isElement=function(a){return!!(a&&a.nodeType==1)};b.isArray=function(a){return!!(a&&a.concat&&a.unshift)};b.isArguments=function(a){return a&&b.isNumber(a.length)&&!b.isArray(a)&&!r.call(a,"length")};b.isFunction=function(a){return!!(a&&a.constructor&&a.call&&a.apply)};b.isString=function(a){return!!(a===""||a&&a.charCodeAt&&a.substr)};b.isNumber=function(a){return p.call(a)==="[object Number]"};b.isDate=function(a){return!!(a&&a.getTimezoneOffset&&a.setUTCFullYear)};b.isRegExp=function(a){return!!(a&&
+a.test&&a.exec&&(a.ignoreCase||a.ignoreCase===false))};b.isNaN=function(a){return b.isNumber(a)&&isNaN(a)};b.isNull=function(a){return a===null};b.isUndefined=function(a){return typeof a=="undefined"};b.noConflict=function(){j._=n;return this};b.identity=function(a){return a};b.breakLoop=function(){throw m;};var s=0;b.uniqueId=function(a){var c=s++;return a?a+c:c};b.template=function(a,c){a=new Function("obj","var p=[],print=function(){p.push.apply(p,arguments);};with(obj){p.push('"+a.replace(/[\r\t\n]/g,
+" ").replace(/'(?=[^%]*%>)/g,"\t").split("'").join("\\'").split("\t").join("'").replace(/<%=(.+?)%>/g,"',$1,'").split("<%").join("');").split("%>").join("p.push('")+"');}return p.join('');");return c?a(c):a};b.forEach=b.each;b.foldl=b.inject=b.reduce;b.foldr=b.reduceRight;b.filter=b.select;b.every=b.all;b.some=b.any;b.head=b.first;b.tail=b.rest;b.methods=b.functions;var l=function(a,c){return c?b(a).chain():a};b.each(b.functions(b),function(a){var c=b[a];i.prototype[a]=function(){var d=b.toArray(arguments);
+o.call(d,this._wrapped);return l(c.apply(b,d),this._chain)}});b.each(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var c=Array.prototype[a];i.prototype[a]=function(){c.apply(this._wrapped,arguments);return l(this._wrapped,this._chain)}});b.each(["concat","join","slice"],function(a){var c=Array.prototype[a];i.prototype[a]=function(){return l(c.apply(this._wrapped,arguments),this._chain)}});i.prototype.chain=function(){this._chain=true;return this};i.prototype.value=function(){return this._wrapped}})();
diff --git a/app/static/doc/flask-docs/_static/up-pressed.png b/app/static/doc/flask-docs/_static/up-pressed.png
new file mode 100644
index 0000000..8bd587a
--- /dev/null
+++ b/app/static/doc/flask-docs/_static/up-pressed.png
Binary files differ
diff --git a/app/static/doc/flask-docs/_static/up.png b/app/static/doc/flask-docs/_static/up.png
new file mode 100644
index 0000000..b946256
--- /dev/null
+++ b/app/static/doc/flask-docs/_static/up.png
Binary files differ
diff --git a/app/static/doc/flask-docs/_static/websupport.js b/app/static/doc/flask-docs/_static/websupport.js
new file mode 100644
index 0000000..cbb6092
--- /dev/null
+++ b/app/static/doc/flask-docs/_static/websupport.js
@@ -0,0 +1,808 @@
+/*
+ * websupport.js
+ * ~~~~~~~~~~~~~
+ *
+ * sphinx.websupport utilties for all documentation.
+ *
+ * :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS.
+ * :license: BSD, see LICENSE for details.
+ *
+ */
+
+(function($) {
+ $.fn.autogrow = function() {
+ return this.each(function() {
+ var textarea = this;
+
+ $.fn.autogrow.resize(textarea);
+
+ $(textarea)
+ .focus(function() {
+ textarea.interval = setInterval(function() {
+ $.fn.autogrow.resize(textarea);
+ }, 500);
+ })
+ .blur(function() {
+ clearInterval(textarea.interval);
+ });
+ });
+ };
+
+ $.fn.autogrow.resize = function(textarea) {
+ var lineHeight = parseInt($(textarea).css('line-height'), 10);
+ var lines = textarea.value.split('\n');
+ var columns = textarea.cols;
+ var lineCount = 0;
+ $.each(lines, function() {
+ lineCount += Math.ceil(this.length / columns) || 1;
+ });
+ var height = lineHeight * (lineCount + 1);
+ $(textarea).css('height', height);
+ };
+})(jQuery);
+
+(function($) {
+ var comp, by;
+
+ function init() {
+ initEvents();
+ initComparator();
+ }
+
+ function initEvents() {
+ $('a.comment-close').live("click", function(event) {
+ event.preventDefault();
+ hide($(this).attr('id').substring(2));
+ });
+ $('a.vote').live("click", function(event) {
+ event.preventDefault();
+ handleVote($(this));
+ });
+ $('a.reply').live("click", function(event) {
+ event.preventDefault();
+ openReply($(this).attr('id').substring(2));
+ });
+ $('a.close-reply').live("click", function(event) {
+ event.preventDefault();
+ closeReply($(this).attr('id').substring(2));
+ });
+ $('a.sort-option').live("click", function(event) {
+ event.preventDefault();
+ handleReSort($(this));
+ });
+ $('a.show-proposal').live("click", function(event) {
+ event.preventDefault();
+ showProposal($(this).attr('id').substring(2));
+ });
+ $('a.hide-proposal').live("click", function(event) {
+ event.preventDefault();
+ hideProposal($(this).attr('id').substring(2));
+ });
+ $('a.show-propose-change').live("click", function(event) {
+ event.preventDefault();
+ showProposeChange($(this).attr('id').substring(2));
+ });
+ $('a.hide-propose-change').live("click", function(event) {
+ event.preventDefault();
+ hideProposeChange($(this).attr('id').substring(2));
+ });
+ $('a.accept-comment').live("click", function(event) {
+ event.preventDefault();
+ acceptComment($(this).attr('id').substring(2));
+ });
+ $('a.delete-comment').live("click", function(event) {
+ event.preventDefault();
+ deleteComment($(this).attr('id').substring(2));
+ });
+ $('a.comment-markup').live("click", function(event) {
+ event.preventDefault();
+ toggleCommentMarkupBox($(this).attr('id').substring(2));
+ });
+ }
+
+ /**
+ * Set comp, which is a comparator function used for sorting and
+ * inserting comments into the list.
+ */
+ function setComparator() {
+ // If the first three letters are "asc", sort in ascending order
+ // and remove the prefix.
+ if (by.substring(0,3) == 'asc') {
+ var i = by.substring(3);
+ comp = function(a, b) { return a[i] - b[i]; };
+ } else {
+ // Otherwise sort in descending order.
+ comp = function(a, b) { return b[by] - a[by]; };
+ }
+
+ // Reset link styles and format the selected sort option.
+ $('a.sel').attr('href', '#').removeClass('sel');
+ $('a.by' + by).removeAttr('href').addClass('sel');
+ }
+
+ /**
+ * Create a comp function. If the user has preferences stored in
+ * the sortBy cookie, use those, otherwise use the default.
+ */
+ function initComparator() {
+ by = 'rating'; // Default to sort by rating.
+ // If the sortBy cookie is set, use that instead.
+ if (document.cookie.length > 0) {
+ var start = document.cookie.indexOf('sortBy=');
+ if (start != -1) {
+ start = start + 7;
+ var end = document.cookie.indexOf(";", start);
+ if (end == -1) {
+ end = document.cookie.length;
+ by = unescape(document.cookie.substring(start, end));
+ }
+ }
+ }
+ setComparator();
+ }
+
+ /**
+ * Show a comment div.
+ */
+ function show(id) {
+ $('#ao' + id).hide();
+ $('#ah' + id).show();
+ var context = $.extend({id: id}, opts);
+ var popup = $(renderTemplate(popupTemplate, context)).hide();
+ popup.find('textarea[name="proposal"]').hide();
+ popup.find('a.by' + by).addClass('sel');
+ var form = popup.find('#cf' + id);
+ form.submit(function(event) {
+ event.preventDefault();
+ addComment(form);
+ });
+ $('#s' + id).after(popup);
+ popup.slideDown('fast', function() {
+ getComments(id);
+ });
+ }
+
+ /**
+ * Hide a comment div.
+ */
+ function hide(id) {
+ $('#ah' + id).hide();
+ $('#ao' + id).show();
+ var div = $('#sc' + id);
+ div.slideUp('fast', function() {
+ div.remove();
+ });
+ }
+
+ /**
+ * Perform an ajax request to get comments for a node
+ * and insert the comments into the comments tree.
+ */
+ function getComments(id) {
+ $.ajax({
+ type: 'GET',
+ url: opts.getCommentsURL,
+ data: {node: id},
+ success: function(data, textStatus, request) {
+ var ul = $('#cl' + id);
+ var speed = 100;
+ $('#cf' + id)
+ .find('textarea[name="proposal"]')
+ .data('source', data.source);
+
+ if (data.comments.length === 0) {
+ ul.html('<li>No comments yet.</li>');
+ ul.data('empty', true);
+ } else {
+ // If there are comments, sort them and put them in the list.
+ var comments = sortComments(data.comments);
+ speed = data.comments.length * 100;
+ appendComments(comments, ul);
+ ul.data('empty', false);
+ }
+ $('#cn' + id).slideUp(speed + 200);
+ ul.slideDown(speed);
+ },
+ error: function(request, textStatus, error) {
+ showError('Oops, there was a problem retrieving the comments.');
+ },
+ dataType: 'json'
+ });
+ }
+
+ /**
+ * Add a comment via ajax and insert the comment into the comment tree.
+ */
+ function addComment(form) {
+ var node_id = form.find('input[name="node"]').val();
+ var parent_id = form.find('input[name="parent"]').val();
+ var text = form.find('textarea[name="comment"]').val();
+ var proposal = form.find('textarea[name="proposal"]').val();
+
+ if (text == '') {
+ showError('Please enter a comment.');
+ return;
+ }
+
+ // Disable the form that is being submitted.
+ form.find('textarea,input').attr('disabled', 'disabled');
+
+ // Send the comment to the server.
+ $.ajax({
+ type: "POST",
+ url: opts.addCommentURL,
+ dataType: 'json',
+ data: {
+ node: node_id,
+ parent: parent_id,
+ text: text,
+ proposal: proposal
+ },
+ success: function(data, textStatus, error) {
+ // Reset the form.
+ if (node_id) {
+ hideProposeChange(node_id);
+ }
+ form.find('textarea')
+ .val('')
+ .add(form.find('input'))
+ .removeAttr('disabled');
+ var ul = $('#cl' + (node_id || parent_id));
+ if (ul.data('empty')) {
+ $(ul).empty();
+ ul.data('empty', false);
+ }
+ insertComment(data.comment);
+ var ao = $('#ao' + node_id);
+ ao.find('img').attr({'src': opts.commentBrightImage});
+ if (node_id) {
+ // if this was a "root" comment, remove the commenting box
+ // (the user can get it back by reopening the comment popup)
+ $('#ca' + node_id).slideUp();
+ }
+ },
+ error: function(request, textStatus, error) {
+ form.find('textarea,input').removeAttr('disabled');
+ showError('Oops, there was a problem adding the comment.');
+ }
+ });
+ }
+
+ /**
+ * Recursively append comments to the main comment list and children
+ * lists, creating the comment tree.
+ */
+ function appendComments(comments, ul) {
+ $.each(comments, function() {
+ var div = createCommentDiv(this);
+ ul.append($(document.createElement('li')).html(div));
+ appendComments(this.children, div.find('ul.comment-children'));
+ // To avoid stagnating data, don't store the comments children in data.
+ this.children = null;
+ div.data('comment', this);
+ });
+ }
+
+ /**
+ * After adding a new comment, it must be inserted in the correct
+ * location in the comment tree.
+ */
+ function insertComment(comment) {
+ var div = createCommentDiv(comment);
+
+ // To avoid stagnating data, don't store the comments children in data.
+ comment.children = null;
+ div.data('comment', comment);
+
+ var ul = $('#cl' + (comment.node || comment.parent));
+ var siblings = getChildren(ul);
+
+ var li = $(document.createElement('li'));
+ li.hide();
+
+ // Determine where in the parents children list to insert this comment.
+ for(i=0; i < siblings.length; i++) {
+ if (comp(comment, siblings[i]) <= 0) {
+ $('#cd' + siblings[i].id)
+ .parent()
+ .before(li.html(div));
+ li.slideDown('fast');
+ return;
+ }
+ }
+
+ // If we get here, this comment rates lower than all the others,
+ // or it is the only comment in the list.
+ ul.append(li.html(div));
+ li.slideDown('fast');
+ }
+
+ function acceptComment(id) {
+ $.ajax({
+ type: 'POST',
+ url: opts.acceptCommentURL,
+ data: {id: id},
+ success: function(data, textStatus, request) {
+ $('#cm' + id).fadeOut('fast');
+ $('#cd' + id).removeClass('moderate');
+ },
+ error: function(request, textStatus, error) {
+ showError('Oops, there was a problem accepting the comment.');
+ }
+ });
+ }
+
+ function deleteComment(id) {
+ $.ajax({
+ type: 'POST',
+ url: opts.deleteCommentURL,
+ data: {id: id},
+ success: function(data, textStatus, request) {
+ var div = $('#cd' + id);
+ if (data == 'delete') {
+ // Moderator mode: remove the comment and all children immediately
+ div.slideUp('fast', function() {
+ div.remove();
+ });
+ return;
+ }
+ // User mode: only mark the comment as deleted
+ div
+ .find('span.user-id:first')
+ .text('[deleted]').end()
+ .find('div.comment-text:first')
+ .text('[deleted]').end()
+ .find('#cm' + id + ', #dc' + id + ', #ac' + id + ', #rc' + id +
+ ', #sp' + id + ', #hp' + id + ', #cr' + id + ', #rl' + id)
+ .remove();
+ var comment = div.data('comment');
+ comment.username = '[deleted]';
+ comment.text = '[deleted]';
+ div.data('comment', comment);
+ },
+ error: function(request, textStatus, error) {
+ showError('Oops, there was a problem deleting the comment.');
+ }
+ });
+ }
+
+ function showProposal(id) {
+ $('#sp' + id).hide();
+ $('#hp' + id).show();
+ $('#pr' + id).slideDown('fast');
+ }
+
+ function hideProposal(id) {
+ $('#hp' + id).hide();
+ $('#sp' + id).show();
+ $('#pr' + id).slideUp('fast');
+ }
+
+ function showProposeChange(id) {
+ $('#pc' + id).hide();
+ $('#hc' + id).show();
+ var textarea = $('#pt' + id);
+ textarea.val(textarea.data('source'));
+ $.fn.autogrow.resize(textarea[0]);
+ textarea.slideDown('fast');
+ }
+
+ function hideProposeChange(id) {
+ $('#hc' + id).hide();
+ $('#pc' + id).show();
+ var textarea = $('#pt' + id);
+ textarea.val('').removeAttr('disabled');
+ textarea.slideUp('fast');
+ }
+
+ function toggleCommentMarkupBox(id) {
+ $('#mb' + id).toggle();
+ }
+
+ /** Handle when the user clicks on a sort by link. */
+ function handleReSort(link) {
+ var classes = link.attr('class').split(/\s+/);
+ for (var i=0; i<classes.length; i++) {
+ if (classes[i] != 'sort-option') {
+ by = classes[i].substring(2);
+ }
+ }
+ setComparator();
+ // Save/update the sortBy cookie.
+ var expiration = new Date();
+ expiration.setDate(expiration.getDate() + 365);
+ document.cookie= 'sortBy=' + escape(by) +
+ ';expires=' + expiration.toUTCString();
+ $('ul.comment-ul').each(function(index, ul) {
+ var comments = getChildren($(ul), true);
+ comments = sortComments(comments);
+ appendComments(comments, $(ul).empty());
+ });
+ }
+
+ /**
+ * Function to process a vote when a user clicks an arrow.
+ */
+ function handleVote(link) {
+ if (!opts.voting) {
+ showError("You'll need to login to vote.");
+ return;
+ }
+
+ var id = link.attr('id');
+ if (!id) {
+ // Didn't click on one of the voting arrows.
+ return;
+ }
+ // If it is an unvote, the new vote value is 0,
+ // Otherwise it's 1 for an upvote, or -1 for a downvote.
+ var value = 0;
+ if (id.charAt(1) != 'u') {
+ value = id.charAt(0) == 'u' ? 1 : -1;
+ }
+ // The data to be sent to the server.
+ var d = {
+ comment_id: id.substring(2),
+ value: value
+ };
+
+ // Swap the vote and unvote links.
+ link.hide();
+ $('#' + id.charAt(0) + (id.charAt(1) == 'u' ? 'v' : 'u') + d.comment_id)
+ .show();
+
+ // The div the comment is displayed in.
+ var div = $('div#cd' + d.comment_id);
+ var data = div.data('comment');
+
+ // If this is not an unvote, and the other vote arrow has
+ // already been pressed, unpress it.
+ if ((d.value !== 0) && (data.vote === d.value * -1)) {
+ $('#' + (d.value == 1 ? 'd' : 'u') + 'u' + d.comment_id).hide();
+ $('#' + (d.value == 1 ? 'd' : 'u') + 'v' + d.comment_id).show();
+ }
+
+ // Update the comments rating in the local data.
+ data.rating += (data.vote === 0) ? d.value : (d.value - data.vote);
+ data.vote = d.value;
+ div.data('comment', data);
+
+ // Change the rating text.
+ div.find('.rating:first')
+ .text(data.rating + ' point' + (data.rating == 1 ? '' : 's'));
+
+ // Send the vote information to the server.
+ $.ajax({
+ type: "POST",
+ url: opts.processVoteURL,
+ data: d,
+ error: function(request, textStatus, error) {
+ showError('Oops, there was a problem casting that vote.');
+ }
+ });
+ }
+
+ /**
+ * Open a reply form used to reply to an existing comment.
+ */
+ function openReply(id) {
+ // Swap out the reply link for the hide link
+ $('#rl' + id).hide();
+ $('#cr' + id).show();
+
+ // Add the reply li to the children ul.
+ var div = $(renderTemplate(replyTemplate, {id: id})).hide();
+ $('#cl' + id)
+ .prepend(div)
+ // Setup the submit handler for the reply form.
+ .find('#rf' + id)
+ .submit(function(event) {
+ event.preventDefault();
+ addComment($('#rf' + id));
+ closeReply(id);
+ })
+ .find('input[type=button]')
+ .click(function() {
+ closeReply(id);
+ });
+ div.slideDown('fast', function() {
+ $('#rf' + id).find('textarea').focus();
+ });
+ }
+
+ /**
+ * Close the reply form opened with openReply.
+ */
+ function closeReply(id) {
+ // Remove the reply div from the DOM.
+ $('#rd' + id).slideUp('fast', function() {
+ $(this).remove();
+ });
+
+ // Swap out the hide link for the reply link
+ $('#cr' + id).hide();
+ $('#rl' + id).show();
+ }
+
+ /**
+ * Recursively sort a tree of comments using the comp comparator.
+ */
+ function sortComments(comments) {
+ comments.sort(comp);
+ $.each(comments, function() {
+ this.children = sortComments(this.children);
+ });
+ return comments;
+ }
+
+ /**
+ * Get the children comments from a ul. If recursive is true,
+ * recursively include childrens' children.
+ */
+ function getChildren(ul, recursive) {
+ var children = [];
+ ul.children().children("[id^='cd']")
+ .each(function() {
+ var comment = $(this).data('comment');
+ if (recursive)
+ comment.children = getChildren($(this).find('#cl' + comment.id), true);
+ children.push(comment);
+ });
+ return children;
+ }
+
+ /** Create a div to display a comment in. */
+ function createCommentDiv(comment) {
+ if (!comment.displayed && !opts.moderator) {
+ return $('<div class="moderate">Thank you! Your comment will show up '
+ + 'once it is has been approved by a moderator.</div>');
+ }
+ // Prettify the comment rating.
+ comment.pretty_rating = comment.rating + ' point' +
+ (comment.rating == 1 ? '' : 's');
+ // Make a class (for displaying not yet moderated comments differently)
+ comment.css_class = comment.displayed ? '' : ' moderate';
+ // Create a div for this comment.
+ var context = $.extend({}, opts, comment);
+ var div = $(renderTemplate(commentTemplate, context));
+
+ // If the user has voted on this comment, highblight the correct arrow.
+ if (comment.vote) {
+ var direction = (comment.vote == 1) ? 'u' : 'd';
+ div.find('#' + direction + 'v' + comment.id).hide();
+ div.find('#' + direction + 'u' + comment.id).show();
+ }
+
+ if (opts.moderator || comment.text != '[deleted]') {
+ div.find('a.reply').show();
+ if (comment.proposal_diff)
+ div.find('#sp' + comment.id).show();
+ if (opts.moderator && !comment.displayed)
+ div.find('#cm' + comment.id).show();
+ if (opts.moderator || (opts.username == comment.username))
+ div.find('#dc' + comment.id).show();
+ }
+ return div;
+ }
+
+ /**
+ * A simple template renderer. Placeholders such as <%id%> are replaced
+ * by context['id'] with items being escaped. Placeholders such as <#id#>
+ * are not escaped.
+ */
+ function renderTemplate(template, context) {
+ var esc = $(document.createElement('div'));
+
+ function handle(ph, escape) {
+ var cur = context;
+ $.each(ph.split('.'), function() {
+ cur = cur[this];
+ });
+ return escape ? esc.text(cur || "").html() : cur;
+ }
+
+ return template.replace(/<([%#])([\w\.]*)\1>/g, function() {
+ return handle(arguments[2], arguments[1] == '%' ? true : false);
+ });
+ }
+
+ /** Flash an error message briefly. */
+ function showError(message) {
+ $(document.createElement('div')).attr({'class': 'popup-error'})
+ .append($(document.createElement('div'))
+ .attr({'class': 'error-message'}).text(message))
+ .appendTo('body')
+ .fadeIn("slow")
+ .delay(2000)
+ .fadeOut("slow");
+ }
+
+ /** Add a link the user uses to open the comments popup. */
+ $.fn.comment = function() {
+ return this.each(function() {
+ var id = $(this).attr('id').substring(1);
+ var count = COMMENT_METADATA[id];
+ var title = count + ' comment' + (count == 1 ? '' : 's');
+ var image = count > 0 ? opts.commentBrightImage : opts.commentImage;
+ var addcls = count == 0 ? ' nocomment' : '';
+ $(this)
+ .append(
+ $(document.createElement('a')).attr({
+ href: '#',
+ 'class': 'sphinx-comment-open' + addcls,
+ id: 'ao' + id
+ })
+ .append($(document.createElement('img')).attr({
+ src: image,
+ alt: 'comment',
+ title: title
+ }))
+ .click(function(event) {
+ event.preventDefault();
+ show($(this).attr('id').substring(2));
+ })
+ )
+ .append(
+ $(document.createElement('a')).attr({
+ href: '#',
+ 'class': 'sphinx-comment-close hidden',
+ id: 'ah' + id
+ })
+ .append($(document.createElement('img')).attr({
+ src: opts.closeCommentImage,
+ alt: 'close',
+ title: 'close'
+ }))
+ .click(function(event) {
+ event.preventDefault();
+ hide($(this).attr('id').substring(2));
+ })
+ );
+ });
+ };
+
+ var opts = {
+ processVoteURL: '/_process_vote',
+ addCommentURL: '/_add_comment',
+ getCommentsURL: '/_get_comments',
+ acceptCommentURL: '/_accept_comment',
+ deleteCommentURL: '/_delete_comment',
+ commentImage: '/static/_static/comment.png',
+ closeCommentImage: '/static/_static/comment-close.png',
+ loadingImage: '/static/_static/ajax-loader.gif',
+ commentBrightImage: '/static/_static/comment-bright.png',
+ upArrow: '/static/_static/up.png',
+ downArrow: '/static/_static/down.png',
+ upArrowPressed: '/static/_static/up-pressed.png',
+ downArrowPressed: '/static/_static/down-pressed.png',
+ voting: false,
+ moderator: false
+ };
+
+ if (typeof COMMENT_OPTIONS != "undefined") {
+ opts = jQuery.extend(opts, COMMENT_OPTIONS);
+ }
+
+ var popupTemplate = '\
+ <div class="sphinx-comments" id="sc<%id%>">\
+ <p class="sort-options">\
+ Sort by:\
+ <a href="#" class="sort-option byrating">best rated</a>\
+ <a href="#" class="sort-option byascage">newest</a>\
+ <a href="#" class="sort-option byage">oldest</a>\
+ </p>\
+ <div class="comment-header">Comments</div>\
+ <div class="comment-loading" id="cn<%id%>">\
+ loading comments... <img src="<%loadingImage%>" alt="" /></div>\
+ <ul id="cl<%id%>" class="comment-ul"></ul>\
+ <div id="ca<%id%>">\
+ <p class="add-a-comment">Add a comment\
+ (<a href="#" class="comment-markup" id="ab<%id%>">markup</a>):</p>\
+ <div class="comment-markup-box" id="mb<%id%>">\
+ reStructured text markup: <i>*emph*</i>, <b>**strong**</b>, \
+ <tt>``code``</tt>, \
+ code blocks: <tt>::</tt> and an indented block after blank line</div>\
+ <form method="post" id="cf<%id%>" class="comment-form" action="">\
+ <textarea name="comment" cols="80"></textarea>\
+ <p class="propose-button">\
+ <a href="#" id="pc<%id%>" class="show-propose-change">\
+ Propose a change &#9657;\
+ </a>\
+ <a href="#" id="hc<%id%>" class="hide-propose-change">\
+ Propose a change &#9663;\
+ </a>\
+ </p>\
+ <textarea name="proposal" id="pt<%id%>" cols="80"\
+ spellcheck="false"></textarea>\
+ <input type="submit" value="Add comment" />\
+ <input type="hidden" name="node" value="<%id%>" />\
+ <input type="hidden" name="parent" value="" />\
+ </form>\
+ </div>\
+ </div>';
+
+ var commentTemplate = '\
+ <div id="cd<%id%>" class="sphinx-comment<%css_class%>">\
+ <div class="vote">\
+ <div class="arrow">\
+ <a href="#" id="uv<%id%>" class="vote" title="vote up">\
+ <img src="<%upArrow%>" />\
+ </a>\
+ <a href="#" id="uu<%id%>" class="un vote" title="vote up">\
+ <img src="<%upArrowPressed%>" />\
+ </a>\
+ </div>\
+ <div class="arrow">\
+ <a href="#" id="dv<%id%>" class="vote" title="vote down">\
+ <img src="<%downArrow%>" id="da<%id%>" />\
+ </a>\
+ <a href="#" id="du<%id%>" class="un vote" title="vote down">\
+ <img src="<%downArrowPressed%>" />\
+ </a>\
+ </div>\
+ </div>\
+ <div class="comment-content">\
+ <p class="tagline comment">\
+ <span class="user-id"><%username%></span>\
+ <span class="rating"><%pretty_rating%></span>\
+ <span class="delta"><%time.delta%></span>\
+ </p>\
+ <div class="comment-text comment"><#text#></div>\
+ <p class="comment-opts comment">\
+ <a href="#" class="reply hidden" id="rl<%id%>">reply &#9657;</a>\
+ <a href="#" class="close-reply" id="cr<%id%>">reply &#9663;</a>\
+ <a href="#" id="sp<%id%>" class="show-proposal">proposal &#9657;</a>\
+ <a href="#" id="hp<%id%>" class="hide-proposal">proposal &#9663;</a>\
+ <a href="#" id="dc<%id%>" class="delete-comment hidden">delete</a>\
+ <span id="cm<%id%>" class="moderation hidden">\
+ <a href="#" id="ac<%id%>" class="accept-comment">accept</a>\
+ </span>\
+ </p>\
+ <pre class="proposal" id="pr<%id%>">\
+<#proposal_diff#>\
+ </pre>\
+ <ul class="comment-children" id="cl<%id%>"></ul>\
+ </div>\
+ <div class="clearleft"></div>\
+ </div>\
+ </div>';
+
+ var replyTemplate = '\
+ <li>\
+ <div class="reply-div" id="rd<%id%>">\
+ <form id="rf<%id%>">\
+ <textarea name="comment" cols="80"></textarea>\
+ <input type="submit" value="Add reply" />\
+ <input type="button" value="Cancel" />\
+ <input type="hidden" name="parent" value="<%id%>" />\
+ <input type="hidden" name="node" value="" />\
+ </form>\
+ </div>\
+ </li>';
+
+ $(document).ready(function() {
+ init();
+ });
+})(jQuery);
+
+$(document).ready(function() {
+ // add comment anchors for all paragraphs that are commentable
+ $('.sphinx-has-comment').comment();
+
+ // highlight search words in search results
+ $("div.context").each(function() {
+ var params = $.getQueryParameters();
+ var terms = (params.q) ? params.q[0].split(/\s+/) : [];
+ var result = $(this);
+ $.each(terms, function() {
+ result.highlightText(this.toLowerCase(), 'highlighted');
+ });
+ });
+
+ // directly open comment window if requested
+ var anchor = document.location.hash;
+ if (anchor.substring(0, 9) == '#comment-') {
+ $('#ao' + anchor.substring(9)).click();
+ document.location.hash = '#s' + anchor.substring(9);
+ }
+});
diff --git a/app/static/doc/flask-docs/_static/yes.png b/app/static/doc/flask-docs/_static/yes.png
new file mode 100644
index 0000000..ac27c4e
--- /dev/null
+++ b/app/static/doc/flask-docs/_static/yes.png
Binary files differ
diff --git a/app/static/doc/flask-docs/api.html b/app/static/doc/flask-docs/api.html
new file mode 100644
index 0000000..f130677
--- /dev/null
+++ b/app/static/doc/flask-docs/api.html
@@ -0,0 +1,3475 @@
+
+<!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>API &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="index.html" />
+ <link rel="next" title="Design Decisions in Flask" href="design.html" />
+ <link rel="prev" title="Becoming Big" href="becomingbig.html" />
+
+
+ <link rel="apple-touch-icon" href="_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <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="design.html" title="Design Decisions in Flask"
+ accesskey="N">next</a> |</li>
+ <li class="right" >
+ <a href="becomingbig.html" title="Becoming Big"
+ accesskey="P">previous</a> |</li>
+ <li><a href="index.html">Flask 0.8 documentation</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="api">
+<span id="id1"></span><h1>API<a class="headerlink" href="#api" title="Permalink to this headline">¶</a></h1>
+<span class="target" id="module-flask"></span><p>This part of the documentation covers all the interfaces of Flask. For
+parts where Flask depends on external libraries, we document the most
+important right here and provide links to the canonical documentation.</p>
+<div class="section" id="application-object">
+<h2>Application Object<a class="headerlink" href="#application-object" title="Permalink to this headline">¶</a></h2>
+<dl class="class">
+<dt id="flask.Flask">
+<em class="property">class </em><tt class="descclassname">flask.</tt><tt class="descname">Flask</tt><big>(</big><em>import_name</em>, <em>static_path=None</em>, <em>static_url_path=None</em>, <em>static_folder='static'</em>, <em>template_folder='templates'</em>, <em>instance_path=None</em>, <em>instance_relative_config=False</em><big>)</big><a class="headerlink" href="#flask.Flask" title="Permalink to this definition">¶</a></dt>
+<dd><p>The flask object implements a WSGI application and acts as the central
+object. It is passed the name of the module or package of the
+application. Once it is created it will act as a central registry for
+the view functions, the URL rules, template configuration and much more.</p>
+<p>The name of the package is used to resolve resources from inside the
+package or the folder the module is contained in depending on if the
+package parameter resolves to an actual python package (a folder with
+an <cite>__init__.py</cite> file inside) or a standard module (just a <cite>.py</cite> file).</p>
+<p>For more information about resource loading, see <a class="reference internal" href="#flask.Flask.open_resource" title="flask.Flask.open_resource"><tt class="xref py py-func docutils literal"><span class="pre">open_resource()</span></tt></a>.</p>
+<p>Usually you create a <a class="reference internal" href="#flask.Flask" title="flask.Flask"><tt class="xref py py-class docutils literal"><span class="pre">Flask</span></tt></a> instance in your main module or
+in the <cite>__init__.py</cite> file of your package like this:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">Flask</span>
+<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>
+</pre></div>
+</div>
+<div class="admonition-about-the-first-parameter admonition ">
+<p class="first admonition-title">About the First Parameter</p>
+<p>The idea of the first parameter is to give Flask an idea what
+belongs to your application. This name is used to find resources
+on the file system, can be used by extensions to improve debugging
+information and a lot more.</p>
+<p>So it&#8217;s important what you provide there. If you are using a single
+module, <cite>__name__</cite> is always the correct value. If you however are
+using a package, it&#8217;s usually recommended to hardcode the name of
+your package there.</p>
+<p>For example if your application is defined in <cite>yourapplication/app.py</cite>
+you should create it with one of the two versions below:</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="s">&#39;yourapplication&#39;</span><span class="p">)</span>
+<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="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;.&#39;</span><span class="p">)[</span><span class="mi">0</span><span class="p">])</span>
+</pre></div>
+</div>
+<p class="last">Why is that? The application will work even with <cite>__name__</cite>, thanks
+to how resources are looked up. However it will make debugging more
+painful. Certain extensions can make assumptions based on the
+import name of your application. For example the Flask-SQLAlchemy
+extension will look for the code in your application that triggered
+an SQL query in debug mode. If the import name is not properly set
+up, that debugging information is lost. (For example it would only
+pick up SQL queries in <cite>yourapplication.app</cite> and not
+<cite>yourapplication.views.frontend</cite>)</p>
+</div>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.7: </span>The <cite>static_url_path</cite>, <cite>static_folder</cite>, and <cite>template_folder</cite>
+parameters were added.</p>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.8: </span>The <cite>instance_path</cite> and <cite>instance_relative_config</cite> parameters were
+added.</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>import_name</strong> &#8211; the name of the application package</li>
+<li><strong>static_url_path</strong> &#8211; can be used to specify a different path for the
+static files on the web. Defaults to the name
+of the <cite>static_folder</cite> folder.</li>
+<li><strong>static_folder</strong> &#8211; the folder with static files that should be served
+at <cite>static_url_path</cite>. Defaults to the <tt class="docutils literal"><span class="pre">'static'</span></tt>
+folder in the root path of the application.</li>
+<li><strong>template_folder</strong> &#8211; the folder that contains the templates that should
+be used by the application. Defaults to
+<tt class="docutils literal"><span class="pre">'templates'</span></tt> folder in the root path of the
+application.</li>
+<li><strong>instance_path</strong> &#8211; An alternative instance path for the application.
+By default the folder <tt class="docutils literal"><span class="pre">'instance'</span></tt> next to the
+package or module is assumed to be the instance
+path.</li>
+<li><strong>instance_relative_config</strong> &#8211; if set to <cite>True</cite> relative filenames
+for loading the config are assumed to
+be relative to the instance path instead
+of the application root.</li>
+</ul>
+</td>
+</tr>
+</tbody>
+</table>
+<dl class="method">
+<dt id="flask.Flask.add_url_rule">
+<tt class="descname">add_url_rule</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#flask.Flask.add_url_rule" title="Permalink to this definition">¶</a></dt>
+<dd><p>Connects a URL rule. Works exactly like the <a class="reference internal" href="#flask.Flask.route" title="flask.Flask.route"><tt class="xref py py-meth docutils literal"><span class="pre">route()</span></tt></a>
+decorator. If a view_func is provided it will be registered with the
+endpoint.</p>
+<p>Basically this example:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/&#39;</span><span class="p">)</span>
+<span class="k">def</span> <span class="nf">index</span><span class="p">():</span>
+ <span class="k">pass</span>
+</pre></div>
+</div>
+<p>Is equivalent to the following:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">def</span> <span class="nf">index</span><span class="p">():</span>
+ <span class="k">pass</span>
+<span class="n">app</span><span class="o">.</span><span class="n">add_url_rule</span><span class="p">(</span><span class="s">&#39;/&#39;</span><span class="p">,</span> <span class="s">&#39;index&#39;</span><span class="p">,</span> <span class="n">index</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>If the view_func is not provided you will need to connect the endpoint
+to a view function like so:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="n">app</span><span class="o">.</span><span class="n">view_functions</span><span class="p">[</span><span class="s">&#39;index&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">index</span>
+</pre></div>
+</div>
+<p>Internally <a class="reference internal" href="#flask.Flask.route" title="flask.Flask.route"><tt class="xref py py-meth docutils literal"><span class="pre">route()</span></tt></a> invokes <a class="reference internal" href="#flask.Flask.add_url_rule" title="flask.Flask.add_url_rule"><tt class="xref py py-meth docutils literal"><span class="pre">add_url_rule()</span></tt></a> so if you want
+to customize the behavior via subclassing you only need to change
+this method.</p>
+<p>For more information refer to <a class="reference internal" href="#url-route-registrations"><em>URL Route Registrations</em></a>.</p>
+<p class="versionchanged">
+<span class="versionmodified">Changed in version 0.2: </span><cite>view_func</cite> parameter added.</p>
+<p class="versionchanged">
+<span class="versionmodified">Changed in version 0.6: </span><cite>OPTIONS</cite> is added automatically as method.</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>rule</strong> &#8211; the URL rule as string</li>
+<li><strong>endpoint</strong> &#8211; the endpoint for the registered URL rule. Flask
+itself assumes the name of the view function as
+endpoint</li>
+<li><strong>view_func</strong> &#8211; the function to call when serving a request to the
+provided endpoint</li>
+<li><strong>options</strong> &#8211; the options to be forwarded to the underlying
+<a class="reference external" href="http://werkzeug.pocoo.org/docs/routing/#werkzeug.routing.Rule" title="(in Werkzeug v0.7)"><tt class="xref py py-class docutils literal"><span class="pre">Rule</span></tt></a> object. A change
+to Werkzeug is handling of method options. methods
+is a list of methods this rule should be limited
+to (<cite>GET</cite>, <cite>POST</cite> etc.). By default a rule
+just listens for <cite>GET</cite> (and implicitly <cite>HEAD</cite>).
+Starting with Flask 0.6, <cite>OPTIONS</cite> is implicitly
+added and handled by the standard request handling.</li>
+</ul>
+</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Flask.after_request">
+<tt class="descname">after_request</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#flask.Flask.after_request" title="Permalink to this definition">¶</a></dt>
+<dd><p>Register a function to be run after each request. Your function
+must take one parameter, a <a class="reference internal" href="#flask.Flask.response_class" title="flask.Flask.response_class"><tt class="xref py py-attr docutils literal"><span class="pre">response_class</span></tt></a> object and return
+a new response object or the same (see <a class="reference internal" href="#flask.Flask.process_response" title="flask.Flask.process_response"><tt class="xref py py-meth docutils literal"><span class="pre">process_response()</span></tt></a>).</p>
+<p>As of Flask 0.7 this function might not be executed at the end of the
+request in case an unhandled exception ocurred.</p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Flask.after_request_funcs">
+<tt class="descname">after_request_funcs</tt><em class="property"> = None</em><a class="headerlink" href="#flask.Flask.after_request_funcs" title="Permalink to this definition">¶</a></dt>
+<dd><p>A dictionary with lists of functions that should be called after
+each request. The key of the dictionary is the name of the blueprint
+this function is active for, <cite>None</cite> for all requests. This can for
+example be used to open database connections or getting hold of the
+currently logged in user. To register a function here, use the
+<a class="reference internal" href="#flask.Flask.after_request" title="flask.Flask.after_request"><tt class="xref py py-meth docutils literal"><span class="pre">after_request()</span></tt></a> decorator.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Flask.auto_find_instance_path">
+<tt class="descname">auto_find_instance_path</tt><big>(</big><big>)</big><a class="headerlink" href="#flask.Flask.auto_find_instance_path" title="Permalink to this definition">¶</a></dt>
+<dd><p>Tries to locate the instance path if it was not provided to the
+constructor of the application class. It will basically calculate
+the path to a folder named <tt class="docutils literal"><span class="pre">instance</span></tt> next to your main file or
+the package.</p>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.8.</span></p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Flask.before_first_request">
+<tt class="descname">before_first_request</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#flask.Flask.before_first_request" title="Permalink to this definition">¶</a></dt>
+<dd><p>Registers a function to be run before the first request to this
+instance of the application.</p>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.8.</span></p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Flask.before_first_request_funcs">
+<tt class="descname">before_first_request_funcs</tt><em class="property"> = None</em><a class="headerlink" href="#flask.Flask.before_first_request_funcs" title="Permalink to this definition">¶</a></dt>
+<dd><p>A lists of functions that should be called at the beginning of the
+first request to this instance. To register a function here, use
+the <a class="reference internal" href="#flask.Flask.before_first_request" title="flask.Flask.before_first_request"><tt class="xref py py-meth docutils literal"><span class="pre">before_first_request()</span></tt></a> decorator.</p>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.8.</span></p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Flask.before_request">
+<tt class="descname">before_request</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#flask.Flask.before_request" title="Permalink to this definition">¶</a></dt>
+<dd><p>Registers a function to run before each request.</p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Flask.before_request_funcs">
+<tt class="descname">before_request_funcs</tt><em class="property"> = None</em><a class="headerlink" href="#flask.Flask.before_request_funcs" title="Permalink to this definition">¶</a></dt>
+<dd><p>A dictionary with lists of functions that should be called at the
+beginning of the request. The key of the dictionary is the name of
+the blueprint this function is active for, <cite>None</cite> for all requests.
+This can for example be used to open database connections or
+getting hold of the currently logged in user. To register a
+function here, use the <a class="reference internal" href="#flask.Flask.before_request" title="flask.Flask.before_request"><tt class="xref py py-meth docutils literal"><span class="pre">before_request()</span></tt></a> decorator.</p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Flask.blueprints">
+<tt class="descname">blueprints</tt><em class="property"> = None</em><a class="headerlink" href="#flask.Flask.blueprints" title="Permalink to this definition">¶</a></dt>
+<dd><p>all the attached blueprints in a directory by name. Blueprints
+can be attached multiple times so this dictionary does not tell
+you how often they got attached.</p>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.7.</span></p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Flask.config">
+<tt class="descname">config</tt><em class="property"> = None</em><a class="headerlink" href="#flask.Flask.config" title="Permalink to this definition">¶</a></dt>
+<dd><p>The configuration dictionary as <a class="reference internal" href="#flask.Config" title="flask.Config"><tt class="xref py py-class docutils literal"><span class="pre">Config</span></tt></a>. This behaves
+exactly like a regular dictionary but supports additional methods
+to load a config from files.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Flask.context_processor">
+<tt class="descname">context_processor</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#flask.Flask.context_processor" title="Permalink to this definition">¶</a></dt>
+<dd><p>Registers a template context processor function.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Flask.create_global_jinja_loader">
+<tt class="descname">create_global_jinja_loader</tt><big>(</big><big>)</big><a class="headerlink" href="#flask.Flask.create_global_jinja_loader" title="Permalink to this definition">¶</a></dt>
+<dd><p>Creates the loader for the Jinja2 environment. Can be used to
+override just the loader and keeping the rest unchanged. It&#8217;s
+discouraged to override this function. Instead one should override
+the <a class="reference internal" href="#flask.Flask.jinja_loader" title="flask.Flask.jinja_loader"><tt class="xref py py-meth docutils literal"><span class="pre">jinja_loader()</span></tt></a> function instead.</p>
+<p>The global loader dispatches between the loaders of the application
+and the individual blueprints.</p>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.7.</span></p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Flask.create_jinja_environment">
+<tt class="descname">create_jinja_environment</tt><big>(</big><big>)</big><a class="headerlink" href="#flask.Flask.create_jinja_environment" title="Permalink to this definition">¶</a></dt>
+<dd><p>Creates the Jinja2 environment based on <a class="reference internal" href="#flask.Flask.jinja_options" title="flask.Flask.jinja_options"><tt class="xref py py-attr docutils literal"><span class="pre">jinja_options</span></tt></a>
+and <a class="reference internal" href="#flask.Flask.select_jinja_autoescape" title="flask.Flask.select_jinja_autoescape"><tt class="xref py py-meth docutils literal"><span class="pre">select_jinja_autoescape()</span></tt></a>. Since 0.7 this also adds
+the Jinja2 globals and filters after initialization. Override
+this function to customize the behavior.</p>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.5.</span></p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Flask.create_url_adapter">
+<tt class="descname">create_url_adapter</tt><big>(</big><em>request</em><big>)</big><a class="headerlink" href="#flask.Flask.create_url_adapter" title="Permalink to this definition">¶</a></dt>
+<dd><p>Creates a URL adapter for the given request. The URL adapter
+is created at a point where the request context is not yet set up
+so the request is passed explicitly.</p>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.6.</span></p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Flask.debug">
+<tt class="descname">debug</tt><a class="headerlink" href="#flask.Flask.debug" title="Permalink to this definition">¶</a></dt>
+<dd><p>The debug flag. Set this to <cite>True</cite> to enable debugging of the
+application. In debug mode the debugger will kick in when an unhandled
+exception ocurrs and the integrated server will automatically reload
+the application if changes in the code are detected.</p>
+<p>This attribute can also be configured from the config with the <cite>DEBUG</cite>
+configuration key. Defaults to <cite>False</cite>.</p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Flask.debug_log_format">
+<tt class="descname">debug_log_format</tt><em class="property"> = '--------------------------------------------------------------------------------\n%(levelname)s in %(module)s [%(pathname)s:%(lineno)d]:\n%(message)s\n--------------------------------------------------------------------------------'</em><a class="headerlink" href="#flask.Flask.debug_log_format" title="Permalink to this definition">¶</a></dt>
+<dd><p>The logging format used for the debug logger. This is only used when
+the application is in debug mode, otherwise the attached logging
+handler does the formatting.</p>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.3.</span></p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Flask.default_config">
+<tt class="descname">default_config</tt><em class="property"> = ImmutableDict({'USE_X_SENDFILE': False, 'SESSION_COOKIE_PATH': None, 'SESSION_COOKIE_DOMAIN': None, 'SESSION_COOKIE_NAME': 'session', 'LOGGER_NAME': None, 'DEBUG': False, 'SECRET_KEY': None, 'MAX_CONTENT_LENGTH': None, 'APPLICATION_ROOT': None, 'SERVER_NAME': None, 'TESTING': False, 'PERMANENT_SESSION_LIFETIME': datetime.timedelta(31), 'PROPAGATE_EXCEPTIONS': None, 'TRAP_BAD_REQUEST_ERRORS': False, 'TRAP_HTTP_EXCEPTIONS': False, 'PRESERVE_CONTEXT_ON_EXCEPTION': None, 'SESSION_COOKIE_SECURE': False, 'SESSION_COOKIE_HTTPONLY': True})</em><a class="headerlink" href="#flask.Flask.default_config" title="Permalink to this definition">¶</a></dt>
+<dd><p>Default configuration parameters.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Flask.dispatch_request">
+<tt class="descname">dispatch_request</tt><big>(</big><big>)</big><a class="headerlink" href="#flask.Flask.dispatch_request" title="Permalink to this definition">¶</a></dt>
+<dd><p>Does the request dispatching. Matches the URL and returns the
+return value of the view or error handler. This does not have to
+be a response object. In order to convert the return value to a
+proper response object, call <a class="reference internal" href="#flask.make_response" title="flask.make_response"><tt class="xref py py-func docutils literal"><span class="pre">make_response()</span></tt></a>.</p>
+<p class="versionchanged">
+<span class="versionmodified">Changed in version 0.7: </span>This no longer does the exception handling, this code was
+moved to the new <a class="reference internal" href="#flask.Flask.full_dispatch_request" title="flask.Flask.full_dispatch_request"><tt class="xref py py-meth docutils literal"><span class="pre">full_dispatch_request()</span></tt></a>.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Flask.do_teardown_request">
+<tt class="descname">do_teardown_request</tt><big>(</big><big>)</big><a class="headerlink" href="#flask.Flask.do_teardown_request" title="Permalink to this definition">¶</a></dt>
+<dd><p>Called after the actual request dispatching and will
+call every as <a class="reference internal" href="#flask.Flask.teardown_request" title="flask.Flask.teardown_request"><tt class="xref py py-meth docutils literal"><span class="pre">teardown_request()</span></tt></a> decorated function. This is
+not actually called by the <a class="reference internal" href="#flask.Flask" title="flask.Flask"><tt class="xref py py-class docutils literal"><span class="pre">Flask</span></tt></a> object itself but is always
+triggered when the request context is popped. That way we have a
+tighter control over certain resources under testing environments.</p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Flask.enable_modules">
+<tt class="descname">enable_modules</tt><em class="property"> = True</em><a class="headerlink" href="#flask.Flask.enable_modules" title="Permalink to this definition">¶</a></dt>
+<dd><p>Enable the deprecated module support? This is active by default
+in 0.7 but will be changed to False in 0.8. With Flask 1.0 modules
+will be removed in favor of Blueprints</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Flask.endpoint">
+<tt class="descname">endpoint</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#flask.Flask.endpoint" title="Permalink to this definition">¶</a></dt>
+<dd><p>A decorator to register a function as an endpoint.
+Example:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="nd">@app.endpoint</span><span class="p">(</span><span class="s">&#39;example.endpoint&#39;</span><span class="p">)</span>
+<span class="k">def</span> <span class="nf">example</span><span class="p">():</span>
+ <span class="k">return</span> <span class="s">&quot;example&quot;</span>
+</pre></div>
+</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>endpoint</strong> &#8211; the name of the endpoint</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Flask.error_handler_spec">
+<tt class="descname">error_handler_spec</tt><em class="property"> = None</em><a class="headerlink" href="#flask.Flask.error_handler_spec" title="Permalink to this definition">¶</a></dt>
+<dd><p>A dictionary of all registered error handlers. The key is <cite>None</cite>
+for error handlers active on the application, otherwise the key is
+the name of the blueprint. Each key points to another dictionary
+where they key is the status code of the http exception. The
+special key <cite>None</cite> points to a list of tuples where the first item
+is the class for the instance check and the second the error handler
+function.</p>
+<p>To register a error handler, use the <a class="reference internal" href="#flask.Flask.errorhandler" title="flask.Flask.errorhandler"><tt class="xref py py-meth docutils literal"><span class="pre">errorhandler()</span></tt></a>
+decorator.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Flask.errorhandler">
+<tt class="descname">errorhandler</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#flask.Flask.errorhandler" title="Permalink to this definition">¶</a></dt>
+<dd><p>A decorator that is used to register a function give a given
+error code. Example:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="nd">@app.errorhandler</span><span class="p">(</span><span class="mi">404</span><span class="p">)</span>
+<span class="k">def</span> <span class="nf">page_not_found</span><span class="p">(</span><span class="n">error</span><span class="p">):</span>
+ <span class="k">return</span> <span class="s">&#39;This page does not exist&#39;</span><span class="p">,</span> <span class="mi">404</span>
+</pre></div>
+</div>
+<p>You can also register handlers for arbitrary exceptions:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="nd">@app.errorhandler</span><span class="p">(</span><span class="n">DatabaseError</span><span class="p">)</span>
+<span class="k">def</span> <span class="nf">special_exception_handler</span><span class="p">(</span><span class="n">error</span><span class="p">):</span>
+ <span class="k">return</span> <span class="s">&#39;Database connection failed&#39;</span><span class="p">,</span> <span class="mi">500</span>
+</pre></div>
+</div>
+<p>You can also register a function as error handler without using
+the <a class="reference internal" href="#flask.Flask.errorhandler" title="flask.Flask.errorhandler"><tt class="xref py py-meth docutils literal"><span class="pre">errorhandler()</span></tt></a> decorator. The following example is
+equivalent to the one above:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">def</span> <span class="nf">page_not_found</span><span class="p">(</span><span class="n">error</span><span class="p">):</span>
+ <span class="k">return</span> <span class="s">&#39;This page does not exist&#39;</span><span class="p">,</span> <span class="mi">404</span>
+<span class="n">app</span><span class="o">.</span><span class="n">error_handler_spec</span><span class="p">[</span><span class="bp">None</span><span class="p">][</span><span class="mi">404</span><span class="p">]</span> <span class="o">=</span> <span class="n">page_not_found</span>
+</pre></div>
+</div>
+<p>Setting error handlers via assignments to <a class="reference internal" href="#flask.Flask.error_handler_spec" title="flask.Flask.error_handler_spec"><tt class="xref py py-attr docutils literal"><span class="pre">error_handler_spec</span></tt></a>
+however is discouraged as it requires fidling with nested dictionaries
+and the special case for arbitrary exception types.</p>
+<p>The first <cite>None</cite> refers to the active blueprint. If the error
+handler should be application wide <cite>None</cite> shall be used.</p>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.7: </span>One can now additionally also register custom exception types
+that do not necessarily have to be a subclass of the
+<tt class="xref py py-class docutils literal"><span class="pre">HTTPException</span></tt> class.</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>code</strong> &#8211; the code as integer for the handler</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Flask.extensions">
+<tt class="descname">extensions</tt><em class="property"> = None</em><a class="headerlink" href="#flask.Flask.extensions" title="Permalink to this definition">¶</a></dt>
+<dd><p>a place where extensions can store application specific state. For
+example this is where an extension could store database engines and
+similar things. For backwards compatibility extensions should register
+themselves like this:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">if</span> <span class="ow">not</span> <span class="nb">hasattr</span><span class="p">(</span><span class="n">app</span><span class="p">,</span> <span class="s">&#39;extensions&#39;</span><span class="p">):</span>
+ <span class="n">app</span><span class="o">.</span><span class="n">extensions</span> <span class="o">=</span> <span class="p">{}</span>
+<span class="n">app</span><span class="o">.</span><span class="n">extensions</span><span class="p">[</span><span class="s">&#39;extensionname&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">SomeObject</span><span class="p">()</span>
+</pre></div>
+</div>
+<p>The key must match the name of the <cite>flaskext</cite> module. For example in
+case of a &#8220;Flask-Foo&#8221; extension in <cite>flaskext.foo</cite>, the key would be
+<tt class="docutils literal"><span class="pre">'foo'</span></tt>.</p>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.7.</span></p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Flask.full_dispatch_request">
+<tt class="descname">full_dispatch_request</tt><big>(</big><big>)</big><a class="headerlink" href="#flask.Flask.full_dispatch_request" title="Permalink to this definition">¶</a></dt>
+<dd><p>Dispatches the request and on top of that performs request
+pre and postprocessing as well as HTTP exception catching and
+error handling.</p>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.7.</span></p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Flask.got_first_request">
+<tt class="descname">got_first_request</tt><a class="headerlink" href="#flask.Flask.got_first_request" title="Permalink to this definition">¶</a></dt>
+<dd><p>This attribute is set to <cite>True</cite> if the application started
+handling the first request.</p>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.8.</span></p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Flask.handle_exception">
+<tt class="descname">handle_exception</tt><big>(</big><em>e</em><big>)</big><a class="headerlink" href="#flask.Flask.handle_exception" title="Permalink to this definition">¶</a></dt>
+<dd><p>Default exception handling that kicks in when an exception
+occours that is not caught. In debug mode the exception will
+be re-raised immediately, otherwise it is logged and the handler
+for a 500 internal server error is used. If no such handler
+exists, a default 500 internal server error message is displayed.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Flask.handle_http_exception">
+<tt class="descname">handle_http_exception</tt><big>(</big><em>e</em><big>)</big><a class="headerlink" href="#flask.Flask.handle_http_exception" title="Permalink to this definition">¶</a></dt>
+<dd><p>Handles an HTTP exception. By default this will invoke the
+registered error handlers and fall back to returning the
+exception as response.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Flask.handle_user_exception">
+<tt class="descname">handle_user_exception</tt><big>(</big><em>e</em><big>)</big><a class="headerlink" href="#flask.Flask.handle_user_exception" title="Permalink to this definition">¶</a></dt>
+<dd><p>This method is called whenever an exception occurs that should be
+handled. A special case are
+<tt class="xref py py-class docutils literal"><span class="pre">HTTPException</span></tt>s which are forwarded by
+this function to the <a class="reference internal" href="#flask.Flask.handle_http_exception" title="flask.Flask.handle_http_exception"><tt class="xref py py-meth docutils literal"><span class="pre">handle_http_exception()</span></tt></a> method. This
+function will either return a response value or reraise the
+exception with the same traceback.</p>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.7.</span></p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Flask.has_static_folder">
+<tt class="descname">has_static_folder</tt><a class="headerlink" href="#flask.Flask.has_static_folder" title="Permalink to this definition">¶</a></dt>
+<dd><p>This is <cite>True</cite> if the package bound object&#8217;s container has a
+folder named <tt class="docutils literal"><span class="pre">'static'</span></tt>.</p>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.5.</span></p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Flask.init_jinja_globals">
+<tt class="descname">init_jinja_globals</tt><big>(</big><big>)</big><a class="headerlink" href="#flask.Flask.init_jinja_globals" title="Permalink to this definition">¶</a></dt>
+<dd><p>Deprecated. Used to initialize the Jinja2 globals.</p>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.5.</span></p>
+<p class="versionchanged">
+<span class="versionmodified">Changed in version 0.7: </span>This method is deprecated with 0.7. Override
+<a class="reference internal" href="#flask.Flask.create_jinja_environment" title="flask.Flask.create_jinja_environment"><tt class="xref py py-meth docutils literal"><span class="pre">create_jinja_environment()</span></tt></a> instead.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Flask.inject_url_defaults">
+<tt class="descname">inject_url_defaults</tt><big>(</big><em>endpoint</em>, <em>values</em><big>)</big><a class="headerlink" href="#flask.Flask.inject_url_defaults" title="Permalink to this definition">¶</a></dt>
+<dd><p>Injects the URL defaults for the given endpoint directly into
+the values dictionary passed. This is used internally and
+automatically called on URL building.</p>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.7.</span></p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Flask.instance_path">
+<tt class="descname">instance_path</tt><em class="property"> = None</em><a class="headerlink" href="#flask.Flask.instance_path" title="Permalink to this definition">¶</a></dt>
+<dd><p>Holds the path to the instance folder.</p>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.8.</span></p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Flask.jinja_env">
+<tt class="descname">jinja_env</tt><a class="headerlink" href="#flask.Flask.jinja_env" title="Permalink to this definition">¶</a></dt>
+<dd><p>The Jinja2 environment used to load templates.</p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Flask.jinja_loader">
+<tt class="descname">jinja_loader</tt><a class="headerlink" href="#flask.Flask.jinja_loader" title="Permalink to this definition">¶</a></dt>
+<dd><p>The Jinja loader for this package bound object.</p>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.5.</span></p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Flask.jinja_options">
+<tt class="descname">jinja_options</tt><em class="property"> = ImmutableDict({'extensions': ['jinja2.ext.autoescape', 'jinja2.ext.with_']})</em><a class="headerlink" href="#flask.Flask.jinja_options" title="Permalink to this definition">¶</a></dt>
+<dd><p>Options that are passed directly to the Jinja2 environment.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Flask.log_exception">
+<tt class="descname">log_exception</tt><big>(</big><em>exc_info</em><big>)</big><a class="headerlink" href="#flask.Flask.log_exception" title="Permalink to this definition">¶</a></dt>
+<dd><p>Logs an exception. This is called by <a class="reference internal" href="#flask.Flask.handle_exception" title="flask.Flask.handle_exception"><tt class="xref py py-meth docutils literal"><span class="pre">handle_exception()</span></tt></a>
+if debugging is disabled and right before the handler is called.
+The default implementation logs the exception as error on the
+<a class="reference internal" href="#flask.Flask.logger" title="flask.Flask.logger"><tt class="xref py py-attr docutils literal"><span class="pre">logger</span></tt></a>.</p>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.8.</span></p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Flask.logger">
+<tt class="descname">logger</tt><a class="headerlink" href="#flask.Flask.logger" title="Permalink to this definition">¶</a></dt>
+<dd><p>A <a class="reference external" href="http://docs.python.org/dev/library/logging.html#logging.Logger" title="(in Python v3.3)"><tt class="xref py py-class docutils literal"><span class="pre">logging.Logger</span></tt></a> object for this application. The
+default configuration is to log to stderr if the application is
+in debug mode. This logger can be used to (surprise) log messages.
+Here some examples:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="n">app</span><span class="o">.</span><span class="n">logger</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s">&#39;A value for debugging&#39;</span><span class="p">)</span>
+<span class="n">app</span><span class="o">.</span><span class="n">logger</span><span class="o">.</span><span class="n">warning</span><span class="p">(</span><span class="s">&#39;A warning ocurred (</span><span class="si">%d</span><span class="s"> apples)&#39;</span><span class="p">,</span> <span class="mi">42</span><span class="p">)</span>
+<span class="n">app</span><span class="o">.</span><span class="n">logger</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s">&#39;An error occoured&#39;</span><span class="p">)</span>
+</pre></div>
+</div>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.3.</span></p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Flask.logger_name">
+<tt class="descname">logger_name</tt><a class="headerlink" href="#flask.Flask.logger_name" title="Permalink to this definition">¶</a></dt>
+<dd><p>The name of the logger to use. By default the logger name is the
+package name passed to the constructor.</p>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.4.</span></p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Flask.make_config">
+<tt class="descname">make_config</tt><big>(</big><em>instance_relative=False</em><big>)</big><a class="headerlink" href="#flask.Flask.make_config" title="Permalink to this definition">¶</a></dt>
+<dd><p>Used to create the config attribute by the Flask constructor.
+The <cite>instance_relative</cite> parameter is passed in from the constructor
+of Flask (there named <cite>instance_relative_config</cite>) and indicates if
+the config should be relative to the instance path or the root path
+of the application.</p>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.8.</span></p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Flask.make_default_options_response">
+<tt class="descname">make_default_options_response</tt><big>(</big><big>)</big><a class="headerlink" href="#flask.Flask.make_default_options_response" title="Permalink to this definition">¶</a></dt>
+<dd><p>This method is called to create the default <cite>OPTIONS</cite> response.
+This can be changed through subclassing to change the default
+behaviour of <cite>OPTIONS</cite> responses.</p>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.7.</span></p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Flask.make_null_session">
+<tt class="descname">make_null_session</tt><big>(</big><big>)</big><a class="headerlink" href="#flask.Flask.make_null_session" title="Permalink to this definition">¶</a></dt>
+<dd><p>Creates a new instance of a missing session. Instead of overriding
+this method we recommend replacing the <a class="reference internal" href="#flask.Flask.session_interface" title="flask.Flask.session_interface"><tt class="xref py py-class docutils literal"><span class="pre">session_interface</span></tt></a>.</p>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.7.</span></p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Flask.make_response">
+<tt class="descname">make_response</tt><big>(</big><em>rv</em><big>)</big><a class="headerlink" href="#flask.Flask.make_response" title="Permalink to this definition">¶</a></dt>
+<dd><p>Converts the return value from a view function to a real
+response object that is an instance of <a class="reference internal" href="#flask.Flask.response_class" title="flask.Flask.response_class"><tt class="xref py py-attr docutils literal"><span class="pre">response_class</span></tt></a>.</p>
+<p>The following types are allowed for <cite>rv</cite>:</p>
+<table border="1" class="docutils">
+<colgroup>
+<col width="35%" />
+<col width="65%" />
+</colgroup>
+<tbody valign="top">
+<tr class="row-odd"><td><a class="reference internal" href="#flask.Flask.response_class" title="flask.Flask.response_class"><tt class="xref py py-attr docutils literal"><span class="pre">response_class</span></tt></a></td>
+<td>the object is returned unchanged</td>
+</tr>
+<tr class="row-even"><td><tt class="xref py py-class docutils literal"><span class="pre">str</span></tt></td>
+<td>a response object is created with the
+string as body</td>
+</tr>
+<tr class="row-odd"><td><tt class="xref py py-class docutils literal"><span class="pre">unicode</span></tt></td>
+<td>a response object is created with the
+string encoded to utf-8 as body</td>
+</tr>
+<tr class="row-even"><td><tt class="xref py py-class docutils literal"><span class="pre">tuple</span></tt></td>
+<td>the response object is created with the
+contents of the tuple as arguments</td>
+</tr>
+<tr class="row-odd"><td>a WSGI function</td>
+<td>the function is called as WSGI application
+and buffered as response object</td>
+</tr>
+</tbody>
+</table>
+<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>rv</strong> &#8211; the return value from the view function</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Flask.name">
+<tt class="descname">name</tt><a class="headerlink" href="#flask.Flask.name" title="Permalink to this definition">¶</a></dt>
+<dd><p>The name of the application. This is usually the import name
+with the difference that it&#8217;s guessed from the run file if the
+import name is main. This name is used as a display name when
+Flask needs the name of the application. It can be set and overriden
+to change the value.</p>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.8.</span></p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Flask.open_instance_resource">
+<tt class="descname">open_instance_resource</tt><big>(</big><em>resource</em>, <em>mode='rb'</em><big>)</big><a class="headerlink" href="#flask.Flask.open_instance_resource" title="Permalink to this definition">¶</a></dt>
+<dd><p>Opens a resource from the application&#8217;s instance folder
+(<a class="reference internal" href="#flask.Flask.instance_path" title="flask.Flask.instance_path"><tt class="xref py py-attr docutils literal"><span class="pre">instance_path</span></tt></a>). Otherwise works like
+<a class="reference internal" href="#flask.Flask.open_resource" title="flask.Flask.open_resource"><tt class="xref py py-meth docutils literal"><span class="pre">open_resource()</span></tt></a>. Instance resources can also be opened for
+writing.</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>resource</strong> &#8211; the name of the resource. To access resources within
+subfolders use forward slashes as separator.</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Flask.open_resource">
+<tt class="descname">open_resource</tt><big>(</big><em>resource</em>, <em>mode='rb'</em><big>)</big><a class="headerlink" href="#flask.Flask.open_resource" title="Permalink to this definition">¶</a></dt>
+<dd><p>Opens a resource from the application&#8217;s resource folder. To see
+how this works, consider the following folder structure:</p>
+<div class="highlight-python"><pre>/myapplication.py
+/schema.sql
+/static
+ /style.css
+/templates
+ /layout.html
+ /index.html</pre>
+</div>
+<p>If you want to open the <cite>schema.sql</cite> file you would do the
+following:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">with</span> <span class="n">app</span><span class="o">.</span><span class="n">open_resource</span><span class="p">(</span><span class="s">&#39;schema.sql&#39;</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
+ <span class="n">contents</span> <span class="o">=</span> <span class="n">f</span><span class="o">.</span><span class="n">read</span><span class="p">()</span>
+ <span class="n">do_something_with</span><span class="p">(</span><span class="n">contents</span><span class="p">)</span>
+</pre></div>
+</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>resource</strong> &#8211; the name of the resource. To access resources within
+subfolders use forward slashes as separator.</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Flask.open_session">
+<tt class="descname">open_session</tt><big>(</big><em>request</em><big>)</big><a class="headerlink" href="#flask.Flask.open_session" title="Permalink to this definition">¶</a></dt>
+<dd><p>Creates or opens a new session. Default implementation stores all
+session data in a signed cookie. This requires that the
+<a class="reference internal" href="#flask.Flask.secret_key" title="flask.Flask.secret_key"><tt class="xref py py-attr docutils literal"><span class="pre">secret_key</span></tt></a> is set. Instead of overriding this method
+we recommend replacing the <a class="reference internal" href="#flask.Flask.session_interface" title="flask.Flask.session_interface"><tt class="xref py py-class docutils literal"><span class="pre">session_interface</span></tt></a>.</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>request</strong> &#8211; an instance of <a class="reference internal" href="#flask.Flask.request_class" title="flask.Flask.request_class"><tt class="xref py py-attr docutils literal"><span class="pre">request_class</span></tt></a>.</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Flask.permanent_session_lifetime">
+<tt class="descname">permanent_session_lifetime</tt><a class="headerlink" href="#flask.Flask.permanent_session_lifetime" title="Permalink to this definition">¶</a></dt>
+<dd><p>A <a class="reference external" href="http://docs.python.org/dev/library/datetime.html#datetime.timedelta" title="(in Python v3.3)"><tt class="xref py py-class docutils literal"><span class="pre">timedelta</span></tt></a> which is used to set the expiration
+date of a permanent session. The default is 31 days which makes a
+permanent session survive for roughly one month.</p>
+<p>This attribute can also be configured from the config with the
+<cite>PERMANENT_SESSION_LIFETIME</cite> configuration key. Defaults to
+<tt class="docutils literal"><span class="pre">timedelta(days=31)</span></tt></p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Flask.preprocess_request">
+<tt class="descname">preprocess_request</tt><big>(</big><big>)</big><a class="headerlink" href="#flask.Flask.preprocess_request" title="Permalink to this definition">¶</a></dt>
+<dd><p>Called before the actual request dispatching and will
+call every as <a class="reference internal" href="#flask.Flask.before_request" title="flask.Flask.before_request"><tt class="xref py py-meth docutils literal"><span class="pre">before_request()</span></tt></a> decorated function.
+If any of these function returns a value it&#8217;s handled as
+if it was the return value from the view and further
+request handling is stopped.</p>
+<p>This also triggers the <tt class="xref py py-meth docutils literal"><span class="pre">url_value_processor()</span></tt> functions before
+the actualy <a class="reference internal" href="#flask.Flask.before_request" title="flask.Flask.before_request"><tt class="xref py py-meth docutils literal"><span class="pre">before_request()</span></tt></a> functions are called.</p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Flask.preserve_context_on_exception">
+<tt class="descname">preserve_context_on_exception</tt><a class="headerlink" href="#flask.Flask.preserve_context_on_exception" title="Permalink to this definition">¶</a></dt>
+<dd><p>Returns the value of the <cite>PRESERVE_CONTEXT_ON_EXCEPTION</cite>
+configuration value in case it&#8217;s set, otherwise a sensible default
+is returned.</p>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.7.</span></p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Flask.process_response">
+<tt class="descname">process_response</tt><big>(</big><em>response</em><big>)</big><a class="headerlink" href="#flask.Flask.process_response" title="Permalink to this definition">¶</a></dt>
+<dd><p>Can be overridden in order to modify the response object
+before it&#8217;s sent to the WSGI server. By default this will
+call all the <a class="reference internal" href="#flask.Flask.after_request" title="flask.Flask.after_request"><tt class="xref py py-meth docutils literal"><span class="pre">after_request()</span></tt></a> decorated functions.</p>
+<p class="versionchanged">
+<span class="versionmodified">Changed in version 0.5: </span>As of Flask 0.5 the functions registered for after request
+execution are called in reverse order of registration.</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>response</strong> &#8211; a <a class="reference internal" href="#flask.Flask.response_class" title="flask.Flask.response_class"><tt class="xref py py-attr docutils literal"><span class="pre">response_class</span></tt></a> object.</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">a new response object or the same, has to be an
+instance of <a class="reference internal" href="#flask.Flask.response_class" title="flask.Flask.response_class"><tt class="xref py py-attr docutils literal"><span class="pre">response_class</span></tt></a>.</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Flask.propagate_exceptions">
+<tt class="descname">propagate_exceptions</tt><a class="headerlink" href="#flask.Flask.propagate_exceptions" title="Permalink to this definition">¶</a></dt>
+<dd><p>Returns the value of the <cite>PROPAGATE_EXCEPTIONS</cite> configuration
+value in case it&#8217;s set, otherwise a sensible default is returned.</p>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.7.</span></p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Flask.register_blueprint">
+<tt class="descname">register_blueprint</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#flask.Flask.register_blueprint" title="Permalink to this definition">¶</a></dt>
+<dd><p>Registers a blueprint on the application.</p>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.7.</span></p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Flask.register_error_handler">
+<tt class="descname">register_error_handler</tt><big>(</big><em>code_or_exception</em>, <em>f</em><big>)</big><a class="headerlink" href="#flask.Flask.register_error_handler" title="Permalink to this definition">¶</a></dt>
+<dd><p>Alternative error attach function to the <a class="reference internal" href="#flask.Flask.errorhandler" title="flask.Flask.errorhandler"><tt class="xref py py-meth docutils literal"><span class="pre">errorhandler()</span></tt></a>
+decorator that is more straightforward to use for non decorator
+usage.</p>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.7.</span></p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Flask.register_module">
+<tt class="descname">register_module</tt><big>(</big><em>module</em>, <em>**options</em><big>)</big><a class="headerlink" href="#flask.Flask.register_module" title="Permalink to this definition">¶</a></dt>
+<dd><p>Registers a module with this application. The keyword argument
+of this function are the same as the ones for the constructor of the
+<tt class="xref py py-class docutils literal"><span class="pre">Module</span></tt> class and will override the values of the module if
+provided.</p>
+<p class="versionchanged">
+<span class="versionmodified">Changed in version 0.7: </span>The module system was deprecated in favor for the blueprint
+system.</p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Flask.request_class">
+<tt class="descname">request_class</tt><a class="headerlink" href="#flask.Flask.request_class" title="Permalink to this definition">¶</a></dt>
+<dd><p>The class that is used for request objects. See <a class="reference internal" href="#flask.Request" title="flask.Request"><tt class="xref py py-class docutils literal"><span class="pre">Request</span></tt></a>
+for more information.</p>
+<p>alias of <a class="reference internal" href="#flask.Request" title="flask.Request"><tt class="xref py py-class docutils literal"><span class="pre">Request</span></tt></a></p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Flask.request_context">
+<tt class="descname">request_context</tt><big>(</big><em>environ</em><big>)</big><a class="headerlink" href="#flask.Flask.request_context" title="Permalink to this definition">¶</a></dt>
+<dd><p>Creates a <a class="reference internal" href="#flask.ctx.RequestContext" title="flask.ctx.RequestContext"><tt class="xref py py-class docutils literal"><span class="pre">RequestContext</span></tt></a> from the given
+environment and binds it to the current context. This must be used in
+combination with the <cite>with</cite> statement because the request is only bound
+to the current context for the duration of the <cite>with</cite> block.</p>
+<p>Example usage:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">with</span> <span class="n">app</span><span class="o">.</span><span class="n">request_context</span><span class="p">(</span><span class="n">environ</span><span class="p">):</span>
+ <span class="n">do_something_with</span><span class="p">(</span><span class="n">request</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>The object returned can also be used without the <cite>with</cite> statement
+which is useful for working in the shell. The example above is
+doing exactly the same as this code:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="n">ctx</span> <span class="o">=</span> <span class="n">app</span><span class="o">.</span><span class="n">request_context</span><span class="p">(</span><span class="n">environ</span><span class="p">)</span>
+<span class="n">ctx</span><span class="o">.</span><span class="n">push</span><span class="p">()</span>
+<span class="k">try</span><span class="p">:</span>
+ <span class="n">do_something_with</span><span class="p">(</span><span class="n">request</span><span class="p">)</span>
+<span class="k">finally</span><span class="p">:</span>
+ <span class="n">ctx</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span>
+</pre></div>
+</div>
+<p class="versionchanged">
+<span class="versionmodified">Changed in version 0.3: </span>Added support for non-with statement usage and <cite>with</cite> statement
+is now passed the ctx object.</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>environ</strong> &#8211; a WSGI environment</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Flask.response_class">
+<tt class="descname">response_class</tt><a class="headerlink" href="#flask.Flask.response_class" title="Permalink to this definition">¶</a></dt>
+<dd><p>The class that is used for response objects. See
+<a class="reference internal" href="#flask.Response" title="flask.Response"><tt class="xref py py-class docutils literal"><span class="pre">Response</span></tt></a> for more information.</p>
+<p>alias of <a class="reference internal" href="#flask.Response" title="flask.Response"><tt class="xref py py-class docutils literal"><span class="pre">Response</span></tt></a></p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Flask.route">
+<tt class="descname">route</tt><big>(</big><em>rule</em>, <em>**options</em><big>)</big><a class="headerlink" href="#flask.Flask.route" title="Permalink to this definition">¶</a></dt>
+<dd><p>A decorator that is used to register a view function for a
+given URL rule. This does the same thing as <a class="reference internal" href="#flask.Flask.add_url_rule" title="flask.Flask.add_url_rule"><tt class="xref py py-meth docutils literal"><span class="pre">add_url_rule()</span></tt></a>
+but is intended for decorator usage:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/&#39;</span><span class="p">)</span>
+<span class="k">def</span> <span class="nf">index</span><span class="p">():</span>
+ <span class="k">return</span> <span class="s">&#39;Hello World&#39;</span>
+</pre></div>
+</div>
+<p>For more information refer to <a class="reference internal" href="#url-route-registrations"><em>URL Route Registrations</em></a>.</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>rule</strong> &#8211; the URL rule as string</li>
+<li><strong>endpoint</strong> &#8211; the endpoint for the registered URL rule. Flask
+itself assumes the name of the view function as
+endpoint</li>
+<li><strong>view_func</strong> &#8211; the function to call when serving a request to the
+provided endpoint</li>
+<li><strong>options</strong> &#8211; the options to be forwarded to the underlying
+<a class="reference external" href="http://werkzeug.pocoo.org/docs/routing/#werkzeug.routing.Rule" title="(in Werkzeug v0.7)"><tt class="xref py py-class docutils literal"><span class="pre">Rule</span></tt></a> object. A change
+to Werkzeug is handling of method options. methods
+is a list of methods this rule should be limited
+to (<cite>GET</cite>, <cite>POST</cite> etc.). By default a rule
+just listens for <cite>GET</cite> (and implicitly <cite>HEAD</cite>).
+Starting with Flask 0.6, <cite>OPTIONS</cite> is implicitly
+added and handled by the standard request handling.</li>
+</ul>
+</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Flask.run">
+<tt class="descname">run</tt><big>(</big><em>host='127.0.0.1'</em>, <em>port=5000</em>, <em>debug=None</em>, <em>**options</em><big>)</big><a class="headerlink" href="#flask.Flask.run" title="Permalink to this definition">¶</a></dt>
+<dd><p>Runs the application on a local development server. If the
+<a class="reference internal" href="#flask.Flask.debug" title="flask.Flask.debug"><tt class="xref py py-attr docutils literal"><span class="pre">debug</span></tt></a> flag is set the server will automatically reload
+for code changes and show a debugger in case an exception happened.</p>
+<p>If you want to run the application in debug mode, but disable the
+code execution on the interactive debugger, you can pass
+<tt class="docutils literal"><span class="pre">use_evalex=False</span></tt> as parameter. This will keep the debugger&#8217;s
+traceback screen active, but disable code execution.</p>
+<div class="admonition-keep-in-mind admonition ">
+<p class="first admonition-title">Keep in Mind</p>
+<p class="last">Flask will suppress any server error with a generic error page
+unless it is in debug mode. As such to enable just the
+interactive debugger without the code reloading, you have to
+invoke <a class="reference internal" href="#flask.Flask.run" title="flask.Flask.run"><tt class="xref py py-meth docutils literal"><span class="pre">run()</span></tt></a> with <tt class="docutils literal"><span class="pre">debug=True</span></tt> and <tt class="docutils literal"><span class="pre">use_reloader=False</span></tt>.
+Setting <tt class="docutils literal"><span class="pre">use_debugger</span></tt> to <cite>True</cite> without being in debug mode
+won&#8217;t catch any exceptions because there won&#8217;t be any to
+catch.</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"><ul class="first last simple">
+<li><strong>host</strong> &#8211; the hostname to listen on. set this to <tt class="docutils literal"><span class="pre">'0.0.0.0'</span></tt>
+to have the server available externally as well.</li>
+<li><strong>port</strong> &#8211; the port of the webserver</li>
+<li><strong>debug</strong> &#8211; if given, enable or disable debug mode.
+See <a class="reference internal" href="#flask.Flask.debug" title="flask.Flask.debug"><tt class="xref py py-attr docutils literal"><span class="pre">debug</span></tt></a>.</li>
+<li><strong>options</strong> &#8211; the options to be forwarded to the underlying
+Werkzeug server. See
+<a class="reference external" href="http://werkzeug.pocoo.org/docs/serving/#werkzeug.serving.run_simple" title="(in Werkzeug v0.7)"><tt class="xref py py-func docutils literal"><span class="pre">werkzeug.serving.run_simple()</span></tt></a> for more
+information.</li>
+</ul>
+</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Flask.save_session">
+<tt class="descname">save_session</tt><big>(</big><em>session</em>, <em>response</em><big>)</big><a class="headerlink" href="#flask.Flask.save_session" title="Permalink to this definition">¶</a></dt>
+<dd><p>Saves the session if it needs updates. For the default
+implementation, check <a class="reference internal" href="#flask.Flask.open_session" title="flask.Flask.open_session"><tt class="xref py py-meth docutils literal"><span class="pre">open_session()</span></tt></a>. Instead of overriding this
+method we recommend replacing the <a class="reference internal" href="#flask.Flask.session_interface" title="flask.Flask.session_interface"><tt class="xref py py-class docutils literal"><span class="pre">session_interface</span></tt></a>.</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>session</strong> &#8211; the session to be saved (a
+<a class="reference external" href="http://werkzeug.pocoo.org/docs/contrib/securecookie/#werkzeug.contrib.securecookie.SecureCookie" title="(in Werkzeug v0.7)"><tt class="xref py py-class docutils literal"><span class="pre">SecureCookie</span></tt></a>
+object)</li>
+<li><strong>response</strong> &#8211; an instance of <a class="reference internal" href="#flask.Flask.response_class" title="flask.Flask.response_class"><tt class="xref py py-attr docutils literal"><span class="pre">response_class</span></tt></a></li>
+</ul>
+</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Flask.secret_key">
+<tt class="descname">secret_key</tt><a class="headerlink" href="#flask.Flask.secret_key" title="Permalink to this definition">¶</a></dt>
+<dd><p>If a secret key is set, cryptographic components can use this to
+sign cookies and other things. Set this to a complex random value
+when you want to use the secure cookie for instance.</p>
+<p>This attribute can also be configured from the config with the
+<cite>SECRET_KEY</cite> configuration key. Defaults to <cite>None</cite>.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Flask.select_jinja_autoescape">
+<tt class="descname">select_jinja_autoescape</tt><big>(</big><em>filename</em><big>)</big><a class="headerlink" href="#flask.Flask.select_jinja_autoescape" title="Permalink to this definition">¶</a></dt>
+<dd><p>Returns <cite>True</cite> if autoescaping should be active for the given
+template name.</p>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.5.</span></p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Flask.send_static_file">
+<tt class="descname">send_static_file</tt><big>(</big><em>filename</em><big>)</big><a class="headerlink" href="#flask.Flask.send_static_file" title="Permalink to this definition">¶</a></dt>
+<dd><p>Function used internally to send static files from the static
+folder to the browser.</p>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.5.</span></p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Flask.session_cookie_name">
+<tt class="descname">session_cookie_name</tt><a class="headerlink" href="#flask.Flask.session_cookie_name" title="Permalink to this definition">¶</a></dt>
+<dd><p>The secure cookie uses this for the name of the session cookie.</p>
+<p>This attribute can also be configured from the config with the
+<cite>SESSION_COOKIE_NAME</cite> configuration key. Defaults to <tt class="docutils literal"><span class="pre">'session'</span></tt></p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Flask.session_interface">
+<tt class="descname">session_interface</tt><em class="property"> = &lt;flask.sessions.SecureCookieSessionInterface object at 0x103dc8090&gt;</em><a class="headerlink" href="#flask.Flask.session_interface" title="Permalink to this definition">¶</a></dt>
+<dd><p>the session interface to use. By default an instance of
+<a class="reference internal" href="#flask.sessions.SecureCookieSessionInterface" title="flask.sessions.SecureCookieSessionInterface"><tt class="xref py py-class docutils literal"><span class="pre">SecureCookieSessionInterface</span></tt></a> is used here.</p>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.8.</span></p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Flask.teardown_request">
+<tt class="descname">teardown_request</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#flask.Flask.teardown_request" title="Permalink to this definition">¶</a></dt>
+<dd><p>Register a function to be run at the end of each request,
+regardless of whether there was an exception or not. These functions
+are executed when the request context is popped, even if not an
+actual request was performed.</p>
+<p>Example:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="n">ctx</span> <span class="o">=</span> <span class="n">app</span><span class="o">.</span><span class="n">test_request_context</span><span class="p">()</span>
+<span class="n">ctx</span><span class="o">.</span><span class="n">push</span><span class="p">()</span>
+<span class="o">...</span>
+<span class="n">ctx</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span>
+</pre></div>
+</div>
+<p>When <tt class="docutils literal"><span class="pre">ctx.pop()</span></tt> is executed in the above example, the teardown
+functions are called just before the request context moves from the
+stack of active contexts. This becomes relevant if you are using
+such constructs in tests.</p>
+<p>Generally teardown functions must take every necesary step to avoid
+that they will fail. If they do execute code that might fail they
+will have to surround the execution of these code by try/except
+statements and log ocurring errors.</p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Flask.teardown_request_funcs">
+<tt class="descname">teardown_request_funcs</tt><em class="property"> = None</em><a class="headerlink" href="#flask.Flask.teardown_request_funcs" title="Permalink to this definition">¶</a></dt>
+<dd><p>A dictionary with lists of functions that are called after
+each request, even if an exception has occurred. The key of the
+dictionary is the name of the blueprint this function is active for,
+<cite>None</cite> for all requests. These functions are not allowed to modify
+the request, and their return values are ignored. If an exception
+occurred while processing the request, it gets passed to each
+teardown_request function. To register a function here, use the
+<a class="reference internal" href="#flask.Flask.teardown_request" title="flask.Flask.teardown_request"><tt class="xref py py-meth docutils literal"><span class="pre">teardown_request()</span></tt></a> decorator.</p>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.7.</span></p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Flask.template_context_processors">
+<tt class="descname">template_context_processors</tt><em class="property"> = None</em><a class="headerlink" href="#flask.Flask.template_context_processors" title="Permalink to this definition">¶</a></dt>
+<dd><p>A dictionary with list of functions that are called without argument
+to populate the template context. The key of the dictionary is the
+name of the blueprint this function is active for, <cite>None</cite> for all
+requests. Each returns a dictionary that the template context is
+updated with. To register a function here, use the
+<a class="reference internal" href="#flask.Flask.context_processor" title="flask.Flask.context_processor"><tt class="xref py py-meth docutils literal"><span class="pre">context_processor()</span></tt></a> decorator.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Flask.template_filter">
+<tt class="descname">template_filter</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#flask.Flask.template_filter" title="Permalink to this definition">¶</a></dt>
+<dd><p>A decorator that is used to register custom template filter.
+You can specify a name for the filter, otherwise the function
+name will be used. Example:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="nd">@app.template_filter</span><span class="p">()</span>
+<span class="k">def</span> <span class="nf">reverse</span><span class="p">(</span><span class="n">s</span><span class="p">):</span>
+ <span class="k">return</span> <span class="n">s</span><span class="p">[::</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span>
+</pre></div>
+</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>name</strong> &#8211; the optional name of the filter, otherwise the
+function name will be used.</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Flask.test_client">
+<tt class="descname">test_client</tt><big>(</big><em>use_cookies=True</em><big>)</big><a class="headerlink" href="#flask.Flask.test_client" title="Permalink to this definition">¶</a></dt>
+<dd><p>Creates a test client for this application. For information
+about unit testing head over to <a class="reference internal" href="testing.html#testing"><em>Testing Flask Applications</em></a>.</p>
+<p>The test client can be used in a <cite>with</cite> block to defer the closing down
+of the context until the end of the <cite>with</cite> block. This is useful if
+you want to access the context locals for testing:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">with</span> <span class="n">app</span><span class="o">.</span><span class="n">test_client</span><span class="p">()</span> <span class="k">as</span> <span class="n">c</span><span class="p">:</span>
+ <span class="n">rv</span> <span class="o">=</span> <span class="n">c</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;/?vodka=42&#39;</span><span class="p">)</span>
+ <span class="k">assert</span> <span class="n">request</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s">&#39;vodka&#39;</span><span class="p">]</span> <span class="o">==</span> <span class="s">&#39;42&#39;</span>
+</pre></div>
+</div>
+<p>See <a class="reference internal" href="#flask.testing.FlaskClient" title="flask.testing.FlaskClient"><tt class="xref py py-class docutils literal"><span class="pre">FlaskClient</span></tt></a> for more information.</p>
+<p class="versionchanged">
+<span class="versionmodified">Changed in version 0.4: </span>added support for <cite>with</cite> block usage for the client.</p>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.7: </span>The <cite>use_cookies</cite> parameter was added as well as the ability
+to override the client to be used by setting the
+<a class="reference internal" href="#flask.Flask.test_client_class" title="flask.Flask.test_client_class"><tt class="xref py py-attr docutils literal"><span class="pre">test_client_class</span></tt></a> attribute.</p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Flask.test_client_class">
+<tt class="descname">test_client_class</tt><em class="property"> = None</em><a class="headerlink" href="#flask.Flask.test_client_class" title="Permalink to this definition">¶</a></dt>
+<dd><p>the test client that is used with when <cite>test_client</cite> is used.</p>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.7.</span></p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Flask.test_request_context">
+<tt class="descname">test_request_context</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#flask.Flask.test_request_context" title="Permalink to this definition">¶</a></dt>
+<dd><p>Creates a WSGI environment from the given values (see
+<tt class="xref py py-func docutils literal"><span class="pre">werkzeug.test.EnvironBuilder()</span></tt> for more information, this
+function accepts the same arguments).</p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Flask.testing">
+<tt class="descname">testing</tt><a class="headerlink" href="#flask.Flask.testing" title="Permalink to this definition">¶</a></dt>
+<dd><p>The testing flag. Set this to <cite>True</cite> to enable the test mode of
+Flask extensions (and in the future probably also Flask itself).
+For example this might activate unittest helpers that have an
+additional runtime cost which should not be enabled by default.</p>
+<p>If this is enabled and PROPAGATE_EXCEPTIONS is not changed from the
+default it&#8217;s implicitly enabled.</p>
+<p>This attribute can also be configured from the config with the
+<cite>TESTING</cite> configuration key. Defaults to <cite>False</cite>.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Flask.trap_http_exception">
+<tt class="descname">trap_http_exception</tt><big>(</big><em>e</em><big>)</big><a class="headerlink" href="#flask.Flask.trap_http_exception" title="Permalink to this definition">¶</a></dt>
+<dd><p>Checks if an HTTP exception should be trapped or not. By default
+this will return <cite>False</cite> for all exceptions except for a bad request
+key error if <tt class="docutils literal"><span class="pre">TRAP_BAD_REQUEST_ERRORS</span></tt> is set to <cite>True</cite>. It
+also returns <cite>True</cite> if <tt class="docutils literal"><span class="pre">TRAP_HTTP_EXCEPTIONS</span></tt> is set to <cite>True</cite>.</p>
+<p>This is called for all HTTP exceptions raised by a view function.
+If it returns <cite>True</cite> for any exception the error handler for this
+exception is not called and it shows up as regular exception in the
+traceback. This is helpful for debugging implicitly raised HTTP
+exceptions.</p>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.8.</span></p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Flask.update_template_context">
+<tt class="descname">update_template_context</tt><big>(</big><em>context</em><big>)</big><a class="headerlink" href="#flask.Flask.update_template_context" title="Permalink to this definition">¶</a></dt>
+<dd><p>Update the template context with some commonly used variables.
+This injects request, session, config and g into the template
+context as well as everything template context processors want
+to inject. Note that the as of Flask 0.6, the original values
+in the context will not be overriden if a context processor
+decides to return a value with the same key.</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>context</strong> &#8211; the context as a dictionary that is updated in place
+to add extra variables.</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Flask.url_default_functions">
+<tt class="descname">url_default_functions</tt><em class="property"> = None</em><a class="headerlink" href="#flask.Flask.url_default_functions" title="Permalink to this definition">¶</a></dt>
+<dd><p>A dictionary with lists of functions that can be used as URL value
+preprocessors. The key <cite>None</cite> here is used for application wide
+callbacks, otherwise the key is the name of the blueprint.
+Each of these functions has the chance to modify the dictionary
+of URL values before they are used as the keyword arguments of the
+view function. For each function registered this one should also
+provide a <a class="reference internal" href="#flask.Flask.url_defaults" title="flask.Flask.url_defaults"><tt class="xref py py-meth docutils literal"><span class="pre">url_defaults()</span></tt></a> function that adds the parameters
+automatically again that were removed that way.</p>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.7.</span></p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Flask.url_defaults">
+<tt class="descname">url_defaults</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#flask.Flask.url_defaults" title="Permalink to this definition">¶</a></dt>
+<dd><p>Callback function for URL defaults for all view functions of the
+application. It&#8217;s called with the endpoint and values and should
+update the values passed in place.</p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Flask.url_map">
+<tt class="descname">url_map</tt><em class="property"> = None</em><a class="headerlink" href="#flask.Flask.url_map" title="Permalink to this definition">¶</a></dt>
+<dd><p>The <a class="reference external" href="http://werkzeug.pocoo.org/docs/routing/#werkzeug.routing.Map" title="(in Werkzeug v0.7)"><tt class="xref py py-class docutils literal"><span class="pre">Map</span></tt></a> for this instance. You can use
+this to change the routing converters after the class was created
+but before any routes are connected. Example:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">werkzeug.routing</span> <span class="kn">import</span> <span class="n">BaseConverter</span>
+
+<span class="k">class</span> <span class="nc">ListConverter</span><span class="p">(</span><span class="n">BaseConverter</span><span class="p">):</span>
+ <span class="k">def</span> <span class="nf">to_python</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">value</span><span class="p">):</span>
+ <span class="k">return</span> <span class="n">value</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;,&#39;</span><span class="p">)</span>
+ <span class="k">def</span> <span class="nf">to_url</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">values</span><span class="p">):</span>
+ <span class="k">return</span> <span class="s">&#39;,&#39;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">BaseConverter</span><span class="o">.</span><span class="n">to_url</span><span class="p">(</span><span class="n">value</span><span class="p">)</span>
+ <span class="k">for</span> <span class="n">value</span> <span class="ow">in</span> <span class="n">values</span><span class="p">)</span>
+
+<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">app</span><span class="o">.</span><span class="n">url_map</span><span class="o">.</span><span class="n">converters</span><span class="p">[</span><span class="s">&#39;list&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">ListConverter</span>
+</pre></div>
+</div>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Flask.url_rule_class">
+<tt class="descname">url_rule_class</tt><a class="headerlink" href="#flask.Flask.url_rule_class" title="Permalink to this definition">¶</a></dt>
+<dd><p>The rule object to use for URL rules created. This is used by
+<a class="reference internal" href="#flask.Flask.add_url_rule" title="flask.Flask.add_url_rule"><tt class="xref py py-meth docutils literal"><span class="pre">add_url_rule()</span></tt></a>. Defaults to <a class="reference external" href="http://werkzeug.pocoo.org/docs/routing/#werkzeug.routing.Rule" title="(in Werkzeug v0.7)"><tt class="xref py py-class docutils literal"><span class="pre">werkzeug.routing.Rule</span></tt></a>.</p>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.7.</span></p>
+<p>alias of <tt class="xref py py-class docutils literal"><span class="pre">Rule</span></tt></p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Flask.url_value_preprocessor">
+<tt class="descname">url_value_preprocessor</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#flask.Flask.url_value_preprocessor" title="Permalink to this definition">¶</a></dt>
+<dd><p>Registers a function as URL value preprocessor for all view
+functions of the application. It&#8217;s called before the view functions
+are called and can modify the url values provided.</p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Flask.url_value_preprocessors">
+<tt class="descname">url_value_preprocessors</tt><em class="property"> = None</em><a class="headerlink" href="#flask.Flask.url_value_preprocessors" title="Permalink to this definition">¶</a></dt>
+<dd><p>A dictionary with lists of functions that can be used as URL
+value processor functions. Whenever a URL is built these functions
+are called to modify the dictionary of values in place. The key
+<cite>None</cite> here is used for application wide
+callbacks, otherwise the key is the name of the blueprint.
+Each of these functions has the chance to modify the dictionary</p>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.7.</span></p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Flask.use_x_sendfile">
+<tt class="descname">use_x_sendfile</tt><a class="headerlink" href="#flask.Flask.use_x_sendfile" title="Permalink to this definition">¶</a></dt>
+<dd><p>Enable this if you want to use the X-Sendfile feature. Keep in
+mind that the server has to support this. This only affects files
+sent with the <a class="reference internal" href="#flask.send_file" title="flask.send_file"><tt class="xref py py-func docutils literal"><span class="pre">send_file()</span></tt></a> method.</p>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.2.</span></p>
+<p>This attribute can also be configured from the config with the
+<cite>USE_X_SENDFILE</cite> configuration key. Defaults to <cite>False</cite>.</p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Flask.view_functions">
+<tt class="descname">view_functions</tt><em class="property"> = None</em><a class="headerlink" href="#flask.Flask.view_functions" title="Permalink to this definition">¶</a></dt>
+<dd><p>A dictionary of all view functions registered. The keys will
+be function names which are also used to generate URLs and
+the values are the function objects themselves.
+To register a view function, use the <a class="reference internal" href="#flask.Flask.route" title="flask.Flask.route"><tt class="xref py py-meth docutils literal"><span class="pre">route()</span></tt></a> decorator.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Flask.wsgi_app">
+<tt class="descname">wsgi_app</tt><big>(</big><em>environ</em>, <em>start_response</em><big>)</big><a class="headerlink" href="#flask.Flask.wsgi_app" title="Permalink to this definition">¶</a></dt>
+<dd><p>The actual WSGI application. This is not implemented in
+<cite>__call__</cite> so that middlewares can be applied without losing a
+reference to the class. So instead of doing this:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="n">app</span> <span class="o">=</span> <span class="n">MyMiddleware</span><span class="p">(</span><span class="n">app</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>It&#8217;s a better idea to do this instead:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="n">app</span><span class="o">.</span><span class="n">wsgi_app</span> <span class="o">=</span> <span class="n">MyMiddleware</span><span class="p">(</span><span class="n">app</span><span class="o">.</span><span class="n">wsgi_app</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>Then you still have the original application object around and
+can continue to call methods on it.</p>
+<p class="versionchanged">
+<span class="versionmodified">Changed in version 0.7: </span>The behavior of the before and after request callbacks was changed
+under error conditions and a new callback was added that will
+always execute at the end of the request, independent on if an
+error ocurred or not. See <a class="reference internal" href="reqcontext.html#callbacks-and-errors"><em>Callbacks and Errors</em></a>.</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>environ</strong> &#8211; a WSGI environment</li>
+<li><strong>start_response</strong> &#8211; a callable accepting a status code,
+a list of headers and an optional
+exception context to start the response</li>
+</ul>
+</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+</dd></dl>
+
+</div>
+<div class="section" id="blueprint-objects">
+<h2>Blueprint Objects<a class="headerlink" href="#blueprint-objects" title="Permalink to this headline">¶</a></h2>
+<dl class="class">
+<dt id="flask.Blueprint">
+<em class="property">class </em><tt class="descclassname">flask.</tt><tt class="descname">Blueprint</tt><big>(</big><em>name</em>, <em>import_name</em>, <em>static_folder=None</em>, <em>static_url_path=None</em>, <em>template_folder=None</em>, <em>url_prefix=None</em>, <em>subdomain=None</em>, <em>url_defaults=None</em><big>)</big><a class="headerlink" href="#flask.Blueprint" title="Permalink to this definition">¶</a></dt>
+<dd><p>Represents a blueprint. A blueprint is an object that records
+functions that will be called with the
+<tt class="xref py py-class docutils literal"><span class="pre">BlueprintSetupState</span></tt> later to register functions
+or other things on the main application. See <a class="reference internal" href="blueprints.html#blueprints"><em>Modular Applications with Blueprints</em></a> for more
+information.</p>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.7.</span></p>
+<dl class="method">
+<dt id="flask.Blueprint.add_url_rule">
+<tt class="descname">add_url_rule</tt><big>(</big><em>rule</em>, <em>endpoint=None</em>, <em>view_func=None</em>, <em>**options</em><big>)</big><a class="headerlink" href="#flask.Blueprint.add_url_rule" title="Permalink to this definition">¶</a></dt>
+<dd><p>Like <a class="reference internal" href="#flask.Flask.add_url_rule" title="flask.Flask.add_url_rule"><tt class="xref py py-meth docutils literal"><span class="pre">Flask.add_url_rule()</span></tt></a> but for a blueprint. The endpoint for
+the <a class="reference internal" href="#flask.url_for" title="flask.url_for"><tt class="xref py py-func docutils literal"><span class="pre">url_for()</span></tt></a> function is prefixed with the name of the blueprint.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Blueprint.after_app_request">
+<tt class="descname">after_app_request</tt><big>(</big><em>f</em><big>)</big><a class="headerlink" href="#flask.Blueprint.after_app_request" title="Permalink to this definition">¶</a></dt>
+<dd><p>Like <a class="reference internal" href="#flask.Flask.after_request" title="flask.Flask.after_request"><tt class="xref py py-meth docutils literal"><span class="pre">Flask.after_request()</span></tt></a> but for a blueprint. Such a function
+is executed after each request, even if outside of the blueprint.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Blueprint.after_request">
+<tt class="descname">after_request</tt><big>(</big><em>f</em><big>)</big><a class="headerlink" href="#flask.Blueprint.after_request" title="Permalink to this definition">¶</a></dt>
+<dd><p>Like <a class="reference internal" href="#flask.Flask.after_request" title="flask.Flask.after_request"><tt class="xref py py-meth docutils literal"><span class="pre">Flask.after_request()</span></tt></a> but for a blueprint. This function
+is only executed after each request that is handled by a function of
+that blueprint.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Blueprint.app_context_processor">
+<tt class="descname">app_context_processor</tt><big>(</big><em>f</em><big>)</big><a class="headerlink" href="#flask.Blueprint.app_context_processor" title="Permalink to this definition">¶</a></dt>
+<dd><p>Like <a class="reference internal" href="#flask.Flask.context_processor" title="flask.Flask.context_processor"><tt class="xref py py-meth docutils literal"><span class="pre">Flask.context_processor()</span></tt></a> but for a blueprint. Such a
+function is executed each request, even if outside of the blueprint.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Blueprint.app_errorhandler">
+<tt class="descname">app_errorhandler</tt><big>(</big><em>code</em><big>)</big><a class="headerlink" href="#flask.Blueprint.app_errorhandler" title="Permalink to this definition">¶</a></dt>
+<dd><p>Like <a class="reference internal" href="#flask.Flask.errorhandler" title="flask.Flask.errorhandler"><tt class="xref py py-meth docutils literal"><span class="pre">Flask.errorhandler()</span></tt></a> but for a blueprint. This
+handler is used for all requests, even if outside of the blueprint.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Blueprint.app_url_defaults">
+<tt class="descname">app_url_defaults</tt><big>(</big><em>f</em><big>)</big><a class="headerlink" href="#flask.Blueprint.app_url_defaults" title="Permalink to this definition">¶</a></dt>
+<dd><p>Same as <a class="reference internal" href="#flask.Blueprint.url_defaults" title="flask.Blueprint.url_defaults"><tt class="xref py py-meth docutils literal"><span class="pre">url_defaults()</span></tt></a> but application wide.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Blueprint.app_url_value_preprocessor">
+<tt class="descname">app_url_value_preprocessor</tt><big>(</big><em>f</em><big>)</big><a class="headerlink" href="#flask.Blueprint.app_url_value_preprocessor" title="Permalink to this definition">¶</a></dt>
+<dd><p>Same as <a class="reference internal" href="#flask.Blueprint.url_value_preprocessor" title="flask.Blueprint.url_value_preprocessor"><tt class="xref py py-meth docutils literal"><span class="pre">url_value_preprocessor()</span></tt></a> but application wide.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Blueprint.before_app_first_request">
+<tt class="descname">before_app_first_request</tt><big>(</big><em>f</em><big>)</big><a class="headerlink" href="#flask.Blueprint.before_app_first_request" title="Permalink to this definition">¶</a></dt>
+<dd><p>Like <a class="reference internal" href="#flask.Flask.before_first_request" title="flask.Flask.before_first_request"><tt class="xref py py-meth docutils literal"><span class="pre">Flask.before_first_request()</span></tt></a>. Such a function is
+executed before the first request to the application.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Blueprint.before_app_request">
+<tt class="descname">before_app_request</tt><big>(</big><em>f</em><big>)</big><a class="headerlink" href="#flask.Blueprint.before_app_request" title="Permalink to this definition">¶</a></dt>
+<dd><p>Like <a class="reference internal" href="#flask.Flask.before_request" title="flask.Flask.before_request"><tt class="xref py py-meth docutils literal"><span class="pre">Flask.before_request()</span></tt></a>. Such a function is executed
+before each request, even if outside of a blueprint.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Blueprint.before_request">
+<tt class="descname">before_request</tt><big>(</big><em>f</em><big>)</big><a class="headerlink" href="#flask.Blueprint.before_request" title="Permalink to this definition">¶</a></dt>
+<dd><p>Like <a class="reference internal" href="#flask.Flask.before_request" title="flask.Flask.before_request"><tt class="xref py py-meth docutils literal"><span class="pre">Flask.before_request()</span></tt></a> but for a blueprint. This function
+is only executed before each request that is handled by a function of
+that blueprint.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Blueprint.context_processor">
+<tt class="descname">context_processor</tt><big>(</big><em>f</em><big>)</big><a class="headerlink" href="#flask.Blueprint.context_processor" title="Permalink to this definition">¶</a></dt>
+<dd><p>Like <a class="reference internal" href="#flask.Flask.context_processor" title="flask.Flask.context_processor"><tt class="xref py py-meth docutils literal"><span class="pre">Flask.context_processor()</span></tt></a> but for a blueprint. This
+function is only executed for requests handled by a blueprint.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Blueprint.endpoint">
+<tt class="descname">endpoint</tt><big>(</big><em>endpoint</em><big>)</big><a class="headerlink" href="#flask.Blueprint.endpoint" title="Permalink to this definition">¶</a></dt>
+<dd><p>Like <a class="reference internal" href="#flask.Flask.endpoint" title="flask.Flask.endpoint"><tt class="xref py py-meth docutils literal"><span class="pre">Flask.endpoint()</span></tt></a> but for a blueprint. This does not
+prefix the endpoint with the blueprint name, this has to be done
+explicitly by the user of this method. If the endpoint is prefixed
+with a <cite>.</cite> it will be registered to the current blueprint, otherwise
+it&#8217;s an application independent endpoint.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Blueprint.errorhandler">
+<tt class="descname">errorhandler</tt><big>(</big><em>code_or_exception</em><big>)</big><a class="headerlink" href="#flask.Blueprint.errorhandler" title="Permalink to this definition">¶</a></dt>
+<dd><p>Registers an error handler that becomes active for this blueprint
+only. Please be aware that routing does not happen local to a
+blueprint so an error handler for 404 usually is not handled by
+a blueprint unless it is caused inside a view function. Another
+special case is the 500 internal server error which is always looked
+up from the application.</p>
+<p>Otherwise works as the <a class="reference internal" href="#flask.Flask.errorhandler" title="flask.Flask.errorhandler"><tt class="xref py py-meth docutils literal"><span class="pre">errorhandler()</span></tt></a> decorator
+of the <a class="reference internal" href="#flask.Flask" title="flask.Flask"><tt class="xref py py-class docutils literal"><span class="pre">Flask</span></tt></a> object.</p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Blueprint.has_static_folder">
+<tt class="descname">has_static_folder</tt><a class="headerlink" href="#flask.Blueprint.has_static_folder" title="Permalink to this definition">¶</a></dt>
+<dd><p>This is <cite>True</cite> if the package bound object&#8217;s container has a
+folder named <tt class="docutils literal"><span class="pre">'static'</span></tt>.</p>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.5.</span></p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Blueprint.jinja_loader">
+<tt class="descname">jinja_loader</tt><a class="headerlink" href="#flask.Blueprint.jinja_loader" title="Permalink to this definition">¶</a></dt>
+<dd><p>The Jinja loader for this package bound object.</p>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.5.</span></p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Blueprint.make_setup_state">
+<tt class="descname">make_setup_state</tt><big>(</big><em>app</em>, <em>options</em>, <em>first_registration=False</em><big>)</big><a class="headerlink" href="#flask.Blueprint.make_setup_state" title="Permalink to this definition">¶</a></dt>
+<dd><p>Creates an instance of <a class="reference internal" href="#flask.blueprints.BlueprintSetupState" title="flask.blueprints.BlueprintSetupState"><tt class="xref py py-meth docutils literal"><span class="pre">BlueprintSetupState()</span></tt></a>
+object that is later passed to the register callback functions.
+Subclasses can override this to return a subclass of the setup state.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Blueprint.open_resource">
+<tt class="descname">open_resource</tt><big>(</big><em>resource</em>, <em>mode='rb'</em><big>)</big><a class="headerlink" href="#flask.Blueprint.open_resource" title="Permalink to this definition">¶</a></dt>
+<dd><p>Opens a resource from the application&#8217;s resource folder. To see
+how this works, consider the following folder structure:</p>
+<div class="highlight-python"><pre>/myapplication.py
+/schema.sql
+/static
+ /style.css
+/templates
+ /layout.html
+ /index.html</pre>
+</div>
+<p>If you want to open the <cite>schema.sql</cite> file you would do the
+following:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">with</span> <span class="n">app</span><span class="o">.</span><span class="n">open_resource</span><span class="p">(</span><span class="s">&#39;schema.sql&#39;</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
+ <span class="n">contents</span> <span class="o">=</span> <span class="n">f</span><span class="o">.</span><span class="n">read</span><span class="p">()</span>
+ <span class="n">do_something_with</span><span class="p">(</span><span class="n">contents</span><span class="p">)</span>
+</pre></div>
+</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>resource</strong> &#8211; the name of the resource. To access resources within
+subfolders use forward slashes as separator.</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Blueprint.record">
+<tt class="descname">record</tt><big>(</big><em>func</em><big>)</big><a class="headerlink" href="#flask.Blueprint.record" title="Permalink to this definition">¶</a></dt>
+<dd><p>Registers a function that is called when the blueprint is
+registered on the application. This function is called with the
+state as argument as returned by the <a class="reference internal" href="#flask.Blueprint.make_setup_state" title="flask.Blueprint.make_setup_state"><tt class="xref py py-meth docutils literal"><span class="pre">make_setup_state()</span></tt></a>
+method.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Blueprint.record_once">
+<tt class="descname">record_once</tt><big>(</big><em>func</em><big>)</big><a class="headerlink" href="#flask.Blueprint.record_once" title="Permalink to this definition">¶</a></dt>
+<dd><p>Works like <a class="reference internal" href="#flask.Blueprint.record" title="flask.Blueprint.record"><tt class="xref py py-meth docutils literal"><span class="pre">record()</span></tt></a> but wraps the function in another
+function that will ensure the function is only called once. If the
+blueprint is registered a second time on the application, the
+function passed is not called.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Blueprint.register">
+<tt class="descname">register</tt><big>(</big><em>app</em>, <em>options</em>, <em>first_registration=False</em><big>)</big><a class="headerlink" href="#flask.Blueprint.register" title="Permalink to this definition">¶</a></dt>
+<dd><p>Called by <a class="reference internal" href="#flask.Flask.register_blueprint" title="flask.Flask.register_blueprint"><tt class="xref py py-meth docutils literal"><span class="pre">Flask.register_blueprint()</span></tt></a> to register a blueprint
+on the application. This can be overridden to customize the register
+behavior. Keyword arguments from
+<a class="reference internal" href="#flask.Flask.register_blueprint" title="flask.Flask.register_blueprint"><tt class="xref py py-func docutils literal"><span class="pre">register_blueprint()</span></tt></a> are directly forwarded to this
+method in the <cite>options</cite> dictionary.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Blueprint.route">
+<tt class="descname">route</tt><big>(</big><em>rule</em>, <em>**options</em><big>)</big><a class="headerlink" href="#flask.Blueprint.route" title="Permalink to this definition">¶</a></dt>
+<dd><p>Like <a class="reference internal" href="#flask.Flask.route" title="flask.Flask.route"><tt class="xref py py-meth docutils literal"><span class="pre">Flask.route()</span></tt></a> but for a blueprint. The endpoint for the
+<a class="reference internal" href="#flask.url_for" title="flask.url_for"><tt class="xref py py-func docutils literal"><span class="pre">url_for()</span></tt></a> function is prefixed with the name of the blueprint.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Blueprint.send_static_file">
+<tt class="descname">send_static_file</tt><big>(</big><em>filename</em><big>)</big><a class="headerlink" href="#flask.Blueprint.send_static_file" title="Permalink to this definition">¶</a></dt>
+<dd><p>Function used internally to send static files from the static
+folder to the browser.</p>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.5.</span></p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Blueprint.teardown_app_request">
+<tt class="descname">teardown_app_request</tt><big>(</big><em>f</em><big>)</big><a class="headerlink" href="#flask.Blueprint.teardown_app_request" title="Permalink to this definition">¶</a></dt>
+<dd><p>Like <a class="reference internal" href="#flask.Flask.teardown_request" title="flask.Flask.teardown_request"><tt class="xref py py-meth docutils literal"><span class="pre">Flask.teardown_request()</span></tt></a> but for a blueprint. Such a
+function is executed when tearing down each request, even if outside of
+the blueprint.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Blueprint.teardown_request">
+<tt class="descname">teardown_request</tt><big>(</big><em>f</em><big>)</big><a class="headerlink" href="#flask.Blueprint.teardown_request" title="Permalink to this definition">¶</a></dt>
+<dd><p>Like <a class="reference internal" href="#flask.Flask.teardown_request" title="flask.Flask.teardown_request"><tt class="xref py py-meth docutils literal"><span class="pre">Flask.teardown_request()</span></tt></a> but for a blueprint. This
+function is only executed when tearing down requests handled by a
+function of that blueprint. Teardown request functions are executed
+when the request context is popped, even when no actual request was
+performed.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Blueprint.url_defaults">
+<tt class="descname">url_defaults</tt><big>(</big><em>f</em><big>)</big><a class="headerlink" href="#flask.Blueprint.url_defaults" title="Permalink to this definition">¶</a></dt>
+<dd><p>Callback function for URL defaults for this blueprint. It&#8217;s called
+with the endpoint and values and should update the values passed
+in place.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Blueprint.url_value_preprocessor">
+<tt class="descname">url_value_preprocessor</tt><big>(</big><em>f</em><big>)</big><a class="headerlink" href="#flask.Blueprint.url_value_preprocessor" title="Permalink to this definition">¶</a></dt>
+<dd><p>Registers a function as URL value preprocessor for this
+blueprint. It&#8217;s called before the view functions are called and
+can modify the url values provided.</p>
+</dd></dl>
+
+</dd></dl>
+
+</div>
+<div class="section" id="incoming-request-data">
+<h2>Incoming Request Data<a class="headerlink" href="#incoming-request-data" title="Permalink to this headline">¶</a></h2>
+<dl class="class">
+<dt id="flask.Request">
+<em class="property">class </em><tt class="descclassname">flask.</tt><tt class="descname">Request</tt><big>(</big><em>environ</em>, <em>populate_request=True</em>, <em>shallow=False</em><big>)</big><a class="headerlink" href="#flask.Request" title="Permalink to this definition">¶</a></dt>
+<dd><p>The request object used by default in Flask. Remembers the
+matched endpoint and view arguments.</p>
+<p>It is what ends up as <a class="reference internal" href="#flask.request" title="flask.request"><tt class="xref py py-class docutils literal"><span class="pre">request</span></tt></a>. If you want to replace
+the request object used you can subclass this and set
+<a class="reference internal" href="#flask.Flask.request_class" title="flask.Flask.request_class"><tt class="xref py py-attr docutils literal"><span class="pre">request_class</span></tt></a> to your subclass.</p>
+<p>The request object is a <a class="reference external" href="http://werkzeug.pocoo.org/docs/wrappers/#werkzeug.wrappers.Request" title="(in Werkzeug v0.7)"><tt class="xref py py-class docutils literal"><span class="pre">Request</span></tt></a> subclass and
+provides all of the attributes Werkzeug defines plus a few Flask
+specific ones.</p>
+<dl class="attribute">
+<dt id="flask.Request.form">
+<tt class="descname">form</tt><a class="headerlink" href="#flask.Request.form" title="Permalink to this definition">¶</a></dt>
+<dd><p>A <a class="reference external" href="http://werkzeug.pocoo.org/docs/datastructures/#werkzeug.datastructures.MultiDict" title="(in Werkzeug v0.7)"><tt class="xref py py-class docutils literal"><span class="pre">MultiDict</span></tt></a> with the parsed form data from <cite>POST</cite>
+or <cite>PUT</cite> requests. Please keep in mind that file uploads will not
+end up here, but instead in the <a class="reference internal" href="#flask.Request.files" title="flask.Request.files"><tt class="xref py py-attr docutils literal"><span class="pre">files</span></tt></a> attribute.</p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Request.args">
+<tt class="descname">args</tt><a class="headerlink" href="#flask.Request.args" title="Permalink to this definition">¶</a></dt>
+<dd><p>A <a class="reference external" href="http://werkzeug.pocoo.org/docs/datastructures/#werkzeug.datastructures.MultiDict" title="(in Werkzeug v0.7)"><tt class="xref py py-class docutils literal"><span class="pre">MultiDict</span></tt></a> with the parsed contents of the query
+string. (The part in the URL after the question mark).</p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Request.values">
+<tt class="descname">values</tt><a class="headerlink" href="#flask.Request.values" title="Permalink to this definition">¶</a></dt>
+<dd><p>A <a class="reference external" href="http://werkzeug.pocoo.org/docs/datastructures/#werkzeug.datastructures.CombinedMultiDict" title="(in Werkzeug v0.7)"><tt class="xref py py-class docutils literal"><span class="pre">CombinedMultiDict</span></tt></a> with the contents of both
+<a class="reference internal" href="#flask.Request.form" title="flask.Request.form"><tt class="xref py py-attr docutils literal"><span class="pre">form</span></tt></a> and <a class="reference internal" href="#flask.Request.args" title="flask.Request.args"><tt class="xref py py-attr docutils literal"><span class="pre">args</span></tt></a>.</p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Request.cookies">
+<tt class="descname">cookies</tt><a class="headerlink" href="#flask.Request.cookies" title="Permalink to this definition">¶</a></dt>
+<dd><p>A <a class="reference external" href="http://docs.python.org/dev/library/stdtypes.html#dict" title="(in Python v3.3)"><tt class="xref py py-class docutils literal"><span class="pre">dict</span></tt></a> with the contents of all cookies transmitted with
+the request.</p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Request.stream">
+<tt class="descname">stream</tt><a class="headerlink" href="#flask.Request.stream" title="Permalink to this definition">¶</a></dt>
+<dd><p>If the incoming form data was not encoded with a known mimetype
+the data is stored unmodified in this stream for consumption. Most
+of the time it is a better idea to use <a class="reference internal" href="#flask.Request.data" title="flask.Request.data"><tt class="xref py py-attr docutils literal"><span class="pre">data</span></tt></a> which will give
+you that data as a string. The stream only returns the data once.</p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Request.headers">
+<tt class="descname">headers</tt><a class="headerlink" href="#flask.Request.headers" title="Permalink to this definition">¶</a></dt>
+<dd><p>The incoming request headers as a dictionary like object.</p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Request.data">
+<tt class="descname">data</tt><a class="headerlink" href="#flask.Request.data" title="Permalink to this definition">¶</a></dt>
+<dd><p>Contains the incoming request data as string in case it came with
+a mimetype Flask does not handle.</p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Request.files">
+<tt class="descname">files</tt><a class="headerlink" href="#flask.Request.files" title="Permalink to this definition">¶</a></dt>
+<dd><p>A <a class="reference external" href="http://werkzeug.pocoo.org/docs/datastructures/#werkzeug.datastructures.MultiDict" title="(in Werkzeug v0.7)"><tt class="xref py py-class docutils literal"><span class="pre">MultiDict</span></tt></a> with files uploaded as part of a
+<cite>POST</cite> or <cite>PUT</cite> request. Each file is stored as
+<a class="reference external" href="http://werkzeug.pocoo.org/docs/datastructures/#werkzeug.datastructures.FileStorage" title="(in Werkzeug v0.7)"><tt class="xref py py-class docutils literal"><span class="pre">FileStorage</span></tt></a> object. It basically behaves like a
+standard file object you know from Python, with the difference that
+it also has a <a class="reference external" href="http://werkzeug.pocoo.org/docs/datastructures/#werkzeug.datastructures.FileStorage.save" title="(in Werkzeug v0.7)"><tt class="xref py py-meth docutils literal"><span class="pre">save()</span></tt></a> function that can
+store the file on the filesystem.</p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Request.environ">
+<tt class="descname">environ</tt><a class="headerlink" href="#flask.Request.environ" title="Permalink to this definition">¶</a></dt>
+<dd><p>The underlying WSGI environment.</p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Request.method">
+<tt class="descname">method</tt><a class="headerlink" href="#flask.Request.method" title="Permalink to this definition">¶</a></dt>
+<dd><p>The current request method (<tt class="docutils literal"><span class="pre">POST</span></tt>, <tt class="docutils literal"><span class="pre">GET</span></tt> etc.)</p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Request.path">
+<tt class="descname">path</tt><a class="headerlink" href="#flask.Request.path" title="Permalink to this definition">¶</a></dt>
+<dd></dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Request.script_root">
+<tt class="descname">script_root</tt><a class="headerlink" href="#flask.Request.script_root" title="Permalink to this definition">¶</a></dt>
+<dd></dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Request.url">
+<tt class="descname">url</tt><a class="headerlink" href="#flask.Request.url" title="Permalink to this definition">¶</a></dt>
+<dd></dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Request.base_url">
+<tt class="descname">base_url</tt><a class="headerlink" href="#flask.Request.base_url" title="Permalink to this definition">¶</a></dt>
+<dd></dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Request.url_root">
+<tt class="descname">url_root</tt><a class="headerlink" href="#flask.Request.url_root" title="Permalink to this definition">¶</a></dt>
+<dd><p>Provides different ways to look at the current URL. Imagine your
+application is listening on the following URL:</p>
+<div class="highlight-python"><pre>http://www.example.com/myapplication</pre>
+</div>
+<p>And a user requests the following URL:</p>
+<div class="highlight-python"><pre>http://www.example.com/myapplication/page.html?x=y</pre>
+</div>
+<p>In this case the values of the above mentioned attributes would be
+the following:</p>
+<table border="1" class="docutils">
+<colgroup>
+<col width="19%" />
+<col width="81%" />
+</colgroup>
+<tbody valign="top">
+<tr class="row-odd"><td><cite>path</cite></td>
+<td><tt class="docutils literal"><span class="pre">/page.html</span></tt></td>
+</tr>
+<tr class="row-even"><td><cite>script_root</cite></td>
+<td><tt class="docutils literal"><span class="pre">/myapplication</span></tt></td>
+</tr>
+<tr class="row-odd"><td><cite>base_url</cite></td>
+<td><tt class="docutils literal"><span class="pre">http://www.example.com/myapplication/page.html</span></tt></td>
+</tr>
+<tr class="row-even"><td><cite>url</cite></td>
+<td><tt class="docutils literal"><span class="pre">http://www.example.com/myapplication/page.html?x=y</span></tt></td>
+</tr>
+<tr class="row-odd"><td><cite>url_root</cite></td>
+<td><tt class="docutils literal"><span class="pre">http://www.example.com/myapplication/</span></tt></td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Request.is_xhr">
+<tt class="descname">is_xhr</tt><a class="headerlink" href="#flask.Request.is_xhr" title="Permalink to this definition">¶</a></dt>
+<dd><p><cite>True</cite> if the request was triggered via a JavaScript
+<cite>XMLHttpRequest</cite>. This only works with libraries that support the
+<tt class="docutils literal"><span class="pre">X-Requested-With</span></tt> header and set it to <cite>XMLHttpRequest</cite>.
+Libraries that do that are prototype, jQuery and Mochikit and
+probably some more.</p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Request.blueprint">
+<tt class="descname">blueprint</tt><a class="headerlink" href="#flask.Request.blueprint" title="Permalink to this definition">¶</a></dt>
+<dd><p>The name of the current blueprint</p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Request.endpoint">
+<tt class="descname">endpoint</tt><a class="headerlink" href="#flask.Request.endpoint" title="Permalink to this definition">¶</a></dt>
+<dd><p>The endpoint that matched the request. This in combination with
+<a class="reference internal" href="#flask.Request.view_args" title="flask.Request.view_args"><tt class="xref py py-attr docutils literal"><span class="pre">view_args</span></tt></a> can be used to reconstruct the same or a
+modified URL. If an exception happened when matching, this will
+be <cite>None</cite>.</p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Request.json">
+<tt class="descname">json</tt><a class="headerlink" href="#flask.Request.json" title="Permalink to this definition">¶</a></dt>
+<dd><p>If the mimetype is <cite>application/json</cite> this will contain the
+parsed JSON data. Otherwise this will be <cite>None</cite>.</p>
+<p>This requires Python 2.6 or an installed version of simplejson.</p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Request.max_content_length">
+<tt class="descname">max_content_length</tt><a class="headerlink" href="#flask.Request.max_content_length" title="Permalink to this definition">¶</a></dt>
+<dd><p>Read-only view of the <cite>MAX_CONTENT_LENGTH</cite> config key.</p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Request.module">
+<tt class="descname">module</tt><a class="headerlink" href="#flask.Request.module" title="Permalink to this definition">¶</a></dt>
+<dd><p>The name of the current module if the request was dispatched
+to an actual module. This is deprecated functionality, use blueprints
+instead.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Request.on_json_loading_failed">
+<tt class="descname">on_json_loading_failed</tt><big>(</big><em>e</em><big>)</big><a class="headerlink" href="#flask.Request.on_json_loading_failed" title="Permalink to this definition">¶</a></dt>
+<dd><p>Called if decoding of the JSON data failed. The return value of
+this method is used by <a class="reference internal" href="#flask.json" title="flask.json"><tt class="xref py py-attr docutils literal"><span class="pre">json</span></tt></a> when an error ocurred. The
+default implementation raises a <tt class="xref py py-class docutils literal"><span class="pre">BadRequest</span></tt>.</p>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.8.</span></p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Request.routing_exception">
+<tt class="descname">routing_exception</tt><em class="property"> = None</em><a class="headerlink" href="#flask.Request.routing_exception" title="Permalink to this definition">¶</a></dt>
+<dd><p>if matching the URL failed, this is the exception that will be
+raised / was raised as part of the request handling. This is
+usually a <a class="reference external" href="http://werkzeug.pocoo.org/docs/exceptions/#werkzeug.exceptions.NotFound" title="(in Werkzeug v0.7)"><tt class="xref py py-exc docutils literal"><span class="pre">NotFound</span></tt></a> exception or
+something similar.</p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Request.url_rule">
+<tt class="descname">url_rule</tt><em class="property"> = None</em><a class="headerlink" href="#flask.Request.url_rule" title="Permalink to this definition">¶</a></dt>
+<dd><p>the internal URL rule that matched the request. This can be
+useful to inspect which methods are allowed for the URL from
+a before/after handler (<tt class="docutils literal"><span class="pre">request.url_rule.methods</span></tt>) etc.</p>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.6.</span></p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Request.view_args">
+<tt class="descname">view_args</tt><em class="property"> = None</em><a class="headerlink" href="#flask.Request.view_args" title="Permalink to this definition">¶</a></dt>
+<dd><p>a dict of view arguments that matched the request. If an exception
+happened when matching, this will be <cite>None</cite>.</p>
+</dd></dl>
+
+</dd></dl>
+
+<dl class="class">
+<dt id="flask.request">
+<em class="property">class </em><tt class="descclassname">flask.</tt><tt class="descname">request</tt><a class="headerlink" href="#flask.request" title="Permalink to this definition">¶</a></dt>
+<dd><p>To access incoming request data, you can use the global <cite>request</cite>
+object. Flask parses incoming request data for you and gives you
+access to it through that global object. Internally Flask makes
+sure that you always get the correct data for the active thread if you
+are in a multithreaded environment.</p>
+<p>This is a proxy. See <a class="reference internal" href="reqcontext.html#notes-on-proxies"><em>Notes On Proxies</em></a> for more information.</p>
+<p>The request object is an instance of a <a class="reference external" href="http://werkzeug.pocoo.org/docs/wrappers/#werkzeug.wrappers.Request" title="(in Werkzeug v0.7)"><tt class="xref py py-class docutils literal"><span class="pre">Request</span></tt></a>
+subclass and provides all of the attributes Werkzeug defines. This
+just shows a quick overview of the most important ones.</p>
+</dd></dl>
+
+</div>
+<div class="section" id="response-objects">
+<h2>Response Objects<a class="headerlink" href="#response-objects" title="Permalink to this headline">¶</a></h2>
+<dl class="class">
+<dt id="flask.Response">
+<em class="property">class </em><tt class="descclassname">flask.</tt><tt class="descname">Response</tt><big>(</big><em>response=None</em>, <em>status=None</em>, <em>headers=None</em>, <em>mimetype=None</em>, <em>content_type=None</em>, <em>direct_passthrough=False</em><big>)</big><a class="headerlink" href="#flask.Response" title="Permalink to this definition">¶</a></dt>
+<dd><p>The response object that is used by default in Flask. Works like the
+response object from Werkzeug but is set to have an HTML mimetype by
+default. Quite often you don&#8217;t have to create this object yourself because
+<a class="reference internal" href="#flask.Flask.make_response" title="flask.Flask.make_response"><tt class="xref py py-meth docutils literal"><span class="pre">make_response()</span></tt></a> will take care of that for you.</p>
+<p>If you want to replace the response object used you can subclass this and
+set <a class="reference internal" href="#flask.Flask.response_class" title="flask.Flask.response_class"><tt class="xref py py-attr docutils literal"><span class="pre">response_class</span></tt></a> to your subclass.</p>
+<dl class="attribute">
+<dt id="flask.Response.headers">
+<tt class="descname">headers</tt><a class="headerlink" href="#flask.Response.headers" title="Permalink to this definition">¶</a></dt>
+<dd><p>A <tt class="xref py py-class docutils literal"><span class="pre">Headers</span></tt> object representing the response headers.</p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Response.status_code">
+<tt class="descname">status_code</tt><a class="headerlink" href="#flask.Response.status_code" title="Permalink to this definition">¶</a></dt>
+<dd><p>The response status as integer.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Response.set_cookie">
+<tt class="descname">set_cookie</tt><big>(</big><em>key</em>, <em>value=''</em>, <em>max_age=None</em>, <em>expires=None</em>, <em>path='/'</em>, <em>domain=None</em>, <em>secure=None</em>, <em>httponly=False</em><big>)</big><a class="headerlink" href="#flask.Response.set_cookie" title="Permalink to this definition">¶</a></dt>
+<dd><p>Sets a cookie. The parameters are the same as in the cookie <cite>Morsel</cite>
+object in the Python standard library but it accepts unicode data, too.</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>key</strong> &#8211; the key (name) of the cookie to be set.</li>
+<li><strong>value</strong> &#8211; the value of the cookie.</li>
+<li><strong>max_age</strong> &#8211; should be a number of seconds, or <cite>None</cite> (default) if
+the cookie should last only as long as the client&#8217;s
+browser session.</li>
+<li><strong>expires</strong> &#8211; should be a <cite>datetime</cite> object or UNIX timestamp.</li>
+<li><strong>domain</strong> &#8211; if you want to set a cross-domain cookie. For example,
+<tt class="docutils literal"><span class="pre">domain=&quot;.example.com&quot;</span></tt> will set a cookie that is
+readable by the domain <tt class="docutils literal"><span class="pre">www.example.com</span></tt>,
+<tt class="docutils literal"><span class="pre">foo.example.com</span></tt> etc. Otherwise, a cookie will only
+be readable by the domain that set it.</li>
+<li><strong>path</strong> &#8211; limits the cookie to a given path, per default it will
+span the whole domain.</li>
+</ul>
+</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Response.data">
+<tt class="descname">data</tt><a class="headerlink" href="#flask.Response.data" title="Permalink to this definition">¶</a></dt>
+<dd><p>The string representation of the request body. Whenever you access
+this property the request iterable is encoded and flattened. This
+can lead to unwanted behavior if you stream big data.</p>
+<p>This behavior can be disabled by setting
+<tt class="xref py py-attr docutils literal"><span class="pre">implicit_sequence_conversion</span></tt> to <cite>False</cite>.</p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.Response.mimetype">
+<tt class="descname">mimetype</tt><a class="headerlink" href="#flask.Response.mimetype" title="Permalink to this definition">¶</a></dt>
+<dd><p>The mimetype (content type without charset etc.)</p>
+</dd></dl>
+
+</dd></dl>
+
+</div>
+<div class="section" id="sessions">
+<h2>Sessions<a class="headerlink" href="#sessions" title="Permalink to this headline">¶</a></h2>
+<p>If you have the <a class="reference internal" href="#flask.Flask.secret_key" title="flask.Flask.secret_key"><tt class="xref py py-attr docutils literal"><span class="pre">Flask.secret_key</span></tt></a> set you can use sessions in Flask
+applications. A session basically makes it possible to remember
+information from one request to another. The way Flask does this is by
+using a signed cookie. So the user can look at the session contents, but
+not modify it unless they know the secret key, so make sure to set that
+to something complex and unguessable.</p>
+<p>To access the current session you can use the <a class="reference internal" href="#flask.session" title="flask.session"><tt class="xref py py-class docutils literal"><span class="pre">session</span></tt></a> object:</p>
+<dl class="class">
+<dt id="flask.session">
+<em class="property">class </em><tt class="descclassname">flask.</tt><tt class="descname">session</tt><a class="headerlink" href="#flask.session" title="Permalink to this definition">¶</a></dt>
+<dd><p>The session object works pretty much like an ordinary dict, with the
+difference that it keeps track on modifications.</p>
+<p>This is a proxy. See <a class="reference internal" href="reqcontext.html#notes-on-proxies"><em>Notes On Proxies</em></a> for more information.</p>
+<p>The following attributes are interesting:</p>
+<dl class="attribute">
+<dt id="flask.session.new">
+<tt class="descname">new</tt><a class="headerlink" href="#flask.session.new" title="Permalink to this definition">¶</a></dt>
+<dd><p><cite>True</cite> if the session is new, <cite>False</cite> otherwise.</p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.session.modified">
+<tt class="descname">modified</tt><a class="headerlink" href="#flask.session.modified" title="Permalink to this definition">¶</a></dt>
+<dd><p><cite>True</cite> if the session object detected a modification. Be advised
+that modifications on mutable structures are not picked up
+automatically, in that situation you have to explicitly set the
+attribute to <cite>True</cite> yourself. Here an example:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="c"># this change is not picked up because a mutable object (here</span>
+<span class="c"># a list) is changed.</span>
+<span class="n">session</span><span class="p">[</span><span class="s">&#39;objects&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="mi">42</span><span class="p">)</span>
+<span class="c"># so mark it as modified yourself</span>
+<span class="n">session</span><span class="o">.</span><span class="n">modified</span> <span class="o">=</span> <span class="bp">True</span>
+</pre></div>
+</div>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.session.permanent">
+<tt class="descname">permanent</tt><a class="headerlink" href="#flask.session.permanent" title="Permalink to this definition">¶</a></dt>
+<dd><p>If set to <cite>True</cite> the session lives for
+<a class="reference internal" href="#flask.Flask.permanent_session_lifetime" title="flask.Flask.permanent_session_lifetime"><tt class="xref py py-attr docutils literal"><span class="pre">permanent_session_lifetime</span></tt></a> seconds. The
+default is 31 days. If set to <cite>False</cite> (which is the default) the
+session will be deleted when the user closes the browser.</p>
+</dd></dl>
+
+</dd></dl>
+
+</div>
+<div class="section" id="session-interface">
+<h2>Session Interface<a class="headerlink" href="#session-interface" title="Permalink to this headline">¶</a></h2>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.8.</span></p>
+<p>The session interface provides a simple way to replace the session
+implementation that Flask is using.</p>
+<dl class="class">
+<dt id="flask.sessions.SessionInterface">
+<em class="property">class </em><tt class="descclassname">flask.sessions.</tt><tt class="descname">SessionInterface</tt><a class="headerlink" href="#flask.sessions.SessionInterface" title="Permalink to this definition">¶</a></dt>
+<dd><p>The basic interface you have to implement in order to replace the
+default session interface which uses werkzeug&#8217;s securecookie
+implementation. The only methods you have to implement are
+<a class="reference internal" href="#flask.sessions.SessionInterface.open_session" title="flask.sessions.SessionInterface.open_session"><tt class="xref py py-meth docutils literal"><span class="pre">open_session()</span></tt></a> and <a class="reference internal" href="#flask.sessions.SessionInterface.save_session" title="flask.sessions.SessionInterface.save_session"><tt class="xref py py-meth docutils literal"><span class="pre">save_session()</span></tt></a>, the others have
+useful defaults which you don&#8217;t need to change.</p>
+<p>The session object returned by the <a class="reference internal" href="#flask.sessions.SessionInterface.open_session" title="flask.sessions.SessionInterface.open_session"><tt class="xref py py-meth docutils literal"><span class="pre">open_session()</span></tt></a> method has to
+provide a dictionary like interface plus the properties and methods
+from the <a class="reference internal" href="#flask.sessions.SessionMixin" title="flask.sessions.SessionMixin"><tt class="xref py py-class docutils literal"><span class="pre">SessionMixin</span></tt></a>. We recommend just subclassing a dict
+and adding that mixin:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">class</span> <span class="nc">Session</span><span class="p">(</span><span class="nb">dict</span><span class="p">,</span> <span class="n">SessionMixin</span><span class="p">):</span>
+ <span class="k">pass</span>
+</pre></div>
+</div>
+<p>If <a class="reference internal" href="#flask.sessions.SessionInterface.open_session" title="flask.sessions.SessionInterface.open_session"><tt class="xref py py-meth docutils literal"><span class="pre">open_session()</span></tt></a> returns <cite>None</cite> Flask will call into
+<a class="reference internal" href="#flask.sessions.SessionInterface.make_null_session" title="flask.sessions.SessionInterface.make_null_session"><tt class="xref py py-meth docutils literal"><span class="pre">make_null_session()</span></tt></a> to create a session that acts as replacement
+if the session support cannot work because some requirement is not
+fulfilled. The default <a class="reference internal" href="#flask.sessions.NullSession" title="flask.sessions.NullSession"><tt class="xref py py-class docutils literal"><span class="pre">NullSession</span></tt></a> class that is created
+will complain that the secret key was not set.</p>
+<p>To replace the session interface on an application all you have to do
+is to assign <a class="reference internal" href="#flask.Flask.session_interface" title="flask.Flask.session_interface"><tt class="xref py py-attr docutils literal"><span class="pre">flask.Flask.session_interface</span></tt></a>:</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">app</span><span class="o">.</span><span class="n">session_interface</span> <span class="o">=</span> <span class="n">MySessionInterface</span><span class="p">()</span>
+</pre></div>
+</div>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.8.</span></p>
+<dl class="method">
+<dt id="flask.sessions.SessionInterface.get_cookie_domain">
+<tt class="descname">get_cookie_domain</tt><big>(</big><em>app</em><big>)</big><a class="headerlink" href="#flask.sessions.SessionInterface.get_cookie_domain" title="Permalink to this definition">¶</a></dt>
+<dd><p>Helpful helper method that returns the cookie domain that should
+be used for the session cookie if session cookies are used.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.sessions.SessionInterface.get_cookie_httponly">
+<tt class="descname">get_cookie_httponly</tt><big>(</big><em>app</em><big>)</big><a class="headerlink" href="#flask.sessions.SessionInterface.get_cookie_httponly" title="Permalink to this definition">¶</a></dt>
+<dd><p>Returns True if the session cookie should be httponly. This
+currently just returns the value of the <tt class="docutils literal"><span class="pre">SESSION_COOKIE_HTTPONLY</span></tt>
+config var.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.sessions.SessionInterface.get_cookie_path">
+<tt class="descname">get_cookie_path</tt><big>(</big><em>app</em><big>)</big><a class="headerlink" href="#flask.sessions.SessionInterface.get_cookie_path" title="Permalink to this definition">¶</a></dt>
+<dd><p>Returns the path for which the cookie should be valid. The
+default implementation uses the value from the SESSION_COOKIE_PATH``
+config var if it&#8217;s set, and falls back to <tt class="docutils literal"><span class="pre">APPLICATION_ROOT</span></tt> or
+uses <tt class="docutils literal"><span class="pre">/</span></tt> if it&#8217;s <cite>None</cite>.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.sessions.SessionInterface.get_cookie_secure">
+<tt class="descname">get_cookie_secure</tt><big>(</big><em>app</em><big>)</big><a class="headerlink" href="#flask.sessions.SessionInterface.get_cookie_secure" title="Permalink to this definition">¶</a></dt>
+<dd><p>Returns True if the cookie should be secure. This currently
+just returns the value of the <tt class="docutils literal"><span class="pre">SESSION_COOKIE_SECURE</span></tt> setting.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.sessions.SessionInterface.get_expiration_time">
+<tt class="descname">get_expiration_time</tt><big>(</big><em>app</em>, <em>session</em><big>)</big><a class="headerlink" href="#flask.sessions.SessionInterface.get_expiration_time" title="Permalink to this definition">¶</a></dt>
+<dd><p>A helper method that returns an expiration date for the session
+or <cite>None</cite> if the session is linked to the browser session. The
+default implementation returns now + the permanent session
+lifetime configured on the application.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.sessions.SessionInterface.is_null_session">
+<tt class="descname">is_null_session</tt><big>(</big><em>obj</em><big>)</big><a class="headerlink" href="#flask.sessions.SessionInterface.is_null_session" title="Permalink to this definition">¶</a></dt>
+<dd><p>Checks if a given object is a null session. Null sessions are
+not asked to be saved.</p>
+<p>This checks if the object is an instance of <a class="reference internal" href="#flask.sessions.SessionInterface.null_session_class" title="flask.sessions.SessionInterface.null_session_class"><tt class="xref py py-attr docutils literal"><span class="pre">null_session_class</span></tt></a>
+by default.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.sessions.SessionInterface.make_null_session">
+<tt class="descname">make_null_session</tt><big>(</big><em>app</em><big>)</big><a class="headerlink" href="#flask.sessions.SessionInterface.make_null_session" title="Permalink to this definition">¶</a></dt>
+<dd><p>Creates a null session which acts as a replacement object if the
+real session support could not be loaded due to a configuration
+error. This mainly aids the user experience because the job of the
+null session is to still support lookup without complaining but
+modifications are answered with a helpful error message of what
+failed.</p>
+<p>This creates an instance of <a class="reference internal" href="#flask.sessions.SessionInterface.null_session_class" title="flask.sessions.SessionInterface.null_session_class"><tt class="xref py py-attr docutils literal"><span class="pre">null_session_class</span></tt></a> by default.</p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.sessions.SessionInterface.null_session_class">
+<tt class="descname">null_session_class</tt><a class="headerlink" href="#flask.sessions.SessionInterface.null_session_class" title="Permalink to this definition">¶</a></dt>
+<dd><p><a class="reference internal" href="#flask.sessions.SessionInterface.make_null_session" title="flask.sessions.SessionInterface.make_null_session"><tt class="xref py py-meth docutils literal"><span class="pre">make_null_session()</span></tt></a> will look here for the class that should
+be created when a null session is requested. Likewise the
+<a class="reference internal" href="#flask.sessions.SessionInterface.is_null_session" title="flask.sessions.SessionInterface.is_null_session"><tt class="xref py py-meth docutils literal"><span class="pre">is_null_session()</span></tt></a> method will perform a typecheck against
+this type.</p>
+<p>alias of <a class="reference internal" href="#flask.sessions.NullSession" title="flask.sessions.NullSession"><tt class="xref py py-class docutils literal"><span class="pre">NullSession</span></tt></a></p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.sessions.SessionInterface.open_session">
+<tt class="descname">open_session</tt><big>(</big><em>app</em>, <em>request</em><big>)</big><a class="headerlink" href="#flask.sessions.SessionInterface.open_session" title="Permalink to this definition">¶</a></dt>
+<dd><p>This method has to be implemented and must either return <cite>None</cite>
+in case the loading failed because of a configuration error or an
+instance of a session object which implements a dictionary like
+interface + the methods and attributes on <a class="reference internal" href="#flask.sessions.SessionMixin" title="flask.sessions.SessionMixin"><tt class="xref py py-class docutils literal"><span class="pre">SessionMixin</span></tt></a>.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.sessions.SessionInterface.save_session">
+<tt class="descname">save_session</tt><big>(</big><em>app</em>, <em>session</em>, <em>response</em><big>)</big><a class="headerlink" href="#flask.sessions.SessionInterface.save_session" title="Permalink to this definition">¶</a></dt>
+<dd><p>This is called for actual sessions returned by <a class="reference internal" href="#flask.sessions.SessionInterface.open_session" title="flask.sessions.SessionInterface.open_session"><tt class="xref py py-meth docutils literal"><span class="pre">open_session()</span></tt></a>
+at the end of the request. This is still called during a request
+context so if you absolutely need access to the request you can do
+that.</p>
+</dd></dl>
+
+</dd></dl>
+
+<dl class="class">
+<dt id="flask.sessions.SecureCookieSessionInterface">
+<em class="property">class </em><tt class="descclassname">flask.sessions.</tt><tt class="descname">SecureCookieSessionInterface</tt><a class="headerlink" href="#flask.sessions.SecureCookieSessionInterface" title="Permalink to this definition">¶</a></dt>
+<dd><p>The cookie session interface that uses the Werkzeug securecookie
+as client side session backend.</p>
+<dl class="attribute">
+<dt id="flask.sessions.SecureCookieSessionInterface.session_class">
+<tt class="descname">session_class</tt><a class="headerlink" href="#flask.sessions.SecureCookieSessionInterface.session_class" title="Permalink to this definition">¶</a></dt>
+<dd><p>alias of <tt class="xref py py-class docutils literal"><span class="pre">SecureCookieSession</span></tt></p>
+</dd></dl>
+
+</dd></dl>
+
+<dl class="class">
+<dt id="flask.sessions.NullSession">
+<em class="property">class </em><tt class="descclassname">flask.sessions.</tt><tt class="descname">NullSession</tt><big>(</big><em>data=None</em>, <em>secret_key=None</em>, <em>new=True</em><big>)</big><a class="headerlink" href="#flask.sessions.NullSession" title="Permalink to this definition">¶</a></dt>
+<dd><p>Class used to generate nicer error messages if sessions are not
+available. Will still allow read-only access to the empty session
+but fail on setting.</p>
+</dd></dl>
+
+<dl class="class">
+<dt id="flask.sessions.SessionMixin">
+<em class="property">class </em><tt class="descclassname">flask.sessions.</tt><tt class="descname">SessionMixin</tt><a class="headerlink" href="#flask.sessions.SessionMixin" title="Permalink to this definition">¶</a></dt>
+<dd><p>Expands a basic dictionary with an accessors that are expected
+by Flask extensions and users for the session.</p>
+<dl class="attribute">
+<dt id="flask.sessions.SessionMixin.modified">
+<tt class="descname">modified</tt><em class="property"> = True</em><a class="headerlink" href="#flask.sessions.SessionMixin.modified" title="Permalink to this definition">¶</a></dt>
+<dd><p>for some backends this will always be <cite>True</cite>, but some backends will
+default this to false and detect changes in the dictionary for as
+long as changes do not happen on mutable structures in the session.
+The default mixin implementation just hardcodes <cite>True</cite> in.</p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.sessions.SessionMixin.new">
+<tt class="descname">new</tt><em class="property"> = False</em><a class="headerlink" href="#flask.sessions.SessionMixin.new" title="Permalink to this definition">¶</a></dt>
+<dd><p>some session backends can tell you if a session is new, but that is
+not necessarily guaranteed. Use with caution. The default mixin
+implementation just hardcodes <cite>False</cite> in.</p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.sessions.SessionMixin.permanent">
+<tt class="descname">permanent</tt><a class="headerlink" href="#flask.sessions.SessionMixin.permanent" title="Permalink to this definition">¶</a></dt>
+<dd><p>this reflects the <tt class="docutils literal"><span class="pre">'_permanent'</span></tt> key in the dict.</p>
+</dd></dl>
+
+</dd></dl>
+
+<div class="admonition-notice admonition ">
+<p class="first admonition-title">Notice</p>
+<p class="last">The <tt class="docutils literal"><span class="pre">PERMANENT_SESSION_LIFETIME</span></tt> config key can also be an integer
+starting with Flask 0.8. Either catch this down yourself or use
+the <a class="reference internal" href="#flask.Flask.permanent_session_lifetime" title="flask.Flask.permanent_session_lifetime"><tt class="xref py py-attr docutils literal"><span class="pre">permanent_session_lifetime</span></tt></a> attribute on the
+app which converts the result to an integer automatically.</p>
+</div>
+</div>
+<div class="section" id="test-client">
+<h2>Test Client<a class="headerlink" href="#test-client" title="Permalink to this headline">¶</a></h2>
+<dl class="class">
+<dt id="flask.testing.FlaskClient">
+<em class="property">class </em><tt class="descclassname">flask.testing.</tt><tt class="descname">FlaskClient</tt><big>(</big><em>application</em>, <em>response_wrapper=None</em>, <em>use_cookies=True</em>, <em>allow_subdomain_redirects=False</em><big>)</big><a class="headerlink" href="#flask.testing.FlaskClient" title="Permalink to this definition">¶</a></dt>
+<dd><p>Works like a regular Werkzeug test client but has some knowledge about
+how Flask works to defer the cleanup of the request context stack to the
+end of a with body when used in a with statement. For general information
+about how to use this class refer to <a class="reference external" href="http://werkzeug.pocoo.org/docs/test/#werkzeug.test.Client" title="(in Werkzeug v0.7)"><tt class="xref py py-class docutils literal"><span class="pre">werkzeug.test.Client</span></tt></a>.</p>
+<p>Basic usage is outlined in the <a class="reference internal" href="testing.html#testing"><em>Testing Flask Applications</em></a> chapter.</p>
+<dl class="method">
+<dt id="flask.testing.FlaskClient.session_transaction">
+<tt class="descname">session_transaction</tt><big>(</big><em>*args</em>, <em>**kwds</em><big>)</big><a class="headerlink" href="#flask.testing.FlaskClient.session_transaction" title="Permalink to this definition">¶</a></dt>
+<dd><p>When used in combination with a with statement this opens a
+session transaction. This can be used to modify the session that
+the test client uses. Once the with block is left the session is
+stored back.</p>
+<blockquote>
+<div><dl class="docutils">
+<dt>with client.session_transaction() as session:</dt>
+<dd>session[&#8216;value&#8217;] = 42</dd>
+</dl>
+</div></blockquote>
+<p>Internally this is implemented by going through a temporary test
+request context and since session handling could depend on
+request variables this function accepts the same arguments as
+<a class="reference internal" href="#flask.Flask.test_request_context" title="flask.Flask.test_request_context"><tt class="xref py py-meth docutils literal"><span class="pre">test_request_context()</span></tt></a> which are directly
+passed through.</p>
+</dd></dl>
+
+</dd></dl>
+
+</div>
+<div class="section" id="application-globals">
+<h2>Application Globals<a class="headerlink" href="#application-globals" title="Permalink to this headline">¶</a></h2>
+<p>To share data that is valid for one request only from one function to
+another, a global variable is not good enough because it would break in
+threaded environments. Flask provides you with a special object that
+ensures it is only valid for the active request and that will return
+different values for each request. In a nutshell: it does the right
+thing, like it does for <a class="reference internal" href="#flask.request" title="flask.request"><tt class="xref py py-class docutils literal"><span class="pre">request</span></tt></a> and <a class="reference internal" href="#flask.session" title="flask.session"><tt class="xref py py-class docutils literal"><span class="pre">session</span></tt></a>.</p>
+<dl class="data">
+<dt id="flask.g">
+<tt class="descclassname">flask.</tt><tt class="descname">g</tt><a class="headerlink" href="#flask.g" title="Permalink to this definition">¶</a></dt>
+<dd><p>Just store on this whatever you want. For example a database
+connection or the user that is currently logged in.</p>
+<p>This is a proxy. See <a class="reference internal" href="reqcontext.html#notes-on-proxies"><em>Notes On Proxies</em></a> for more information.</p>
+</dd></dl>
+
+</div>
+<div class="section" id="useful-functions-and-classes">
+<h2>Useful Functions and Classes<a class="headerlink" href="#useful-functions-and-classes" title="Permalink to this headline">¶</a></h2>
+<dl class="data">
+<dt id="flask.current_app">
+<tt class="descclassname">flask.</tt><tt class="descname">current_app</tt><a class="headerlink" href="#flask.current_app" title="Permalink to this definition">¶</a></dt>
+<dd><p>Points to the application handling the request. This is useful for
+extensions that want to support multiple applications running side
+by side.</p>
+<p>This is a proxy. See <a class="reference internal" href="reqcontext.html#notes-on-proxies"><em>Notes On Proxies</em></a> for more information.</p>
+</dd></dl>
+
+<dl class="function">
+<dt id="flask.has_request_context">
+<tt class="descclassname">flask.</tt><tt class="descname">has_request_context</tt><big>(</big><big>)</big><a class="headerlink" href="#flask.has_request_context" title="Permalink to this definition">¶</a></dt>
+<dd><p>If you have code that wants to test if a request context is there or
+not this function can be used. For instance if you want to take advantage
+of request information is it&#8217;s available but fail silently if the request
+object is unavailable.</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">class</span> <span class="nc">User</span><span class="p">(</span><span class="n">db</span><span class="o">.</span><span class="n">Model</span><span class="p">):</span>
+
+ <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">username</span><span class="p">,</span> <span class="n">remote_addr</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">username</span> <span class="o">=</span> <span class="n">username</span>
+ <span class="k">if</span> <span class="n">remote_addr</span> <span class="ow">is</span> <span class="bp">None</span> <span class="ow">and</span> <span class="n">has_request_context</span><span class="p">():</span>
+ <span class="n">remote_addr</span> <span class="o">=</span> <span class="n">request</span><span class="o">.</span><span class="n">remote_addr</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">remote_addr</span> <span class="o">=</span> <span class="n">remote_addr</span>
+</pre></div>
+</div>
+<p>Alternatively you can also just test any of the context bound objects
+(such as <a class="reference internal" href="#flask.request" title="flask.request"><tt class="xref py py-class docutils literal"><span class="pre">request</span></tt></a> or <a class="reference internal" href="#flask.g" title="flask.g"><tt class="xref py py-class docutils literal"><span class="pre">g</span></tt></a> for truthness):</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">class</span> <span class="nc">User</span><span class="p">(</span><span class="n">db</span><span class="o">.</span><span class="n">Model</span><span class="p">):</span>
+
+ <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">username</span><span class="p">,</span> <span class="n">remote_addr</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">username</span> <span class="o">=</span> <span class="n">username</span>
+ <span class="k">if</span> <span class="n">remote_addr</span> <span class="ow">is</span> <span class="bp">None</span> <span class="ow">and</span> <span class="n">request</span><span class="p">:</span>
+ <span class="n">remote_addr</span> <span class="o">=</span> <span class="n">request</span><span class="o">.</span><span class="n">remote_addr</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">remote_addr</span> <span class="o">=</span> <span class="n">remote_addr</span>
+</pre></div>
+</div>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.7.</span></p>
+</dd></dl>
+
+<dl class="function">
+<dt id="flask.url_for">
+<tt class="descclassname">flask.</tt><tt class="descname">url_for</tt><big>(</big><em>endpoint</em>, <em>**values</em><big>)</big><a class="headerlink" href="#flask.url_for" title="Permalink to this definition">¶</a></dt>
+<dd><p>Generates a URL to the given endpoint with the method provided.</p>
+<p>Variable arguments that are unknown to the target endpoint are appended
+to the generated URL as query arguments. If the value of a query argument
+is <cite>None</cite>, the whole pair is skipped. In case blueprints are active
+you can shortcut references to the same blueprint by prefixing the
+local endpoint with a dot (<tt class="docutils literal"><span class="pre">.</span></tt>).</p>
+<p>This will reference the index function local to the current blueprint:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="n">url_for</span><span class="p">(</span><span class="s">&#39;.index&#39;</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>For more information, head over to the <a class="reference internal" href="quickstart.html#url-building"><em>Quickstart</em></a>.</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>endpoint</strong> &#8211; the endpoint of the URL (name of the function)</li>
+<li><strong>values</strong> &#8211; the variable arguments of the URL rule</li>
+<li><strong>_external</strong> &#8211; if set to <cite>True</cite>, an absolute URL is generated.</li>
+</ul>
+</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="function">
+<dt id="flask.abort">
+<tt class="descclassname">flask.</tt><tt class="descname">abort</tt><big>(</big><em>code</em><big>)</big><a class="headerlink" href="#flask.abort" title="Permalink to this definition">¶</a></dt>
+<dd><p>Raises an <a class="reference external" href="http://werkzeug.pocoo.org/docs/exceptions/#werkzeug.exceptions.HTTPException" title="(in Werkzeug v0.7)"><tt class="xref py py-exc docutils literal"><span class="pre">HTTPException</span></tt></a> for the given
+status code. For example to abort request handling with a page not
+found exception, you would call <tt class="docutils literal"><span class="pre">abort(404)</span></tt>.</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>code</strong> &#8211; the HTTP error code.</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="function">
+<dt id="flask.redirect">
+<tt class="descclassname">flask.</tt><tt class="descname">redirect</tt><big>(</big><em>location</em>, <em>code=302</em><big>)</big><a class="headerlink" href="#flask.redirect" title="Permalink to this definition">¶</a></dt>
+<dd><p>Return a response object (a WSGI application) that, if called,
+redirects the client to the target location. Supported codes are 301,
+302, 303, 305, and 307. 300 is not supported because it&#8217;s not a real
+redirect and 304 because it&#8217;s the answer for a request with a request
+with defined If-Modified-Since headers.</p>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.6: </span>The location can now be a unicode string that is encoded using
+the <tt class="xref py py-func docutils literal"><span class="pre">iri_to_uri()</span></tt> function.</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>location</strong> &#8211; the location the response should redirect to.</li>
+<li><strong>code</strong> &#8211; the redirect status code. defaults to 302.</li>
+</ul>
+</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="function">
+<dt id="flask.make_response">
+<tt class="descclassname">flask.</tt><tt class="descname">make_response</tt><big>(</big><em>*args</em><big>)</big><a class="headerlink" href="#flask.make_response" title="Permalink to this definition">¶</a></dt>
+<dd><p>Sometimes it is necessary to set additional headers in a view. Because
+views do not have to return response objects but can return a value that
+is converted into a response object by Flask itself, it becomes tricky to
+add headers to it. This function can be called instead of using a return
+and you will get a response object which you can use to attach headers.</p>
+<p>If view looked like this and you want to add a new header:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">def</span> <span class="nf">index</span><span class="p">():</span>
+ <span class="k">return</span> <span class="n">render_template</span><span class="p">(</span><span class="s">&#39;index.html&#39;</span><span class="p">,</span> <span class="n">foo</span><span class="o">=</span><span class="mi">42</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>You can now do something like this:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">def</span> <span class="nf">index</span><span class="p">():</span>
+ <span class="n">response</span> <span class="o">=</span> <span class="n">make_response</span><span class="p">(</span><span class="n">render_template</span><span class="p">(</span><span class="s">&#39;index.html&#39;</span><span class="p">,</span> <span class="n">foo</span><span class="o">=</span><span class="mi">42</span><span class="p">))</span>
+ <span class="n">response</span><span class="o">.</span><span class="n">headers</span><span class="p">[</span><span class="s">&#39;X-Parachutes&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&#39;parachutes are cool&#39;</span>
+ <span class="k">return</span> <span class="n">response</span>
+</pre></div>
+</div>
+<p>This function accepts the very same arguments you can return from a
+view function. This for example creates a response with a 404 error
+code:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="n">response</span> <span class="o">=</span> <span class="n">make_response</span><span class="p">(</span><span class="n">render_template</span><span class="p">(</span><span class="s">&#39;not_found.html&#39;</span><span class="p">),</span> <span class="mi">404</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>The other use case of this function is to force the return value of a
+view function into a response which is helpful with view
+decorators:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="n">response</span> <span class="o">=</span> <span class="n">make_response</span><span class="p">(</span><span class="n">view_function</span><span class="p">())</span>
+<span class="n">response</span><span class="o">.</span><span class="n">headers</span><span class="p">[</span><span class="s">&#39;X-Parachutes&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&#39;parachutes are cool&#39;</span>
+</pre></div>
+</div>
+<p>Internally this function does the following things:</p>
+<ul class="simple">
+<li>if no arguments are passed, it creates a new response argument</li>
+<li>if one argument is passed, <a class="reference internal" href="#flask.Flask.make_response" title="flask.Flask.make_response"><tt class="xref py py-meth docutils literal"><span class="pre">flask.Flask.make_response()</span></tt></a>
+is invoked with it.</li>
+<li>if more than one argument is passed, the arguments are passed
+to the <a class="reference internal" href="#flask.Flask.make_response" title="flask.Flask.make_response"><tt class="xref py py-meth docutils literal"><span class="pre">flask.Flask.make_response()</span></tt></a> function as tuple.</li>
+</ul>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.6.</span></p>
+</dd></dl>
+
+<dl class="function">
+<dt id="flask.send_file">
+<tt class="descclassname">flask.</tt><tt class="descname">send_file</tt><big>(</big><em>filename_or_fp</em>, <em>mimetype=None</em>, <em>as_attachment=False</em>, <em>attachment_filename=None</em>, <em>add_etags=True</em>, <em>cache_timeout=43200</em>, <em>conditional=False</em><big>)</big><a class="headerlink" href="#flask.send_file" title="Permalink to this definition">¶</a></dt>
+<dd><p>Sends the contents of a file to the client. This will use the
+most efficient method available and configured. By default it will
+try to use the WSGI server&#8217;s file_wrapper support. Alternatively
+you can set the application&#8217;s <a class="reference internal" href="#flask.Flask.use_x_sendfile" title="flask.Flask.use_x_sendfile"><tt class="xref py py-attr docutils literal"><span class="pre">use_x_sendfile</span></tt></a> attribute
+to <tt class="docutils literal"><span class="pre">True</span></tt> to directly emit an <cite>X-Sendfile</cite> header. This however
+requires support of the underlying webserver for <cite>X-Sendfile</cite>.</p>
+<p>By default it will try to guess the mimetype for you, but you can
+also explicitly provide one. For extra security you probably want
+to send certain files as attachment (HTML for instance). The mimetype
+guessing requires a <cite>filename</cite> or an <cite>attachment_filename</cite> to be
+provided.</p>
+<p>Please never pass filenames to this function from user sources without
+checking them first. Something like this is usually sufficient to
+avoid security problems:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">if</span> <span class="s">&#39;..&#39;</span> <span class="ow">in</span> <span class="n">filename</span> <span class="ow">or</span> <span class="n">filename</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="s">&#39;/&#39;</span><span class="p">):</span>
+ <span class="n">abort</span><span class="p">(</span><span class="mi">404</span><span class="p">)</span>
+</pre></div>
+</div>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.2.</span></p>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.5: </span>The <cite>add_etags</cite>, <cite>cache_timeout</cite> and <cite>conditional</cite> parameters were
+added. The default behaviour is now to attach etags.</p>
+<p class="versionchanged">
+<span class="versionmodified">Changed in version 0.7: </span>mimetype guessing and etag support for file objects was
+deprecated because it was unreliable. Pass a filename if you are
+able to, otherwise attach an etag yourself. This functionality
+will be removed in Flask 1.0</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>filename_or_fp</strong> &#8211; the filename of the file to send. This is
+relative to the <tt class="xref py py-attr docutils literal"><span class="pre">root_path</span></tt> if a
+relative path is specified.
+Alternatively a file object might be provided
+in which case <cite>X-Sendfile</cite> might not work and
+fall back to the traditional method. Make sure
+that the file pointer is positioned at the start
+of data to send before calling <a class="reference internal" href="#flask.send_file" title="flask.send_file"><tt class="xref py py-func docutils literal"><span class="pre">send_file()</span></tt></a>.</li>
+<li><strong>mimetype</strong> &#8211; the mimetype of the file if provided, otherwise
+auto detection happens.</li>
+<li><strong>as_attachment</strong> &#8211; set to <cite>True</cite> if you want to send this file with
+a <tt class="docutils literal"><span class="pre">Content-Disposition:</span> <span class="pre">attachment</span></tt> header.</li>
+<li><strong>attachment_filename</strong> &#8211; the filename for the attachment if it
+differs from the file&#8217;s filename.</li>
+<li><strong>add_etags</strong> &#8211; set to <cite>False</cite> to disable attaching of etags.</li>
+<li><strong>conditional</strong> &#8211; set to <cite>True</cite> to enable conditional responses.</li>
+<li><strong>cache_timeout</strong> &#8211; the timeout in seconds for the headers.</li>
+</ul>
+</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="function">
+<dt id="flask.send_from_directory">
+<tt class="descclassname">flask.</tt><tt class="descname">send_from_directory</tt><big>(</big><em>directory</em>, <em>filename</em>, <em>**options</em><big>)</big><a class="headerlink" href="#flask.send_from_directory" title="Permalink to this definition">¶</a></dt>
+<dd><p>Send a file from a given directory with <a class="reference internal" href="#flask.send_file" title="flask.send_file"><tt class="xref py py-func docutils literal"><span class="pre">send_file()</span></tt></a>. This
+is a secure way to quickly expose static files from an upload folder
+or something similar.</p>
+<p>Example usage:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/uploads/&lt;path:filename&gt;&#39;</span><span class="p">)</span>
+<span class="k">def</span> <span class="nf">download_file</span><span class="p">(</span><span class="n">filename</span><span class="p">):</span>
+ <span class="k">return</span> <span class="n">send_from_directory</span><span class="p">(</span><span class="n">app</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s">&#39;UPLOAD_FOLDER&#39;</span><span class="p">],</span>
+ <span class="n">filename</span><span class="p">,</span> <span class="n">as_attachment</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
+</pre></div>
+</div>
+<div class="admonition-sending-files-and-performance admonition ">
+<p class="first admonition-title">Sending files and Performance</p>
+<p class="last">It is strongly recommended to activate either <cite>X-Sendfile</cite> support in
+your webserver or (if no authentication happens) to tell the webserver
+to serve files for the given path on its own without calling into the
+web application for improved performance.</p>
+</div>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.5.</span></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>directory</strong> &#8211; the directory where all the files are stored.</li>
+<li><strong>filename</strong> &#8211; the filename relative to that directory to
+download.</li>
+<li><strong>options</strong> &#8211; optional keyword arguments that are directly
+forwarded to <a class="reference internal" href="#flask.send_file" title="flask.send_file"><tt class="xref py py-func docutils literal"><span class="pre">send_file()</span></tt></a>.</li>
+</ul>
+</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="function">
+<dt id="flask.safe_join">
+<tt class="descclassname">flask.</tt><tt class="descname">safe_join</tt><big>(</big><em>directory</em>, <em>filename</em><big>)</big><a class="headerlink" href="#flask.safe_join" title="Permalink to this definition">¶</a></dt>
+<dd><p>Safely join <cite>directory</cite> and <cite>filename</cite>.</p>
+<p>Example usage:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/wiki/&lt;path:filename&gt;&#39;</span><span class="p">)</span>
+<span class="k">def</span> <span class="nf">wiki_page</span><span class="p">(</span><span class="n">filename</span><span class="p">):</span>
+ <span class="n">filename</span> <span class="o">=</span> <span class="n">safe_join</span><span class="p">(</span><span class="n">app</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s">&#39;WIKI_FOLDER&#39;</span><span class="p">],</span> <span class="n">filename</span><span class="p">)</span>
+ <span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">filename</span><span class="p">,</span> <span class="s">&#39;rb&#39;</span><span class="p">)</span> <span class="k">as</span> <span class="n">fd</span><span class="p">:</span>
+ <span class="n">content</span> <span class="o">=</span> <span class="n">fd</span><span class="o">.</span><span class="n">read</span><span class="p">()</span> <span class="c"># Read and process the file content...</span>
+</pre></div>
+</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"><ul class="first simple">
+<li><strong>directory</strong> &#8211; the base directory.</li>
+<li><strong>filename</strong> &#8211; the untrusted filename relative to that directory.</li>
+</ul>
+</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Raises :</th><td class="field-body"><p class="first last"><tt class="xref py py-class docutils literal"><span class="pre">NotFound</span></tt> if the resulting path
+would fall out of <cite>directory</cite>.</p>
+</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="function">
+<dt id="flask.escape">
+<tt class="descclassname">flask.</tt><tt class="descname">escape</tt><big>(</big><em>s</em><big>)</big> &rarr; markup<a class="headerlink" href="#flask.escape" title="Permalink to this definition">¶</a></dt>
+<dd><p>Convert the characters &amp;, &lt;, &gt;, &#8216;, and &#8221; in string s to HTML-safe
+sequences. Use this if you need to display text that might contain
+such characters in HTML. Marks return value as markup string.</p>
+</dd></dl>
+
+<dl class="class">
+<dt id="flask.Markup">
+<em class="property">class </em><tt class="descclassname">flask.</tt><tt class="descname">Markup</tt><a class="headerlink" href="#flask.Markup" title="Permalink to this definition">¶</a></dt>
+<dd><p>Marks a string as being safe for inclusion in HTML/XML output without
+needing to be escaped. This implements the <cite>__html__</cite> interface a couple
+of frameworks and web applications use. <a class="reference internal" href="#flask.Markup" title="flask.Markup"><tt class="xref py py-class docutils literal"><span class="pre">Markup</span></tt></a> is a direct
+subclass of <cite>unicode</cite> and provides all the methods of <cite>unicode</cite> just that
+it escapes arguments passed and always returns <cite>Markup</cite>.</p>
+<p>The <cite>escape</cite> function returns markup objects so that double escaping can&#8217;t
+happen.</p>
+<p>The constructor of the <a class="reference internal" href="#flask.Markup" title="flask.Markup"><tt class="xref py py-class docutils literal"><span class="pre">Markup</span></tt></a> class can be used for three
+different things: When passed an unicode object it&#8217;s assumed to be safe,
+when passed an object with an HTML representation (has an <cite>__html__</cite>
+method) that representation is used, otherwise the object passed is
+converted into a unicode string and then assumed to be safe:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">Markup</span><span class="p">(</span><span class="s">&quot;Hello &lt;em&gt;World&lt;/em&gt;!&quot;</span><span class="p">)</span>
+<span class="go">Markup(u&#39;Hello &lt;em&gt;World&lt;/em&gt;!&#39;)</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="k">class</span> <span class="nc">Foo</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
+<span class="gp">... </span> <span class="k">def</span> <span class="nf">__html__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+<span class="gp">... </span> <span class="k">return</span> <span class="s">&#39;&lt;a href=&quot;#&quot;&gt;foo&lt;/a&gt;&#39;</span>
+<span class="gp">... </span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">Markup</span><span class="p">(</span><span class="n">Foo</span><span class="p">())</span>
+<span class="go">Markup(u&#39;&lt;a href=&quot;#&quot;&gt;foo&lt;/a&gt;&#39;)</span>
+</pre></div>
+</div>
+<p>If you want object passed being always treated as unsafe you can use the
+<a class="reference internal" href="#flask.escape" title="flask.escape"><tt class="xref py py-meth docutils literal"><span class="pre">escape()</span></tt></a> classmethod to create a <a class="reference internal" href="#flask.Markup" title="flask.Markup"><tt class="xref py py-class docutils literal"><span class="pre">Markup</span></tt></a> object:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">Markup</span><span class="o">.</span><span class="n">escape</span><span class="p">(</span><span class="s">&quot;Hello &lt;em&gt;World&lt;/em&gt;!&quot;</span><span class="p">)</span>
+<span class="go">Markup(u&#39;Hello &amp;lt;em&amp;gt;World&amp;lt;/em&amp;gt;!&#39;)</span>
+</pre></div>
+</div>
+<p>Operations on a markup string are markup aware which means that all
+arguments are passed through the <a class="reference internal" href="#flask.escape" title="flask.escape"><tt class="xref py py-func docutils literal"><span class="pre">escape()</span></tt></a> function:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">em</span> <span class="o">=</span> <span class="n">Markup</span><span class="p">(</span><span class="s">&quot;&lt;em&gt;</span><span class="si">%s</span><span class="s">&lt;/em&gt;&quot;</span><span class="p">)</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">em</span> <span class="o">%</span> <span class="s">&quot;foo &amp; bar&quot;</span>
+<span class="go">Markup(u&#39;&lt;em&gt;foo &amp;amp; bar&lt;/em&gt;&#39;)</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">strong</span> <span class="o">=</span> <span class="n">Markup</span><span class="p">(</span><span class="s">&quot;&lt;strong&gt;</span><span class="si">%(text)s</span><span class="s">&lt;/strong&gt;&quot;</span><span class="p">)</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">strong</span> <span class="o">%</span> <span class="p">{</span><span class="s">&#39;text&#39;</span><span class="p">:</span> <span class="s">&#39;&lt;blink&gt;hacker here&lt;/blink&gt;&#39;</span><span class="p">}</span>
+<span class="go">Markup(u&#39;&lt;strong&gt;&amp;lt;blink&amp;gt;hacker here&amp;lt;/blink&amp;gt;&lt;/strong&gt;&#39;)</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">Markup</span><span class="p">(</span><span class="s">&quot;&lt;em&gt;Hello&lt;/em&gt; &quot;</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot;&lt;foo&gt;&quot;</span>
+<span class="go">Markup(u&#39;&lt;em&gt;Hello&lt;/em&gt; &amp;lt;foo&amp;gt;&#39;)</span>
+</pre></div>
+</div>
+<dl class="classmethod">
+<dt id="flask.Markup.escape">
+<em class="property">classmethod </em><tt class="descname">escape</tt><big>(</big><em>s</em><big>)</big><a class="headerlink" href="#flask.Markup.escape" title="Permalink to this definition">¶</a></dt>
+<dd><p>Escape the string. Works like <a class="reference internal" href="#flask.escape" title="flask.escape"><tt class="xref py py-func docutils literal"><span class="pre">escape()</span></tt></a> with the difference
+that for subclasses of <a class="reference internal" href="#flask.Markup" title="flask.Markup"><tt class="xref py py-class docutils literal"><span class="pre">Markup</span></tt></a> this function would return the
+correct subclass.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Markup.unescape">
+<tt class="descname">unescape</tt><big>(</big><big>)</big><a class="headerlink" href="#flask.Markup.unescape" title="Permalink to this definition">¶</a></dt>
+<dd><p>Unescape markup again into an unicode string. This also resolves
+known HTML4 and XHTML entities:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">Markup</span><span class="p">(</span><span class="s">&quot;Main &amp;raquo; &lt;em&gt;About&lt;/em&gt;&quot;</span><span class="p">)</span><span class="o">.</span><span class="n">unescape</span><span class="p">()</span>
+<span class="go">u&#39;Main \xbb &lt;em&gt;About&lt;/em&gt;&#39;</span>
+</pre></div>
+</div>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Markup.striptags">
+<tt class="descname">striptags</tt><big>(</big><big>)</big><a class="headerlink" href="#flask.Markup.striptags" title="Permalink to this definition">¶</a></dt>
+<dd><p>Unescape markup into an unicode string and strip all tags. This
+also resolves known HTML4 and XHTML entities. Whitespace is
+normalized to one:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">Markup</span><span class="p">(</span><span class="s">&quot;Main &amp;raquo; &lt;em&gt;About&lt;/em&gt;&quot;</span><span class="p">)</span><span class="o">.</span><span class="n">striptags</span><span class="p">()</span>
+<span class="go">u&#39;Main \xbb About&#39;</span>
+</pre></div>
+</div>
+</dd></dl>
+
+</dd></dl>
+
+</div>
+<div class="section" id="message-flashing">
+<h2>Message Flashing<a class="headerlink" href="#message-flashing" title="Permalink to this headline">¶</a></h2>
+<dl class="function">
+<dt id="flask.flash">
+<tt class="descclassname">flask.</tt><tt class="descname">flash</tt><big>(</big><em>message</em>, <em>category='message'</em><big>)</big><a class="headerlink" href="#flask.flash" title="Permalink to this definition">¶</a></dt>
+<dd><p>Flashes a message to the next request. In order to remove the
+flashed message from the session and to display it to the user,
+the template has to call <a class="reference internal" href="#flask.get_flashed_messages" title="flask.get_flashed_messages"><tt class="xref py py-func docutils literal"><span class="pre">get_flashed_messages()</span></tt></a>.</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>message</strong> &#8211; the message to be flashed.</li>
+<li><strong>category</strong> &#8211; the category for the message. The following values
+are recommended: <tt class="docutils literal"><span class="pre">'message'</span></tt> for any kind of message,
+<tt class="docutils literal"><span class="pre">'error'</span></tt> for errors, <tt class="docutils literal"><span class="pre">'info'</span></tt> for information
+messages and <tt class="docutils literal"><span class="pre">'warning'</span></tt> for warnings. However any
+kind of string can be used as category.</li>
+</ul>
+</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="function">
+<dt id="flask.get_flashed_messages">
+<tt class="descclassname">flask.</tt><tt class="descname">get_flashed_messages</tt><big>(</big><em>with_categories=False</em><big>)</big><a class="headerlink" href="#flask.get_flashed_messages" title="Permalink to this definition">¶</a></dt>
+<dd><p>Pulls all flashed messages from the session and returns them.
+Further calls in the same request to the function will return
+the same messages. By default just the messages are returned,
+but when <cite>with_categories</cite> is set to <cite>True</cite>, the return value will
+be a list of tuples in the form <tt class="docutils literal"><span class="pre">(category,</span> <span class="pre">message)</span></tt> instead.</p>
+<p>Example usage:</p>
+<div class="highlight-html+jinja"><div class="highlight"><pre><span class="cp">{%</span> <span class="k">for</span> <span class="nv">category</span><span class="o">,</span> <span class="nv">msg</span> <span class="k">in</span> <span class="nv">get_flashed_messages</span><span class="o">(</span><span class="nv">with_categories</span><span class="o">=</span><span class="kp">true</span><span class="o">)</span> <span class="cp">%}</span>
+ <span class="nt">&lt;p</span> <span class="na">class=</span><span class="s">flash-</span><span class="cp">{{</span> <span class="nv">category</span> <span class="cp">}}</span><span class="nt">&gt;</span><span class="cp">{{</span> <span class="nv">msg</span> <span class="cp">}}</span>
+<span class="cp">{%</span> <span class="k">endfor</span> <span class="cp">%}</span>
+</pre></div>
+</div>
+<p class="versionchanged">
+<span class="versionmodified">Changed in version 0.3: </span><cite>with_categories</cite> parameter added.</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>with_categories</strong> &#8211; set to <cite>True</cite> to also receive categories.</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+</div>
+<div class="section" id="returning-json">
+<h2>Returning JSON<a class="headerlink" href="#returning-json" title="Permalink to this headline">¶</a></h2>
+<dl class="function">
+<dt id="flask.jsonify">
+<tt class="descclassname">flask.</tt><tt class="descname">jsonify</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#flask.jsonify" title="Permalink to this definition">¶</a></dt>
+<dd><p>Creates a <a class="reference internal" href="#flask.Response" title="flask.Response"><tt class="xref py py-class docutils literal"><span class="pre">Response</span></tt></a> with the JSON representation of
+the given arguments with an <cite>application/json</cite> mimetype. The arguments
+to this function are the same as to the <a class="reference external" href="http://docs.python.org/dev/library/stdtypes.html#dict" title="(in Python v3.3)"><tt class="xref py py-class docutils literal"><span class="pre">dict</span></tt></a> constructor.</p>
+<p>Example usage:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/_get_current_user&#39;</span><span class="p">)</span>
+<span class="k">def</span> <span class="nf">get_current_user</span><span class="p">():</span>
+ <span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">username</span><span class="o">=</span><span class="n">g</span><span class="o">.</span><span class="n">user</span><span class="o">.</span><span class="n">username</span><span class="p">,</span>
+ <span class="n">email</span><span class="o">=</span><span class="n">g</span><span class="o">.</span><span class="n">user</span><span class="o">.</span><span class="n">email</span><span class="p">,</span>
+ <span class="nb">id</span><span class="o">=</span><span class="n">g</span><span class="o">.</span><span class="n">user</span><span class="o">.</span><span class="n">id</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>This will send a JSON response like this to the browser:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="p">{</span>
+ <span class="s">&quot;username&quot;</span><span class="p">:</span> <span class="s">&quot;admin&quot;</span><span class="p">,</span>
+ <span class="s">&quot;email&quot;</span><span class="p">:</span> <span class="s">&quot;admin@localhost&quot;</span><span class="p">,</span>
+ <span class="s">&quot;id&quot;</span><span class="p">:</span> <span class="mi">42</span>
+<span class="p">}</span>
+</pre></div>
+</div>
+<p>This requires Python 2.6 or an installed version of simplejson. For
+security reasons only objects are supported toplevel. For more
+information about this, have a look at <a class="reference internal" href="security.html#json-security"><em>JSON Security</em></a>.</p>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.2.</span></p>
+</dd></dl>
+
+<dl class="data">
+<dt id="flask.json">
+<tt class="descclassname">flask.</tt><tt class="descname">json</tt><a class="headerlink" href="#flask.json" title="Permalink to this definition">¶</a></dt>
+<dd><p>If JSON support is picked up, this will be the module that Flask is
+using to parse and serialize JSON. So instead of doing this yourself:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">try</span><span class="p">:</span>
+ <span class="kn">import</span> <span class="nn">simplejson</span> <span class="kn">as</span> <span class="nn">json</span>
+<span class="k">except</span> <span class="ne">ImportError</span><span class="p">:</span>
+ <span class="kn">import</span> <span class="nn">json</span>
+</pre></div>
+</div>
+<p>You can instead just do this:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">json</span>
+</pre></div>
+</div>
+<p>For usage examples, read the <a class="reference external" href="http://docs.python.org/dev/library/json.html#json" title="(in Python v3.3)"><tt class="xref py py-mod docutils literal"><span class="pre">json</span></tt></a> documentation.</p>
+<p>The <a class="reference external" href="http://docs.python.org/dev/library/json.html#json.dumps" title="(in Python v3.3)"><tt class="xref py py-func docutils literal"><span class="pre">dumps()</span></tt></a> function of this json module is also available
+as filter called <tt class="docutils literal"><span class="pre">|tojson</span></tt> in Jinja2. Note that inside <cite>script</cite>
+tags no escaping must take place, so make sure to disable escaping
+with <tt class="docutils literal"><span class="pre">|safe</span></tt> if you intend to use it inside <cite>script</cite> tags:</p>
+<div class="highlight-html+jinja"><div class="highlight"><pre><span class="nt">&lt;script </span><span class="na">type=</span><span class="s">text/javascript</span><span class="nt">&gt;</span>
+ <span class="nx">doSomethingWith</span><span class="p">(</span><span class="cp">{{</span> <span class="nv">user.username</span><span class="o">|</span><span class="nf">tojson</span><span class="o">|</span><span class="nf">safe</span> <span class="cp">}}</span><span class="p">);</span>
+<span class="nt">&lt;/script&gt;</span>
+</pre></div>
+</div>
+<p>Note that the <tt class="docutils literal"><span class="pre">|tojson</span></tt> filter escapes forward slashes properly.</p>
+</dd></dl>
+
+</div>
+<div class="section" id="template-rendering">
+<h2>Template Rendering<a class="headerlink" href="#template-rendering" title="Permalink to this headline">¶</a></h2>
+<dl class="function">
+<dt id="flask.render_template">
+<tt class="descclassname">flask.</tt><tt class="descname">render_template</tt><big>(</big><em>template_name</em>, <em>**context</em><big>)</big><a class="headerlink" href="#flask.render_template" title="Permalink to this definition">¶</a></dt>
+<dd><p>Renders a template from the template folder with the given
+context.</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>template_name</strong> &#8211; the name of the template to be rendered</li>
+<li><strong>context</strong> &#8211; the variables that should be available in the
+context of the template.</li>
+</ul>
+</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="function">
+<dt id="flask.render_template_string">
+<tt class="descclassname">flask.</tt><tt class="descname">render_template_string</tt><big>(</big><em>source</em>, <em>**context</em><big>)</big><a class="headerlink" href="#flask.render_template_string" title="Permalink to this definition">¶</a></dt>
+<dd><p>Renders a template from the given template source string
+with the given context.</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>template_name</strong> &#8211; the sourcecode of the template to be
+rendered</li>
+<li><strong>context</strong> &#8211; the variables that should be available in the
+context of the template.</li>
+</ul>
+</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="function">
+<dt id="flask.get_template_attribute">
+<tt class="descclassname">flask.</tt><tt class="descname">get_template_attribute</tt><big>(</big><em>template_name</em>, <em>attribute</em><big>)</big><a class="headerlink" href="#flask.get_template_attribute" title="Permalink to this definition">¶</a></dt>
+<dd><p>Loads a macro (or variable) a template exports. This can be used to
+invoke a macro from within Python code. If you for example have a
+template named <cite>_cider.html</cite> with the following contents:</p>
+<div class="highlight-html+jinja"><div class="highlight"><pre><span class="cp">{%</span> <span class="k">macro</span> <span class="nv">hello</span><span class="o">(</span><span class="nv">name</span><span class="o">)</span> <span class="cp">%}</span>Hello <span class="cp">{{</span> <span class="nv">name</span> <span class="cp">}}</span>!<span class="cp">{%</span> <span class="k">endmacro</span> <span class="cp">%}</span>
+</pre></div>
+</div>
+<p>You can access this from Python code like this:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="n">hello</span> <span class="o">=</span> <span class="n">get_template_attribute</span><span class="p">(</span><span class="s">&#39;_cider.html&#39;</span><span class="p">,</span> <span class="s">&#39;hello&#39;</span><span class="p">)</span>
+<span class="k">return</span> <span class="n">hello</span><span class="p">(</span><span class="s">&#39;World&#39;</span><span class="p">)</span>
+</pre></div>
+</div>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.2.</span></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>template_name</strong> &#8211; the name of the template</li>
+<li><strong>attribute</strong> &#8211; the name of the variable of macro to acccess</li>
+</ul>
+</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+</div>
+<div class="section" id="configuration">
+<h2>Configuration<a class="headerlink" href="#configuration" title="Permalink to this headline">¶</a></h2>
+<dl class="class">
+<dt id="flask.Config">
+<em class="property">class </em><tt class="descclassname">flask.</tt><tt class="descname">Config</tt><big>(</big><em>root_path</em>, <em>defaults=None</em><big>)</big><a class="headerlink" href="#flask.Config" title="Permalink to this definition">¶</a></dt>
+<dd><p>Works exactly like a dict but provides ways to fill it from files
+or special dictionaries. There are two common patterns to populate the
+config.</p>
+<p>Either you can fill the config from a config file:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="n">app</span><span class="o">.</span><span class="n">config</span><span class="o">.</span><span class="n">from_pyfile</span><span class="p">(</span><span class="s">&#39;yourconfig.cfg&#39;</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>Or alternatively you can define the configuration options in the
+module that calls <a class="reference internal" href="#flask.Config.from_object" title="flask.Config.from_object"><tt class="xref py py-meth docutils literal"><span class="pre">from_object()</span></tt></a> or provide an import path to
+a module that should be loaded. It is also possible to tell it to
+use the same module and with that provide the configuration values
+just before the call:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="n">DEBUG</span> <span class="o">=</span> <span class="bp">True</span>
+<span class="n">SECRET_KEY</span> <span class="o">=</span> <span class="s">&#39;development key&#39;</span>
+<span class="n">app</span><span class="o">.</span><span class="n">config</span><span class="o">.</span><span class="n">from_object</span><span class="p">(</span><span class="n">__name__</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>In both cases (loading from any Python file or loading from modules),
+only uppercase keys are added to the config. This makes it possible to use
+lowercase values in the config file for temporary values that are not added
+to the config or to define the config keys in the same file that implements
+the application.</p>
+<p>Probably the most interesting way to load configurations is from an
+environment variable pointing to a file:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="n">app</span><span class="o">.</span><span class="n">config</span><span class="o">.</span><span class="n">from_envvar</span><span class="p">(</span><span class="s">&#39;YOURAPPLICATION_SETTINGS&#39;</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>In this case before launching the application you have to set this
+environment variable to the file you want to use. On Linux and OS X
+use the export statement:</p>
+<div class="highlight-python"><pre>export YOURAPPLICATION_SETTINGS='/path/to/config/file'</pre>
+</div>
+<p>On windows use <cite>set</cite> instead.</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>root_path</strong> &#8211; path to which files are read relative from. When the
+config object is created by the application, this is
+the application&#8217;s <tt class="xref py py-attr docutils literal"><span class="pre">root_path</span></tt>.</li>
+<li><strong>defaults</strong> &#8211; an optional dictionary of default values</li>
+</ul>
+</td>
+</tr>
+</tbody>
+</table>
+<dl class="method">
+<dt id="flask.Config.from_envvar">
+<tt class="descname">from_envvar</tt><big>(</big><em>variable_name</em>, <em>silent=False</em><big>)</big><a class="headerlink" href="#flask.Config.from_envvar" title="Permalink to this definition">¶</a></dt>
+<dd><p>Loads a configuration from an environment variable pointing to
+a configuration file. This is basically just a shortcut with nicer
+error messages for this line of code:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="n">app</span><span class="o">.</span><span class="n">config</span><span class="o">.</span><span class="n">from_pyfile</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">environ</span><span class="p">[</span><span class="s">&#39;YOURAPPLICATION_SETTINGS&#39;</span><span class="p">])</span>
+</pre></div>
+</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"><ul class="first simple">
+<li><strong>variable_name</strong> &#8211; name of the environment variable</li>
+<li><strong>silent</strong> &#8211; set to <cite>True</cite> if you want silent failure for missing
+files.</li>
+</ul>
+</td>
+</tr>
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">bool. <cite>True</cite> if able to load config, <cite>False</cite> otherwise.</p>
+</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Config.from_object">
+<tt class="descname">from_object</tt><big>(</big><em>obj</em><big>)</big><a class="headerlink" href="#flask.Config.from_object" title="Permalink to this definition">¶</a></dt>
+<dd><p>Updates the values from the given object. An object can be of one
+of the following two types:</p>
+<ul class="simple">
+<li>a string: in this case the object with that name will be imported</li>
+<li>an actual object reference: that object is used directly</li>
+</ul>
+<p>Objects are usually either modules or classes.</p>
+<p>Just the uppercase variables in that object are stored in the config.
+Example usage:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="n">app</span><span class="o">.</span><span class="n">config</span><span class="o">.</span><span class="n">from_object</span><span class="p">(</span><span class="s">&#39;yourapplication.default_config&#39;</span><span class="p">)</span>
+<span class="kn">from</span> <span class="nn">yourapplication</span> <span class="kn">import</span> <span class="n">default_config</span>
+<span class="n">app</span><span class="o">.</span><span class="n">config</span><span class="o">.</span><span class="n">from_object</span><span class="p">(</span><span class="n">default_config</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>You should not use this function to load the actual configuration but
+rather configuration defaults. The actual config should be loaded
+with <a class="reference internal" href="#flask.Config.from_pyfile" title="flask.Config.from_pyfile"><tt class="xref py py-meth docutils literal"><span class="pre">from_pyfile()</span></tt></a> and ideally from a location not within the
+package because the package might be installed system wide.</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>obj</strong> &#8211; an import name or object</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.Config.from_pyfile">
+<tt class="descname">from_pyfile</tt><big>(</big><em>filename</em>, <em>silent=False</em><big>)</big><a class="headerlink" href="#flask.Config.from_pyfile" title="Permalink to this definition">¶</a></dt>
+<dd><p>Updates the values in the config from a Python file. This function
+behaves as if the file was imported as module with the
+<a class="reference internal" href="#flask.Config.from_object" title="flask.Config.from_object"><tt class="xref py py-meth docutils literal"><span class="pre">from_object()</span></tt></a> function.</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>filename</strong> &#8211; the filename of the config. This can either be an
+absolute filename or a filename relative to the
+root path.</li>
+<li><strong>silent</strong> &#8211; set to <cite>True</cite> if you want silent failure for missing
+files.</li>
+</ul>
+</td>
+</tr>
+</tbody>
+</table>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.7: </span><cite>silent</cite> parameter.</p>
+</dd></dl>
+
+</dd></dl>
+
+</div>
+<div class="section" id="extensions">
+<h2>Extensions<a class="headerlink" href="#extensions" title="Permalink to this headline">¶</a></h2>
+<dl class="data">
+<dt id="flask.flask.ext">
+<tt class="descclassname">flask.</tt><tt class="descname">ext</tt><a class="headerlink" href="#flask.flask.ext" title="Permalink to this definition">¶</a></dt>
+<dd><p>This module acts as redirect import module to Flask extensions. It was
+added in 0.8 as the canonical way to import Flask extensions and makes
+it possible for us to have more flexibility in how we distribute
+extensions.</p>
+<p>If you want to use an extension named “Flask-Foo” you would import it
+from <a class="reference internal" href="#flask.flask.ext" title="flask.flask.ext"><tt class="xref py py-data docutils literal"><span class="pre">ext</span></tt></a> as follows:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">flask.ext</span> <span class="kn">import</span> <span class="n">foo</span>
+</pre></div>
+</div>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.8.</span></p>
+</dd></dl>
+
+</div>
+<div class="section" id="useful-internals">
+<h2>Useful Internals<a class="headerlink" href="#useful-internals" title="Permalink to this headline">¶</a></h2>
+<dl class="class">
+<dt id="flask.ctx.RequestContext">
+<em class="property">class </em><tt class="descclassname">flask.ctx.</tt><tt class="descname">RequestContext</tt><big>(</big><em>app</em>, <em>environ</em><big>)</big><a class="headerlink" href="#flask.ctx.RequestContext" title="Permalink to this definition">¶</a></dt>
+<dd><p>The request context contains all request relevant information. It is
+created at the beginning of the request and pushed to the
+<cite>_request_ctx_stack</cite> and removed at the end of it. It will create the
+URL adapter and request object for the WSGI environment provided.</p>
+<p>Do not attempt to use this class directly, instead use
+<a class="reference internal" href="#flask.Flask.test_request_context" title="flask.Flask.test_request_context"><tt class="xref py py-meth docutils literal"><span class="pre">test_request_context()</span></tt></a> and
+<a class="reference internal" href="#flask.Flask.request_context" title="flask.Flask.request_context"><tt class="xref py py-meth docutils literal"><span class="pre">request_context()</span></tt></a> to create this object.</p>
+<p>When the request context is popped, it will evaluate all the
+functions registered on the application for teardown execution
+(<a class="reference internal" href="#flask.Flask.teardown_request" title="flask.Flask.teardown_request"><tt class="xref py py-meth docutils literal"><span class="pre">teardown_request()</span></tt></a>).</p>
+<p>The request context is automatically popped at the end of the request
+for you. In debug mode the request context is kept around if
+exceptions happen so that interactive debuggers have a chance to
+introspect the data. With 0.4 this can also be forced for requests
+that did not fail and outside of <cite>DEBUG</cite> mode. By setting
+<tt class="docutils literal"><span class="pre">'flask._preserve_context'</span></tt> to <cite>True</cite> on the WSGI environment the
+context will not pop itself at the end of the request. This is used by
+the <a class="reference internal" href="#flask.Flask.test_client" title="flask.Flask.test_client"><tt class="xref py py-meth docutils literal"><span class="pre">test_client()</span></tt></a> for example to implement the
+deferred cleanup functionality.</p>
+<p>You might find this helpful for unittests where you need the
+information from the context local around for a little longer. Make
+sure to properly <tt class="xref py py-meth docutils literal"><span class="pre">pop()</span></tt> the stack yourself in
+that situation, otherwise your unittests will leak memory.</p>
+<dl class="method">
+<dt id="flask.ctx.RequestContext.match_request">
+<tt class="descname">match_request</tt><big>(</big><big>)</big><a class="headerlink" href="#flask.ctx.RequestContext.match_request" title="Permalink to this definition">¶</a></dt>
+<dd><p>Can be overridden by a subclass to hook into the matching
+of the request.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.ctx.RequestContext.pop">
+<tt class="descname">pop</tt><big>(</big><big>)</big><a class="headerlink" href="#flask.ctx.RequestContext.pop" title="Permalink to this definition">¶</a></dt>
+<dd><p>Pops the request context and unbinds it by doing that. This will
+also trigger the execution of functions registered by the
+<a class="reference internal" href="#flask.Flask.teardown_request" title="flask.Flask.teardown_request"><tt class="xref py py-meth docutils literal"><span class="pre">teardown_request()</span></tt></a> decorator.</p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.ctx.RequestContext.push">
+<tt class="descname">push</tt><big>(</big><big>)</big><a class="headerlink" href="#flask.ctx.RequestContext.push" title="Permalink to this definition">¶</a></dt>
+<dd><p>Binds the request context to the current context.</p>
+</dd></dl>
+
+</dd></dl>
+
+<dl class="data">
+<dt id="flask._request_ctx_stack">
+<tt class="descclassname">flask.</tt><tt class="descname">_request_ctx_stack</tt><a class="headerlink" href="#flask._request_ctx_stack" title="Permalink to this definition">¶</a></dt>
+<dd><p>The internal <a class="reference external" href="http://werkzeug.pocoo.org/docs/local/#werkzeug.local.LocalStack" title="(in Werkzeug v0.7)"><tt class="xref py py-class docutils literal"><span class="pre">LocalStack</span></tt></a> that is used to implement
+all the context local objects used in Flask. This is a documented
+instance and can be used by extensions and application code but the
+use is discouraged in general.</p>
+<p>The following attributes are always present on each layer of the
+stack:</p>
+<dl class="docutils">
+<dt><cite>app</cite></dt>
+<dd>the active Flask application.</dd>
+<dt><cite>url_adapter</cite></dt>
+<dd>the URL adapter that was used to match the request.</dd>
+<dt><cite>request</cite></dt>
+<dd>the current request object.</dd>
+<dt><cite>session</cite></dt>
+<dd>the active session object.</dd>
+<dt><cite>g</cite></dt>
+<dd>an object with all the attributes of the <a class="reference internal" href="#flask.g" title="flask.g"><tt class="xref py py-data docutils literal"><span class="pre">flask.g</span></tt></a> object.</dd>
+<dt><cite>flashes</cite></dt>
+<dd>an internal cache for the flashed messages.</dd>
+</dl>
+<p>Example usage:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">_request_ctx_stack</span>
+
+<span class="k">def</span> <span class="nf">get_session</span><span class="p">():</span>
+ <span class="n">ctx</span> <span class="o">=</span> <span class="n">_request_ctx_stack</span><span class="o">.</span><span class="n">top</span>
+ <span class="k">if</span> <span class="n">ctx</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+ <span class="k">return</span> <span class="n">ctx</span><span class="o">.</span><span class="n">session</span>
+</pre></div>
+</div>
+</dd></dl>
+
+<dl class="class">
+<dt id="flask.blueprints.BlueprintSetupState">
+<em class="property">class </em><tt class="descclassname">flask.blueprints.</tt><tt class="descname">BlueprintSetupState</tt><big>(</big><em>blueprint</em>, <em>app</em>, <em>options</em>, <em>first_registration</em><big>)</big><a class="headerlink" href="#flask.blueprints.BlueprintSetupState" title="Permalink to this definition">¶</a></dt>
+<dd><p>Temporary holder object for registering a blueprint with the
+application. An instance of this class is created by the
+<a class="reference internal" href="#flask.Blueprint.make_setup_state" title="flask.Blueprint.make_setup_state"><tt class="xref py py-meth docutils literal"><span class="pre">make_setup_state()</span></tt></a> method and later passed
+to all register callback functions.</p>
+<dl class="method">
+<dt id="flask.blueprints.BlueprintSetupState.add_url_rule">
+<tt class="descname">add_url_rule</tt><big>(</big><em>rule</em>, <em>endpoint=None</em>, <em>view_func=None</em>, <em>**options</em><big>)</big><a class="headerlink" href="#flask.blueprints.BlueprintSetupState.add_url_rule" title="Permalink to this definition">¶</a></dt>
+<dd><p>A helper method to register a rule (and optionally a view function)
+to the application. The endpoint is automatically prefixed with the
+blueprint&#8217;s name.</p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.blueprints.BlueprintSetupState.app">
+<tt class="descname">app</tt><em class="property"> = None</em><a class="headerlink" href="#flask.blueprints.BlueprintSetupState.app" title="Permalink to this definition">¶</a></dt>
+<dd><p>a reference to the current application</p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.blueprints.BlueprintSetupState.blueprint">
+<tt class="descname">blueprint</tt><em class="property"> = None</em><a class="headerlink" href="#flask.blueprints.BlueprintSetupState.blueprint" title="Permalink to this definition">¶</a></dt>
+<dd><p>a reference to the blurprint that created this setup state.</p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.blueprints.BlueprintSetupState.first_registration">
+<tt class="descname">first_registration</tt><em class="property"> = None</em><a class="headerlink" href="#flask.blueprints.BlueprintSetupState.first_registration" title="Permalink to this definition">¶</a></dt>
+<dd><p>as blueprints can be registered multiple times with the
+application and not everything wants to be registered
+multiple times on it, this attribute can be used to figure
+out if the blueprint was registered in the past already.</p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.blueprints.BlueprintSetupState.options">
+<tt class="descname">options</tt><em class="property"> = None</em><a class="headerlink" href="#flask.blueprints.BlueprintSetupState.options" title="Permalink to this definition">¶</a></dt>
+<dd><p>a dictionary with all options that were passed to the
+<a class="reference internal" href="#flask.Flask.register_blueprint" title="flask.Flask.register_blueprint"><tt class="xref py py-meth docutils literal"><span class="pre">register_blueprint()</span></tt></a> method.</p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.blueprints.BlueprintSetupState.subdomain">
+<tt class="descname">subdomain</tt><em class="property"> = None</em><a class="headerlink" href="#flask.blueprints.BlueprintSetupState.subdomain" title="Permalink to this definition">¶</a></dt>
+<dd><p>The subdomain that the blueprint should be active for, <cite>None</cite>
+otherwise.</p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.blueprints.BlueprintSetupState.url_defaults">
+<tt class="descname">url_defaults</tt><em class="property"> = None</em><a class="headerlink" href="#flask.blueprints.BlueprintSetupState.url_defaults" title="Permalink to this definition">¶</a></dt>
+<dd><p>A dictionary with URL defaults that is added to each and every
+URL that was defined with the blueprint.</p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.blueprints.BlueprintSetupState.url_prefix">
+<tt class="descname">url_prefix</tt><em class="property"> = None</em><a class="headerlink" href="#flask.blueprints.BlueprintSetupState.url_prefix" title="Permalink to this definition">¶</a></dt>
+<dd><p>The prefix that should be used for all URLs defined on the
+blueprint.</p>
+</dd></dl>
+
+</dd></dl>
+
+</div>
+<div class="section" id="signals">
+<h2>Signals<a class="headerlink" href="#signals" title="Permalink to this headline">¶</a></h2>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.6.</span></p>
+<dl class="data">
+<dt id="flask.signals_available">
+<tt class="descclassname">flask.</tt><tt class="descname">signals_available</tt><a class="headerlink" href="#flask.signals_available" title="Permalink to this definition">¶</a></dt>
+<dd><p><cite>True</cite> if the signalling system is available. This is the case
+when <a class="reference external" href="http://pypi.python.org/pypi/blinker">blinker</a> is installed.</p>
+</dd></dl>
+
+<dl class="data">
+<dt id="flask.template_rendered">
+<tt class="descclassname">flask.</tt><tt class="descname">template_rendered</tt><a class="headerlink" href="#flask.template_rendered" title="Permalink to this definition">¶</a></dt>
+<dd><p>This signal is sent when a template was successfully rendered. The
+signal is invoked with the instance of the template as <cite>template</cite>
+and the context as dictionary (named <cite>context</cite>).</p>
+</dd></dl>
+
+<dl class="data">
+<dt id="flask.request_started">
+<tt class="descclassname">flask.</tt><tt class="descname">request_started</tt><a class="headerlink" href="#flask.request_started" title="Permalink to this definition">¶</a></dt>
+<dd><p>This signal is sent before any request processing started but when the
+request context was set up. Because the request context is already
+bound, the subscriber can access the request with the standard global
+proxies such as <a class="reference internal" href="#flask.request" title="flask.request"><tt class="xref py py-class docutils literal"><span class="pre">request</span></tt></a>.</p>
+</dd></dl>
+
+<dl class="data">
+<dt id="flask.request_finished">
+<tt class="descclassname">flask.</tt><tt class="descname">request_finished</tt><a class="headerlink" href="#flask.request_finished" title="Permalink to this definition">¶</a></dt>
+<dd><p>This signal is sent right before the response is sent to the client.
+It is passed the response to be sent named <cite>response</cite>.</p>
+</dd></dl>
+
+<dl class="data">
+<dt id="flask.got_request_exception">
+<tt class="descclassname">flask.</tt><tt class="descname">got_request_exception</tt><a class="headerlink" href="#flask.got_request_exception" title="Permalink to this definition">¶</a></dt>
+<dd><p>This signal is sent when an exception happens during request processing.
+It is sent <em>before</em> the standard exception handling kicks in and even
+in debug mode, where no exception handling happens. The exception
+itself is passed to the subscriber as <cite>exception</cite>.</p>
+</dd></dl>
+
+<dl class="data">
+<dt id="flask.request_tearing_down">
+<tt class="descclassname">flask.</tt><tt class="descname">request_tearing_down</tt><a class="headerlink" href="#flask.request_tearing_down" title="Permalink to this definition">¶</a></dt>
+<dd><p>This signal is sent when the application is tearing down the request.
+This is always called, even if an error happened. No arguments are
+provided.</p>
+</dd></dl>
+
+<dl class="class">
+<dt id="flask.signals.Namespace">
+<em class="property">class </em><tt class="descclassname">flask.signals.</tt><tt class="descname">Namespace</tt><a class="headerlink" href="#flask.signals.Namespace" title="Permalink to this definition">¶</a></dt>
+<dd><p>An alias for <a class="reference external" href="http://discorporate.us/projects/Blinker/docs/1.1/api.html#blinker.base.Namespace" title="(in Blinker v1.1)"><tt class="xref py py-class docutils literal"><span class="pre">blinker.base.Namespace</span></tt></a> if blinker is available,
+otherwise a dummy class that creates fake signals. This class is
+available for Flask extensions that want to provide the same fallback
+system as Flask itself.</p>
+<dl class="method">
+<dt id="flask.signals.Namespace.signal">
+<tt class="descname">signal</tt><big>(</big><em>name</em>, <em>doc=None</em><big>)</big><a class="headerlink" href="#flask.signals.Namespace.signal" title="Permalink to this definition">¶</a></dt>
+<dd><p>Creates a new signal for this namespace if blinker is available,
+otherwise returns a fake signal that has a send method that will
+do nothing but will fail with a <a class="reference external" href="http://docs.python.org/dev/library/exceptions.html#RuntimeError" title="(in Python v3.3)"><tt class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></tt></a> for all other
+operations, including connecting.</p>
+</dd></dl>
+
+</dd></dl>
+
+</div>
+<div class="section" id="class-based-views">
+<h2>Class Based Views<a class="headerlink" href="#class-based-views" title="Permalink to this headline">¶</a></h2>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.7.</span></p>
+<dl class="class">
+<dt id="flask.views.View">
+<em class="property">class </em><tt class="descclassname">flask.views.</tt><tt class="descname">View</tt><a class="headerlink" href="#flask.views.View" title="Permalink to this definition">¶</a></dt>
+<dd><p>Alternative way to use view functions. A subclass has to implement
+<tt class="xref py py-meth docutils literal"><span class="pre">dispatch_request()</span></tt> which is called with the view arguments from
+the URL routing system. If <tt class="xref py py-attr docutils literal"><span class="pre">methods</span></tt> is provided the methods
+do not have to be passed to the <a class="reference internal" href="#flask.Flask.add_url_rule" title="flask.Flask.add_url_rule"><tt class="xref py py-meth docutils literal"><span class="pre">add_url_rule()</span></tt></a>
+method explicitly:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">class</span> <span class="nc">MyView</span><span class="p">(</span><span class="n">View</span><span class="p">):</span>
+ <span class="n">methods</span> <span class="o">=</span> <span class="p">[</span><span class="s">&#39;GET&#39;</span><span class="p">]</span>
+
+ <span class="k">def</span> <span class="nf">dispatch_request</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">):</span>
+ <span class="k">return</span> <span class="s">&#39;Hello </span><span class="si">%s</span><span class="s">!&#39;</span> <span class="o">%</span> <span class="n">name</span>
+
+<span class="n">app</span><span class="o">.</span><span class="n">add_url_rule</span><span class="p">(</span><span class="s">&#39;/hello/&lt;name&gt;&#39;</span><span class="p">,</span> <span class="n">view_func</span><span class="o">=</span><span class="n">MyView</span><span class="o">.</span><span class="n">as_view</span><span class="p">(</span><span class="s">&#39;myview&#39;</span><span class="p">))</span>
+</pre></div>
+</div>
+<p>When you want to decorate a pluggable view you will have to either do that
+when the view function is created (by wrapping the return value of
+<tt class="xref py py-meth docutils literal"><span class="pre">as_view()</span></tt>) or you can use the <tt class="xref py py-attr docutils literal"><span class="pre">decorators</span></tt> attribute:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">class</span> <span class="nc">SecretView</span><span class="p">(</span><span class="n">View</span><span class="p">):</span>
+ <span class="n">methods</span> <span class="o">=</span> <span class="p">[</span><span class="s">&#39;GET&#39;</span><span class="p">]</span>
+ <span class="n">decorators</span> <span class="o">=</span> <span class="p">[</span><span class="n">superuser_required</span><span class="p">]</span>
+
+ <span class="k">def</span> <span class="nf">dispatch_request</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+ <span class="o">...</span>
+</pre></div>
+</div>
+<p>The decorators stored in the decorators list are applied one after another
+when the view function is created. Note that you can <em>not</em> use the class
+based decorators since those would decorate the view class and not the
+generated view function!</p>
+<dl class="classmethod">
+<dt id="flask.views.View.as_view">
+<em class="property">classmethod </em><tt class="descname">as_view</tt><big>(</big><em>name</em>, <em>*class_args</em>, <em>**class_kwargs</em><big>)</big><a class="headerlink" href="#flask.views.View.as_view" title="Permalink to this definition">¶</a></dt>
+<dd><p>Converts the class into an actual view function that can be
+used with the routing system. What it does internally is generating
+a function on the fly that will instanciate the <tt class="xref py py-class docutils literal"><span class="pre">View</span></tt>
+on each request and call the <tt class="xref py py-meth docutils literal"><span class="pre">dispatch_request()</span></tt> method on it.</p>
+<p>The arguments passed to <tt class="xref py py-meth docutils literal"><span class="pre">as_view()</span></tt> are forwarded to the
+constructor of the class.</p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.views.View.decorators">
+<tt class="descname">decorators</tt><em class="property"> = []</em><a class="headerlink" href="#flask.views.View.decorators" title="Permalink to this definition">¶</a></dt>
+<dd><p>The canonical way to decorate class based views is to decorate the
+return value of as_view(). However since this moves parts of the
+logic from the class declaration to the place where it&#8217;s hooked
+into the routing system.</p>
+<p>You can place one or more decorators in this list and whenever the
+view function is created the result is automatically decorated.</p>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.8.</span></p>
+</dd></dl>
+
+<dl class="method">
+<dt id="flask.views.View.dispatch_request">
+<tt class="descname">dispatch_request</tt><big>(</big><big>)</big><a class="headerlink" href="#flask.views.View.dispatch_request" title="Permalink to this definition">¶</a></dt>
+<dd><p>Subclasses have to override this method to implement the
+actual view function code. This method is called with all
+the arguments from the URL rule.</p>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="flask.views.View.methods">
+<tt class="descname">methods</tt><em class="property"> = None</em><a class="headerlink" href="#flask.views.View.methods" title="Permalink to this definition">¶</a></dt>
+<dd><p>A for which methods this pluggable view can handle.</p>
+</dd></dl>
+
+</dd></dl>
+
+<dl class="class">
+<dt id="flask.views.MethodView">
+<em class="property">class </em><tt class="descclassname">flask.views.</tt><tt class="descname">MethodView</tt><a class="headerlink" href="#flask.views.MethodView" title="Permalink to this definition">¶</a></dt>
+<dd><p>Like a regular class based view but that dispatches requests to
+particular methods. For instance if you implement a method called
+<tt class="xref py py-meth docutils literal"><span class="pre">get()</span></tt> it means you will response to <tt class="docutils literal"><span class="pre">'GET'</span></tt> requests and
+the <tt class="xref py py-meth docutils literal"><span class="pre">dispatch_request()</span></tt> implementation will automatically
+forward your request to that. Also <tt class="xref py py-attr docutils literal"><span class="pre">options</span></tt> is set for you
+automatically:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">class</span> <span class="nc">CounterAPI</span><span class="p">(</span><span class="n">MethodView</span><span class="p">):</span>
+
+ <span class="k">def</span> <span class="nf">get</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+ <span class="k">return</span> <span class="n">session</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;counter&#39;</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+
+ <span class="k">def</span> <span class="nf">post</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+ <span class="n">session</span><span class="p">[</span><span class="s">&#39;counter&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">session</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;counter&#39;</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> <span class="o">+</span> <span class="mi">1</span>
+ <span class="k">return</span> <span class="s">&#39;OK&#39;</span>
+
+<span class="n">app</span><span class="o">.</span><span class="n">add_url_rule</span><span class="p">(</span><span class="s">&#39;/counter&#39;</span><span class="p">,</span> <span class="n">view_func</span><span class="o">=</span><span class="n">CounterAPI</span><span class="o">.</span><span class="n">as_view</span><span class="p">(</span><span class="s">&#39;counter&#39;</span><span class="p">))</span>
+</pre></div>
+</div>
+</dd></dl>
+
+</div>
+<div class="section" id="url-route-registrations">
+<span id="id2"></span><h2>URL Route Registrations<a class="headerlink" href="#url-route-registrations" title="Permalink to this headline">¶</a></h2>
+<p>Generally there are three ways to define rules for the routing system:</p>
+<ol class="arabic simple">
+<li>You can use the <a class="reference internal" href="#flask.Flask.route" title="flask.Flask.route"><tt class="xref py py-meth docutils literal"><span class="pre">flask.Flask.route()</span></tt></a> decorator.</li>
+<li>You can use the <a class="reference internal" href="#flask.Flask.add_url_rule" title="flask.Flask.add_url_rule"><tt class="xref py py-meth docutils literal"><span class="pre">flask.Flask.add_url_rule()</span></tt></a> function.</li>
+<li>You can directly access the underlying Werkzeug routing system
+which is exposed as <a class="reference internal" href="#flask.Flask.url_map" title="flask.Flask.url_map"><tt class="xref py py-attr docutils literal"><span class="pre">flask.Flask.url_map</span></tt></a>.</li>
+</ol>
+<p>Variable parts in the route can be specified with angular brackets
+(<tt class="docutils literal"><span class="pre">/user/&lt;username&gt;</span></tt>). By default a variable part in the URL accepts any
+string without a slash however a different converter can be specified as
+well by using <tt class="docutils literal"><span class="pre">&lt;converter:name&gt;</span></tt>.</p>
+<p>Variable parts are passed to the view function as keyword arguments.</p>
+<p>The following converters are available:</p>
+<table border="1" class="docutils">
+<colgroup>
+<col width="19%" />
+<col width="81%" />
+</colgroup>
+<tbody valign="top">
+<tr class="row-odd"><td><cite>unicode</cite></td>
+<td>accepts any text without a slash (the default)</td>
+</tr>
+<tr class="row-even"><td><cite>int</cite></td>
+<td>accepts integers</td>
+</tr>
+<tr class="row-odd"><td><cite>float</cite></td>
+<td>like <cite>int</cite> but for floating point values</td>
+</tr>
+<tr class="row-even"><td><cite>path</cite></td>
+<td>like the default but also accepts slashes</td>
+</tr>
+</tbody>
+</table>
+<p>Here are some examples:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/&#39;</span><span class="p">)</span>
+<span class="k">def</span> <span class="nf">index</span><span class="p">():</span>
+ <span class="k">pass</span>
+
+<span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/&lt;username&gt;&#39;</span><span class="p">)</span>
+<span class="k">def</span> <span class="nf">show_user</span><span class="p">(</span><span class="n">username</span><span class="p">):</span>
+ <span class="k">pass</span>
+
+<span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/post/&lt;int:post_id&gt;&#39;</span><span class="p">)</span>
+<span class="k">def</span> <span class="nf">show_post</span><span class="p">(</span><span class="n">post_id</span><span class="p">):</span>
+ <span class="k">pass</span>
+</pre></div>
+</div>
+<p>An important detail to keep in mind is how Flask deals with trailing
+slashes. The idea is to keep each URL unique so the following rules
+apply:</p>
+<ol class="arabic simple">
+<li>If a rule ends with a slash and is requested without a slash by the
+user, the user is automatically redirected to the same page with a
+trailing slash attached.</li>
+<li>If a rule does not end with a trailing slash and the user requests the
+page with a trailing slash, a 404 not found is raised.</li>
+</ol>
+<p>This is consistent with how web servers deal with static files. This
+also makes it possible to use relative link targets safely.</p>
+<p>You can also define multiple rules for the same function. They have to be
+unique however. Defaults can also be specified. Here for example is a
+definition for a URL that accepts an optional page:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/users/&#39;</span><span class="p">,</span> <span class="n">defaults</span><span class="o">=</span><span class="p">{</span><span class="s">&#39;page&#39;</span><span class="p">:</span> <span class="mi">1</span><span class="p">})</span>
+<span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/users/page/&lt;int:page&gt;&#39;</span><span class="p">)</span>
+<span class="k">def</span> <span class="nf">show_users</span><span class="p">(</span><span class="n">page</span><span class="p">):</span>
+ <span class="k">pass</span>
+</pre></div>
+</div>
+<p>This specifies that <tt class="docutils literal"><span class="pre">/users/</span></tt> will be the URL for page one and
+<tt class="docutils literal"><span class="pre">/users/page/N</span></tt> will be the URL for page <cite>N</cite>.</p>
+<p>Here are the parameters that <a class="reference internal" href="#flask.Flask.route" title="flask.Flask.route"><tt class="xref py py-meth docutils literal"><span class="pre">route()</span></tt></a> and
+<a class="reference internal" href="#flask.Flask.add_url_rule" title="flask.Flask.add_url_rule"><tt class="xref py py-meth docutils literal"><span class="pre">add_url_rule()</span></tt></a> accept. The only difference is that
+with the route parameter the view function is defined with the decorator
+instead of the <cite>view_func</cite> parameter.</p>
+<table border="1" class="docutils">
+<colgroup>
+<col width="21%" />
+<col width="79%" />
+</colgroup>
+<tbody valign="top">
+<tr class="row-odd"><td><cite>rule</cite></td>
+<td>the URL roule as string</td>
+</tr>
+<tr class="row-even"><td><cite>endpoint</cite></td>
+<td>the endpoint for the registered URL rule. Flask itself
+assumes that the name of the view function is the name
+of the endpoint if not explicitly stated.</td>
+</tr>
+<tr class="row-odd"><td><cite>view_func</cite></td>
+<td>the function to call when serving a request to the
+provided endpoint. If this is not provided one can
+specify the function later by storing it in the
+<a class="reference internal" href="#flask.Flask.view_functions" title="flask.Flask.view_functions"><tt class="xref py py-attr docutils literal"><span class="pre">view_functions</span></tt></a> dictionary with the
+endpoint as key.</td>
+</tr>
+<tr class="row-even"><td><cite>defaults</cite></td>
+<td>A dictionary with defaults for this rule. See the
+example above for how defaults work.</td>
+</tr>
+<tr class="row-odd"><td><cite>subdomain</cite></td>
+<td>specifies the rule for the subdomain in case subdomain
+matching is in use. If not specified the default
+subdomain is assumed.</td>
+</tr>
+<tr class="row-even"><td><cite>**options</cite></td>
+<td>the options to be forwarded to the underlying
+<a class="reference external" href="http://werkzeug.pocoo.org/docs/routing/#werkzeug.routing.Rule" title="(in Werkzeug v0.7)"><tt class="xref py py-class docutils literal"><span class="pre">Rule</span></tt></a> object. A change to
+Werkzeug is handling of method options. methods is a list
+of methods this rule should be limited to (<cite>GET</cite>, <cite>POST</cite>
+etc.). By default a rule just listens for <cite>GET</cite> (and
+implicitly <cite>HEAD</cite>). Starting with Flask 0.6, <cite>OPTIONS</cite> is
+implicitly added and handled by the standard request
+handling. They have to be specified as keyword arguments.</td>
+</tr>
+</tbody>
+</table>
+</div>
+<div class="section" id="view-function-options">
+<span id="view-func-options"></span><h2>View Function Options<a class="headerlink" href="#view-function-options" title="Permalink to this headline">¶</a></h2>
+<p>For internal usage the view functions can have some attributes attached to
+customize behavior the view function would normally not have control over.
+The following attributes can be provided optionally to either override
+some defaults to <a class="reference internal" href="#flask.Flask.add_url_rule" title="flask.Flask.add_url_rule"><tt class="xref py py-meth docutils literal"><span class="pre">add_url_rule()</span></tt></a> or general behavior:</p>
+<ul class="simple">
+<li><cite>__name__</cite>: The name of a function is by default used as endpoint. If
+endpoint is provided explicitly this value is used. Additionally this
+will be prefixed with the name of the blueprint by default which
+cannot be customized from the function itself.</li>
+<li><cite>methods</cite>: If methods are not provided when the URL rule is added,
+Flask will look on the view function object itself is an <cite>methods</cite>
+attribute exists. If it does, it will pull the information for the
+methods from there.</li>
+<li><cite>provide_automatic_options</cite>: if this attribute is set Flask will
+either force enable or disable the automatic implementation of the
+HTTP <cite>OPTIONS</cite> response. This can be useful when working with
+decorators that want to customize the <cite>OPTIONS</cite> response on a per-view
+basis.</li>
+</ul>
+<p>Full example:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">def</span> <span class="nf">index</span><span class="p">():</span>
+ <span class="k">if</span> <span class="n">request</span><span class="o">.</span><span class="n">method</span> <span class="o">==</span> <span class="s">&#39;OPTIONS&#39;</span><span class="p">:</span>
+ <span class="c"># custom options handling here</span>
+ <span class="o">...</span>
+ <span class="k">return</span> <span class="s">&#39;Hello World!&#39;</span>
+<span class="n">index</span><span class="o">.</span><span class="n">provide_automatic_options</span> <span class="o">=</span> <span class="bp">False</span>
+<span class="n">index</span><span class="o">.</span><span class="n">methods</span> <span class="o">=</span> <span class="p">[</span><span class="s">&#39;GET&#39;</span><span class="p">,</span> <span class="s">&#39;OPTIONS&#39;</span><span class="p">]</span>
+
+<span class="n">app</span><span class="o">.</span><span class="n">add_url_rule</span><span class="p">(</span><span class="s">&#39;/&#39;</span><span class="p">,</span> <span class="n">index</span><span class="p">)</span>
+</pre></div>
+</div>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.8: </span>The <cite>provide_automatic_options</cite> functionality was added.</p>
+</div>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="index.html">
+ <img class="logo" src="_static/flask.png" alt="Logo"/>
+</a></p>
+ <h3><a href="index.html">Table Of Contents</a></h3>
+ <ul>
+<li><a class="reference internal" href="#">API</a><ul>
+<li><a class="reference internal" href="#application-object">Application Object</a></li>
+<li><a class="reference internal" href="#blueprint-objects">Blueprint Objects</a></li>
+<li><a class="reference internal" href="#incoming-request-data">Incoming Request Data</a></li>
+<li><a class="reference internal" href="#response-objects">Response Objects</a></li>
+<li><a class="reference internal" href="#sessions">Sessions</a></li>
+<li><a class="reference internal" href="#session-interface">Session Interface</a></li>
+<li><a class="reference internal" href="#test-client">Test Client</a></li>
+<li><a class="reference internal" href="#application-globals">Application Globals</a></li>
+<li><a class="reference internal" href="#useful-functions-and-classes">Useful Functions and Classes</a></li>
+<li><a class="reference internal" href="#message-flashing">Message Flashing</a></li>
+<li><a class="reference internal" href="#returning-json">Returning JSON</a></li>
+<li><a class="reference internal" href="#template-rendering">Template Rendering</a></li>
+<li><a class="reference internal" href="#configuration">Configuration</a></li>
+<li><a class="reference internal" href="#extensions">Extensions</a></li>
+<li><a class="reference internal" href="#useful-internals">Useful Internals</a></li>
+<li><a class="reference internal" href="#signals">Signals</a></li>
+<li><a class="reference internal" href="#class-based-views">Class Based Views</a></li>
+<li><a class="reference internal" href="#url-route-registrations">URL Route Registrations</a></li>
+<li><a class="reference internal" href="#view-function-options">View Function Options</a></li>
+</ul>
+</li>
+</ul>
+<h3>Related Topics</h3>
+<ul>
+ <li><a href="index.html">Documentation overview</a><ul>
+ <li>Previous: <a href="becomingbig.html" title="previous chapter">Becoming Big</a></li>
+ <li>Next: <a href="design.html" title="next chapter">Design Decisions in Flask</a></li>
+ </ul></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="_sources/api.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/becomingbig.html b/app/static/doc/flask-docs/becomingbig.html
new file mode 100644
index 0000000..1d44906
--- /dev/null
+++ b/app/static/doc/flask-docs/becomingbig.html
@@ -0,0 +1,187 @@
+
+<!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>Becoming Big &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="index.html" />
+ <link rel="next" title="API" href="api.html" />
+ <link rel="prev" title="Other Servers" href="deploying/others.html" />
+
+
+ <link rel="apple-touch-icon" href="_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <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="api.html" title="API"
+ accesskey="N">next</a> |</li>
+ <li class="right" >
+ <a href="deploying/others.html" title="Other Servers"
+ accesskey="P">previous</a> |</li>
+ <li><a href="index.html">Flask 0.8 documentation</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="becoming-big">
+<span id="becomingbig"></span><h1>Becoming Big<a class="headerlink" href="#becoming-big" title="Permalink to this headline">¶</a></h1>
+<p>Your application is becoming more and more complex? If you suddenly
+realize that Flask does things in a way that does not work out for your
+application there are ways to deal with that.</p>
+<p>Flask is powered by Werkzeug and Jinja2, two libraries that are in use at
+a number of large websites out there and all Flask does is bring those
+two together. Being a microframework Flask does not do much more than
+combining existing libraries - there is not a lot of code involved.
+What that means for large applications is that it&#8217;s very easy to take the
+code from Flask and put it into a new module within the applications and
+expand on that.</p>
+<p>Flask is designed to be extended and modified in a couple of different
+ways:</p>
+<ul class="simple">
+<li>Flask extensions. For a lot of reusable functionality you can create
+extensions. For extensions a number of hooks exist throughout Flask
+with signals and callback functions.</li>
+<li>Subclassing. The majority of functionality can be changed by creating
+a new subclass of the <a class="reference internal" href="api.html#flask.Flask" title="flask.Flask"><tt class="xref py py-class docutils literal"><span class="pre">Flask</span></tt></a> class and overriding
+methods provided for this exact purpose.</li>
+<li>Forking. If nothing else works out you can just take the Flask
+codebase at a given point and copy/paste it into your application
+and change it. Flask is designed with that in mind and makes this
+incredible easy. You just have to take the package and copy it
+into your application&#8217;s code and rename it (for example to
+<cite>framework</cite>). Then you can start modifying the code in there.</li>
+</ul>
+<div class="section" id="why-consider-forking">
+<h2>Why consider Forking?<a class="headerlink" href="#why-consider-forking" title="Permalink to this headline">¶</a></h2>
+<p>The majority of code of Flask is within Werkzeug and Jinja2. These
+libraries do the majority of the work. Flask is just the paste that glues
+those together. For every project there is the point where the underlying
+framework gets in the way (due to assumptions the original developers
+had). This is natural because if this would not be the case, the
+framework would be a very complex system to begin with which causes a
+steep learning curve and a lot of user frustration.</p>
+<p>This is not unique to Flask. Many people use patched and modified
+versions of their framework to counter shortcomings. This idea is also
+reflected in the license of Flask. You don&#8217;t have to contribute any
+changes back if you decide to modify the framework.</p>
+<p>The downside of forking is of course that Flask extensions will most
+likely break because the new framework has a different import name.
+Furthermore integrating upstream changes can be a complex process,
+depending on the number of changes. Because of that, forking should be
+the very last resort.</p>
+</div>
+<div class="section" id="scaling-like-a-pro">
+<h2>Scaling like a Pro<a class="headerlink" href="#scaling-like-a-pro" title="Permalink to this headline">¶</a></h2>
+<p>For many web applications the complexity of the code is less an issue than
+the scaling for the number of users or data entries expected. Flask by
+itself is only limited in terms of scaling by your application code, the
+data store you want to use and the Python implementation and webserver you
+are running on.</p>
+<p>Scaling well means for example that if you double the amount of servers
+you get about twice the performance. Scaling bad means that if you add a
+new server the application won&#8217;t perform any better or would not even
+support a second server.</p>
+<p>There is only one limiting factor regarding scaling in Flask which are
+the context local proxies. They depend on context which in Flask is
+defined as being either a thread, process or greenlet. If your server
+uses some kind of concurrency that is not based on threads or greenlets,
+Flask will no longer be able to support these global proxies. However the
+majority of servers are using either threads, greenlets or separate
+processes to achieve concurrency which are all methods well supported by
+the underlying Werkzeug library.</p>
+</div>
+<div class="section" id="dialogue-with-the-community">
+<h2>Dialogue with the Community<a class="headerlink" href="#dialogue-with-the-community" title="Permalink to this headline">¶</a></h2>
+<p>The Flask developers are very interested to keep everybody happy, so as
+soon as you find an obstacle in your way, caused by Flask, don&#8217;t hesitate
+to contact the developers on the mailinglist or IRC channel. The best way
+for the Flask and Flask-extension developers to improve it for larger
+applications is getting feedback from users.</p>
+</div>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="index.html">
+ <img class="logo" src="_static/flask.png" alt="Logo"/>
+</a></p>
+ <h3><a href="index.html">Table Of Contents</a></h3>
+ <ul>
+<li><a class="reference internal" href="#">Becoming Big</a><ul>
+<li><a class="reference internal" href="#why-consider-forking">Why consider Forking?</a></li>
+<li><a class="reference internal" href="#scaling-like-a-pro">Scaling like a Pro</a></li>
+<li><a class="reference internal" href="#dialogue-with-the-community">Dialogue with the Community</a></li>
+</ul>
+</li>
+</ul>
+<h3>Related Topics</h3>
+<ul>
+ <li><a href="index.html">Documentation overview</a><ul>
+ <li>Previous: <a href="deploying/others.html" title="previous chapter">Other Servers</a></li>
+ <li>Next: <a href="api.html" title="next chapter">API</a></li>
+ </ul></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="_sources/becomingbig.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/blueprints.html b/app/static/doc/flask-docs/blueprints.html
new file mode 100644
index 0000000..271aa3d
--- /dev/null
+++ b/app/static/doc/flask-docs/blueprints.html
@@ -0,0 +1,306 @@
+
+<!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>Modular Applications with Blueprints &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="index.html" />
+ <link rel="next" title="Flask Extensions" href="extensions.html" />
+ <link rel="prev" title="The Request Context" href="reqcontext.html" />
+
+
+ <link rel="apple-touch-icon" href="_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <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="extensions.html" title="Flask Extensions"
+ accesskey="N">next</a> |</li>
+ <li class="right" >
+ <a href="reqcontext.html" title="The Request Context"
+ accesskey="P">previous</a> |</li>
+ <li><a href="index.html">Flask 0.8 documentation</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="modular-applications-with-blueprints">
+<span id="blueprints"></span><h1>Modular Applications with Blueprints<a class="headerlink" href="#modular-applications-with-blueprints" title="Permalink to this headline">¶</a></h1>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.7.</span></p>
+<p>Flask uses a concept of <em>blueprints</em> for making application components and
+supporting common patterns within an application or across applications.
+Blueprints can greatly simplify how large applications work and provide a
+central means for Flask extensions to register operations on applications.
+A <tt class="xref py py-class docutils literal"><span class="pre">Blueprint</span></tt> object works similarly to a <tt class="xref py py-class docutils literal"><span class="pre">Flask</span></tt>
+application object, but it is not actually an application. Rather it is a
+<em>blueprint</em> of how to construct or extend an application.</p>
+<div class="section" id="why-blueprints">
+<h2>Why Blueprints?<a class="headerlink" href="#why-blueprints" title="Permalink to this headline">¶</a></h2>
+<p>Blueprints in Flask are intended for these cases:</p>
+<ul class="simple">
+<li>Factor an application into a set of blueprints. This is ideal for
+larger applications; a project could instantiate an application object,
+initialize several extensions, and register a collection of blueprints.</li>
+<li>Register a blueprint on an application at a URL prefix and/or subdomain.
+Parameters in the URL prefix/subdomain become common view arguments
+(with defaults) across all view functions in the blueprint.</li>
+<li>Register a blueprint multiple times on an application with different URL
+rules.</li>
+<li>Provide template filters, static files, templates, and other utilities
+through blueprints. A blueprint does not have to implement applications
+or view functions.</li>
+<li>Register a blueprint on an application for any of these cases when
+initializing a Flask extension.</li>
+</ul>
+<p>A blueprint in Flask is not a pluggable app because it is not actually an
+application &#8211; it&#8217;s a set of operations which can be registered on an
+application, even multiple times. Why not have multiple application
+objects? You can do that (see <a class="reference internal" href="patterns/appdispatch.html#app-dispatch"><em>Application Dispatching</em></a>), but your applications
+will have separate configs and will be managed at the WSGI layer.</p>
+<p>Blueprints instead provide separation at the Flask level, share
+application config, and can change an application object as necessary with
+being registered. The downside is that you cannot unregister a blueprint
+once an application was created without having to destroy the whole
+application object.</p>
+</div>
+<div class="section" id="the-concept-of-blueprints">
+<h2>The Concept of Blueprints<a class="headerlink" href="#the-concept-of-blueprints" title="Permalink to this headline">¶</a></h2>
+<p>The basic concept of blueprints is that they record operations to execute
+when registered on an application. Flask associates view functions with
+blueprints when dispatching requests and generating URLs from one endpoint
+to another.</p>
+</div>
+<div class="section" id="my-first-blueprint">
+<h2>My First Blueprint<a class="headerlink" href="#my-first-blueprint" title="Permalink to this headline">¶</a></h2>
+<p>This is what a very basic blueprint looks like. In this case we want to
+implement a blueprint that does simple rendering of static templates:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">Blueprint</span><span class="p">,</span> <span class="n">render_template</span><span class="p">,</span> <span class="n">abort</span>
+<span class="kn">from</span> <span class="nn">jinja2</span> <span class="kn">import</span> <span class="n">TemplateNotFound</span>
+
+<span class="n">simple_page</span> <span class="o">=</span> <span class="n">Blueprint</span><span class="p">(</span><span class="s">&#39;simple_page&#39;</span><span class="p">,</span> <span class="n">__name__</span><span class="p">)</span>
+
+<span class="nd">@simple_page.route</span><span class="p">(</span><span class="s">&#39;/&#39;</span><span class="p">,</span> <span class="n">defaults</span><span class="o">=</span><span class="p">{</span><span class="s">&#39;page&#39;</span><span class="p">:</span> <span class="s">&#39;index&#39;</span><span class="p">})</span>
+<span class="nd">@simple_page.route</span><span class="p">(</span><span class="s">&#39;/&lt;page&gt;&#39;</span><span class="p">)</span>
+<span class="k">def</span> <span class="nf">show</span><span class="p">(</span><span class="n">page</span><span class="p">):</span>
+ <span class="k">try</span><span class="p">:</span>
+ <span class="k">return</span> <span class="n">render_template</span><span class="p">(</span><span class="s">&#39;pages/</span><span class="si">%s</span><span class="s">.html&#39;</span> <span class="o">%</span> <span class="n">page</span><span class="p">)</span>
+ <span class="k">except</span> <span class="n">TemplateNotFound</span><span class="p">:</span>
+ <span class="n">abort</span><span class="p">(</span><span class="mi">404</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>When you bind a function with the help of the <tt class="docutils literal"><span class="pre">&#64;simple_page.route</span></tt>
+decorator the blueprint will record the intention of registering the
+function <cite>show</cite> on the application when it&#8217;s later registered.
+Additionally it will prefix the endpoint of the function with the
+name of the blueprint which was given to the <tt class="xref py py-class docutils literal"><span class="pre">Blueprint</span></tt>
+constructor (in this case also <tt class="docutils literal"><span class="pre">simple_page</span></tt>).</p>
+</div>
+<div class="section" id="registering-blueprints">
+<h2>Registering Blueprints<a class="headerlink" href="#registering-blueprints" title="Permalink to this headline">¶</a></h2>
+<p>So how do you register that blueprint? Like this:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">Flask</span>
+<span class="kn">from</span> <span class="nn">yourapplication.simple_page</span> <span class="kn">import</span> <span class="n">simple_page</span>
+
+<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">app</span><span class="o">.</span><span class="n">register_blueprint</span><span class="p">(</span><span class="n">simple_page</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>If you check the rules registered on the application, you will find
+these:</p>
+<div class="highlight-python"><pre>[&lt;Rule '/static/&lt;filename&gt;' (HEAD, OPTIONS, GET) -&gt; static&gt;,
+ &lt;Rule '/&lt;page&gt;' (HEAD, OPTIONS, GET) -&gt; simple_page.show&gt;,
+ &lt;Rule '/' (HEAD, OPTIONS, GET) -&gt; simple_page.show&gt;]</pre>
+</div>
+<p>The first one is obviously from the application ifself for the static
+files. The other two are for the <cite>show</cite> function of the <tt class="docutils literal"><span class="pre">simple_page</span></tt>
+blueprint. As you can see, they are also prefixed with the name of the
+blueprint and separated by a dot (<tt class="docutils literal"><span class="pre">.</span></tt>).</p>
+<p>Blueprints however can also be mounted at different locations:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="n">app</span><span class="o">.</span><span class="n">register_blueprint</span><span class="p">(</span><span class="n">simple_page</span><span class="p">,</span> <span class="n">url_prefix</span><span class="o">=</span><span class="s">&#39;/pages&#39;</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>And sure enough, these are the generated rules:</p>
+<div class="highlight-python"><pre>[&lt;Rule '/static/&lt;filename&gt;' (HEAD, OPTIONS, GET) -&gt; static&gt;,
+ &lt;Rule '/pages/&lt;page&gt;' (HEAD, OPTIONS, GET) -&gt; simple_page.show&gt;,
+ &lt;Rule '/pages/' (HEAD, OPTIONS, GET) -&gt; simple_page.show&gt;]</pre>
+</div>
+<p>On top of that you can register blueprints multiple times though not every
+blueprint might respond properly to that. In fact it depends on how the
+blueprint is implemented if it can be mounted more than once.</p>
+</div>
+<div class="section" id="blueprint-resources">
+<h2>Blueprint Resources<a class="headerlink" href="#blueprint-resources" title="Permalink to this headline">¶</a></h2>
+<p>Blueprints can provide resources as well. Sometimes you might want to
+introduce a blueprint only for the resources it provides.</p>
+<div class="section" id="blueprint-resource-folder">
+<h3>Blueprint Resource Folder<a class="headerlink" href="#blueprint-resource-folder" title="Permalink to this headline">¶</a></h3>
+<p>Like for regular applications, blueprints are considered to be contained
+in a folder. While multiple blueprints can originate from the same folder,
+it does not have to be the case and it&#8217;s usually not recommended.</p>
+<p>The folder is inferred from the second argument to <tt class="xref py py-class docutils literal"><span class="pre">Blueprint</span></tt> which
+is usually <cite>__name__</cite>. This argument specifies what logical Python
+module or package corresponds to the blueprint. If it points to an actual
+Python package that package (which is a folder on the filesystem) is the
+resource folder. If it&#8217;s a module, the package the module is contained in
+will be the resource folder. You can access the
+<tt class="xref py py-attr docutils literal"><span class="pre">Blueprint.root_path</span></tt> property to see what the resource folder is:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">simple_page</span><span class="o">.</span><span class="n">root_path</span>
+<span class="go">&#39;/Users/username/TestProject/yourapplication&#39;</span>
+</pre></div>
+</div>
+<p>To quickly open sources from this folder you can use the
+<tt class="xref py py-meth docutils literal"><span class="pre">open_resource()</span></tt> function:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">with</span> <span class="n">simple_page</span><span class="o">.</span><span class="n">open_resource</span><span class="p">(</span><span class="s">&#39;static/style.css&#39;</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
+ <span class="n">code</span> <span class="o">=</span> <span class="n">f</span><span class="o">.</span><span class="n">read</span><span class="p">()</span>
+</pre></div>
+</div>
+</div>
+<div class="section" id="static-files">
+<h3>Static Files<a class="headerlink" href="#static-files" title="Permalink to this headline">¶</a></h3>
+<p>A blueprint can expose a folder with static files by providing a path to a
+folder on the filesystem via the <cite>static_folder</cite> keyword argument. It can
+either be an absolute path or one relative to the folder of the
+blueprint:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="n">admin</span> <span class="o">=</span> <span class="n">Blueprint</span><span class="p">(</span><span class="s">&#39;admin&#39;</span><span class="p">,</span> <span class="n">__name__</span><span class="p">,</span> <span class="n">static_folder</span><span class="o">=</span><span class="s">&#39;static&#39;</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>By default the rightmost part of the path is where it is exposed on the
+web. Because the folder is called <tt class="docutils literal"><span class="pre">static</span></tt> here it will be available at
+the location of the blueprint + <tt class="docutils literal"><span class="pre">/static</span></tt>. Say the blueprint is
+registered for <tt class="docutils literal"><span class="pre">/admin</span></tt> the static folder will be at <tt class="docutils literal"><span class="pre">/admin/static</span></tt>.</p>
+<p>The endpoint is named <cite>blueprint_name.static</cite> so you can generate URLs to
+it like you would do to the static folder of the application:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="n">url_for</span><span class="p">(</span><span class="s">&#39;admin.static&#39;</span><span class="p">,</span> <span class="n">filename</span><span class="o">=</span><span class="s">&#39;style.css&#39;</span><span class="p">)</span>
+</pre></div>
+</div>
+</div>
+<div class="section" id="templates">
+<h3>Templates<a class="headerlink" href="#templates" title="Permalink to this headline">¶</a></h3>
+<p>If you want the blueprint to expose templates you can do that by providing
+the <cite>template_folder</cite> parameter to the <tt class="xref py py-class docutils literal"><span class="pre">Blueprint</span></tt> constructor:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="n">admin</span> <span class="o">=</span> <span class="n">Blueprint</span><span class="p">(</span><span class="s">&#39;admin&#39;</span><span class="p">,</span> <span class="n">__name__</span><span class="p">,</span> <span class="n">template_folder</span><span class="o">=</span><span class="s">&#39;templates&#39;</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>As for static files, the path can be absolute or relative to the blueprint
+resource folder. The template folder is added to the searchpath of
+templates but with a lower priority than the actual application&#8217;s template
+folder. That way you can easily override templates that a blueprint
+provides in the actual application.</p>
+<p>So if you have a blueprint in the folder <tt class="docutils literal"><span class="pre">yourapplication/admin</span></tt> and you
+want to render the template <tt class="docutils literal"><span class="pre">'admin/index.html'</span></tt> and you have provided
+<tt class="docutils literal"><span class="pre">templates</span></tt> as a <cite>template_folder</cite> you will have to create a file like
+this: <tt class="docutils literal"><span class="pre">yourapplication/admin/templates/admin/index.html</span></tt>.</p>
+</div>
+</div>
+<div class="section" id="building-urls">
+<h2>Building URLs<a class="headerlink" href="#building-urls" title="Permalink to this headline">¶</a></h2>
+<p>If you want to link from one page to another you can use the
+<tt class="xref py py-func docutils literal"><span class="pre">url_for()</span></tt> function just like you normally would do just that you
+prefix the URL endpoint with the name of the blueprint and a dot (<tt class="docutils literal"><span class="pre">.</span></tt>):</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="n">url_for</span><span class="p">(</span><span class="s">&#39;admin.index&#39;</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>Additionally if you are in a view function of a blueprint or a rendered
+template and you want to link to another endpoint of the same blueprint,
+you can use relative redirects by prefixing the endpoint with a dot only:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="n">url_for</span><span class="p">(</span><span class="s">&#39;.index&#39;</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>This will link to <tt class="docutils literal"><span class="pre">admin.index</span></tt> for instance in case the current request
+was dispatched to any other admin blueprint endpoint.</p>
+</div>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="index.html">
+ <img class="logo" src="_static/flask.png" alt="Logo"/>
+</a></p>
+ <h3><a href="index.html">Table Of Contents</a></h3>
+ <ul>
+<li><a class="reference internal" href="#">Modular Applications with Blueprints</a><ul>
+<li><a class="reference internal" href="#why-blueprints">Why Blueprints?</a></li>
+<li><a class="reference internal" href="#the-concept-of-blueprints">The Concept of Blueprints</a></li>
+<li><a class="reference internal" href="#my-first-blueprint">My First Blueprint</a></li>
+<li><a class="reference internal" href="#registering-blueprints">Registering Blueprints</a></li>
+<li><a class="reference internal" href="#blueprint-resources">Blueprint Resources</a><ul>
+<li><a class="reference internal" href="#blueprint-resource-folder">Blueprint Resource Folder</a></li>
+<li><a class="reference internal" href="#static-files">Static Files</a></li>
+<li><a class="reference internal" href="#templates">Templates</a></li>
+</ul>
+</li>
+<li><a class="reference internal" href="#building-urls">Building URLs</a></li>
+</ul>
+</li>
+</ul>
+<h3>Related Topics</h3>
+<ul>
+ <li><a href="index.html">Documentation overview</a><ul>
+ <li>Previous: <a href="reqcontext.html" title="previous chapter">The Request Context</a></li>
+ <li>Next: <a href="extensions.html" title="next chapter">Flask Extensions</a></li>
+ </ul></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="_sources/blueprints.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/changelog.html b/app/static/doc/flask-docs/changelog.html
new file mode 100644
index 0000000..482e029
--- /dev/null
+++ b/app/static/doc/flask-docs/changelog.html
@@ -0,0 +1,418 @@
+
+<!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>Flask Changelog &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="index.html" />
+ <link rel="next" title="License" href="license.html" />
+ <link rel="prev" title="Upgrading to Newer Releases" href="upgrading.html" />
+
+
+ <link rel="apple-touch-icon" href="_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <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="license.html" title="License"
+ accesskey="N">next</a> |</li>
+ <li class="right" >
+ <a href="upgrading.html" title="Upgrading to Newer Releases"
+ accesskey="P">previous</a> |</li>
+ <li><a href="index.html">Flask 0.8 documentation</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="flask-changelog">
+<h1>Flask Changelog<a class="headerlink" href="#flask-changelog" title="Permalink to this headline">¶</a></h1>
+<p>Here you can see the full list of changes between each Flask release.</p>
+<div class="section" id="version-0-9">
+<h2>Version 0.9<a class="headerlink" href="#version-0-9" title="Permalink to this headline">¶</a></h2>
+<p>Relase date to be decided, codename to be chosen.</p>
+</div>
+<div class="section" id="version-0-8">
+<h2>Version 0.8<a class="headerlink" href="#version-0-8" title="Permalink to this headline">¶</a></h2>
+<p>Released on September 29th 2011, codename Rakija</p>
+<ul class="simple">
+<li>Refactored session support into a session interface so that
+the implementation of the sessions can be changed without
+having to override the Flask class.</li>
+<li>Empty session cookies are now deleted properly automatically.</li>
+<li>View functions can now opt out of getting the automatic
+OPTIONS implementation.</li>
+<li>HTTP exceptions and Bad Request errors can now be trapped so that they
+show up normally in the traceback.</li>
+<li>Flask in debug mode is now detecting some common problems and tries to
+warn you about them.</li>
+<li>Flask in debug mode will now complain with an assertion error if a view
+was attached after the first request was handled. This gives earlier
+feedback when users forget to import view code ahead of time.</li>
+<li>Added the ability to register callbacks that are only triggered once at
+the beginning of the first request. (<tt class="xref py py-meth docutils literal"><span class="pre">Flask.before_first_request()</span></tt>)</li>
+<li>Malformed JSON data will now trigger a bad request HTTP exception instead
+of a value error which usually would result in a 500 internal server
+error if not handled. This is a backwards incompatible change.</li>
+<li>Applications now not only have a root path where the resources and modules
+are located but also an instane path which is the designated place to
+drop files that are modified at runtime (uploads etc.). Also this is
+conceptionally only instance depending and outside version control so it&#8217;s
+the perfect place to put configuration files etc. For more information
+see <a class="reference internal" href="config.html#instance-folders"><em>Instance Folders</em></a>.</li>
+<li>Added the <tt class="docutils literal"><span class="pre">APPLICATION_ROOT</span></tt> configuration variable.</li>
+<li>Implemented <tt class="xref py py-meth docutils literal"><span class="pre">session_transaction()</span></tt> to
+easily modify sessions from the test environment.</li>
+<li>Refactored test client internally. The <tt class="docutils literal"><span class="pre">APPLICATION_ROOT</span></tt> configuration
+variable as well as <tt class="docutils literal"><span class="pre">SERVER_NAME</span></tt> are now properly used by the test client
+as defaults.</li>
+<li>Added <a class="reference internal" href="api.html#flask.views.View.decorators" title="flask.views.View.decorators"><tt class="xref py py-attr docutils literal"><span class="pre">flask.views.View.decorators</span></tt></a> to support simpler decorating of
+pluggable (class based) views.</li>
+<li>Fixed an issue where the test client if used with the with statement did not
+trigger the execution of the teardown handlers.</li>
+<li>Added finer control over the session cookie parameters.</li>
+<li>HEAD requests to a method view now automatically dispatch to the <cite>get</cite>
+method if no handler was implemented.</li>
+<li>Implemented the virtual <tt class="xref py py-mod docutils literal"><span class="pre">flask.ext</span></tt> package to import extensions from.</li>
+<li>The context preservation on exceptions is now an integral component of
+Flask itself and no longer of the test client. This cleaned up some
+internal logic and lowers the odds of runaway request contexts in unittests.</li>
+</ul>
+</div>
+<div class="section" id="version-0-7-3">
+<h2>Version 0.7.3<a class="headerlink" href="#version-0-7-3" title="Permalink to this headline">¶</a></h2>
+<p>Bugfix release, release date to be decided</p>
+<ul class="simple">
+<li>Fixed the Jinja2 environment&#8217;s list_templates method not returning the
+correct names when blueprints or modules were involved.</li>
+</ul>
+</div>
+<div class="section" id="version-0-7-2">
+<h2>Version 0.7.2<a class="headerlink" href="#version-0-7-2" title="Permalink to this headline">¶</a></h2>
+<p>Bugfix release, released on July 6th 2011</p>
+<ul class="simple">
+<li>Fixed an issue with URL processors not properly working on
+blueprints.</li>
+</ul>
+</div>
+<div class="section" id="version-0-7-1">
+<h2>Version 0.7.1<a class="headerlink" href="#version-0-7-1" title="Permalink to this headline">¶</a></h2>
+<p>Bugfix release, released on June 29th 2011</p>
+<ul class="simple">
+<li>Added missing future import that broke 2.5 compatibility.</li>
+<li>Fixed an infinite redirect issue with blueprints.</li>
+</ul>
+</div>
+<div class="section" id="version-0-7">
+<h2>Version 0.7<a class="headerlink" href="#version-0-7" title="Permalink to this headline">¶</a></h2>
+<p>Released on June 28th 2011, codename Grappa</p>
+<ul class="simple">
+<li>Added <a class="reference internal" href="api.html#flask.Flask.make_default_options_response" title="flask.Flask.make_default_options_response"><tt class="xref py py-meth docutils literal"><span class="pre">make_default_options_response()</span></tt></a>
+which can be used by subclasses to alter the default
+behaviour for <cite>OPTIONS</cite> responses.</li>
+<li>Unbound locals now raise a proper <a class="reference external" href="http://docs.python.org/dev/library/exceptions.html#RuntimeError" title="(in Python v3.3)"><tt class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></tt></a> instead
+of an <a class="reference external" href="http://docs.python.org/dev/library/exceptions.html#AttributeError" title="(in Python v3.3)"><tt class="xref py py-exc docutils literal"><span class="pre">AttributeError</span></tt></a>.</li>
+<li>Mimetype guessing and etag support based on file objects is now
+deprecated for <a class="reference internal" href="api.html#flask.send_file" title="flask.send_file"><tt class="xref py py-func docutils literal"><span class="pre">flask.send_file()</span></tt></a> because it was unreliable.
+Pass filenames instead or attach your own etags and provide a
+proper mimetype by hand.</li>
+<li>Static file handling for modules now requires the name of the
+static folder to be supplied explicitly. The previous autodetection
+was not reliable and caused issues on Google&#8217;s App Engine. Until
+1.0 the old behaviour will continue to work but issue dependency
+warnings.</li>
+<li>fixed a problem for Flask to run on jython.</li>
+<li>added a <cite>PROPAGATE_EXCEPTIONS</cite> configuration variable that can be
+used to flip the setting of exception propagation which previously
+was linked to <cite>DEBUG</cite> alone and is now linked to either <cite>DEBUG</cite> or
+<cite>TESTING</cite>.</li>
+<li>Flask no longer internally depends on rules being added through the
+<cite>add_url_rule</cite> function and can now also accept regular werkzeug
+rules added to the url map.</li>
+<li>Added an <cite>endpoint</cite> method to the flask application object which
+allows one to register a callback to an arbitrary endpoint with
+a decorator.</li>
+<li>Use Last-Modified for static file sending instead of Date which
+was incorrectly introduced in 0.6.</li>
+<li>Added <cite>create_jinja_loader</cite> to override the loader creation process.</li>
+<li>Implemented a silent flag for <cite>config.from_pyfile</cite>.</li>
+<li>Added <cite>teardown_request</cite> decorator, for functions that should run at the end
+of a request regardless of whether an exception occurred. Also the behavior
+for <cite>after_request</cite> was changed. It&#8217;s now no longer executed when an exception
+is raised. See <a class="reference internal" href="upgrading.html#upgrading-to-new-teardown-handling"><em>Upgrading to new Teardown Handling</em></a></li>
+<li>Implemented <a class="reference internal" href="api.html#flask.has_request_context" title="flask.has_request_context"><tt class="xref py py-func docutils literal"><span class="pre">flask.has_request_context()</span></tt></a></li>
+<li>Deprecated <cite>init_jinja_globals</cite>. Override the
+<a class="reference internal" href="api.html#flask.Flask.create_jinja_environment" title="flask.Flask.create_jinja_environment"><tt class="xref py py-meth docutils literal"><span class="pre">create_jinja_environment()</span></tt></a> method instead to
+achieve the same functionality.</li>
+<li>Added <a class="reference internal" href="api.html#flask.safe_join" title="flask.safe_join"><tt class="xref py py-func docutils literal"><span class="pre">flask.safe_join()</span></tt></a></li>
+<li>The automatic JSON request data unpacking now looks at the charset
+mimetype parameter.</li>
+<li>Don&#8217;t modify the session on <a class="reference internal" href="api.html#flask.get_flashed_messages" title="flask.get_flashed_messages"><tt class="xref py py-func docutils literal"><span class="pre">flask.get_flashed_messages()</span></tt></a> if there
+are no messages in the session.</li>
+<li><cite>before_request</cite> handlers are now able to abort requests with errors.</li>
+<li>it is not possible to define user exception handlers. That way you can
+provide custom error messages from a central hub for certain errors that
+might occur during request processing (for instance database connection
+errors, timeouts from remote resources etc.).</li>
+<li>Blueprints can provide blueprint specific error handlers.</li>
+<li>Implemented generic <a class="reference internal" href="views.html#views"><em>Pluggable Views</em></a> (class based views).</li>
+</ul>
+</div>
+<div class="section" id="version-0-6-1">
+<h2>Version 0.6.1<a class="headerlink" href="#version-0-6-1" title="Permalink to this headline">¶</a></h2>
+<p>Bugfix release, released on December 31st 2010</p>
+<ul class="simple">
+<li>Fixed an issue where the default <cite>OPTIONS</cite> response was
+not exposing all valid methods in the <cite>Allow</cite> header.</li>
+<li>Jinja2 template loading syntax now allows &#8221;./&#8221; in front of
+a template load path. Previously this caused issues with
+module setups.</li>
+<li>Fixed an issue where the subdomain setting for modules was
+ignored for the static folder.</li>
+<li>Fixed a security problem that allowed clients to download arbitrary files
+if the host server was a windows based operating system and the client
+uses backslashes to escape the directory the files where exposed from.</li>
+</ul>
+</div>
+<div class="section" id="version-0-6">
+<h2>Version 0.6<a class="headerlink" href="#version-0-6" title="Permalink to this headline">¶</a></h2>
+<p>Released on July 27th 2010, codename Whisky</p>
+<ul class="simple">
+<li>after request functions are now called in reverse order of
+registration.</li>
+<li>OPTIONS is now automatically implemented by Flask unless the
+application explicitly adds &#8216;OPTIONS&#8217; as method to the URL rule.
+In this case no automatic OPTIONS handling kicks in.</li>
+<li>static rules are now even in place if there is no static folder
+for the module. This was implemented to aid GAE which will
+remove the static folder if it&#8217;s part of a mapping in the .yml
+file.</li>
+<li>the <a class="reference internal" href="api.html#flask.Flask.config" title="flask.Flask.config"><tt class="xref py py-attr docutils literal"><span class="pre">config</span></tt></a> is now available in the templates
+as <cite>config</cite>.</li>
+<li>context processors will no longer override values passed directly
+to the render function.</li>
+<li>added the ability to limit the incoming request data with the
+new <tt class="docutils literal"><span class="pre">MAX_CONTENT_LENGTH</span></tt> configuration value.</li>
+<li>the endpoint for the <tt class="xref py py-meth docutils literal"><span class="pre">flask.Module.add_url_rule()</span></tt> method
+is now optional to be consistent with the function of the
+same name on the application object.</li>
+<li>added a <a class="reference internal" href="api.html#flask.make_response" title="flask.make_response"><tt class="xref py py-func docutils literal"><span class="pre">flask.make_response()</span></tt></a> function that simplifies
+creating response object instances in views.</li>
+<li>added signalling support based on blinker. This feature is currently
+optional and supposed to be used by extensions and applications. If
+you want to use it, make sure to have <a class="reference external" href="http://pypi.python.org/pypi/blinker">blinker</a> installed.</li>
+<li>refactored the way URL adapters are created. This process is now
+fully customizable with the <a class="reference internal" href="api.html#flask.Flask.create_url_adapter" title="flask.Flask.create_url_adapter"><tt class="xref py py-meth docutils literal"><span class="pre">create_url_adapter()</span></tt></a>
+method.</li>
+<li>modules can now register for a subdomain instead of just an URL
+prefix. This makes it possible to bind a whole module to a
+configurable subdomain.</li>
+</ul>
+</div>
+<div class="section" id="version-0-5-2">
+<h2>Version 0.5.2<a class="headerlink" href="#version-0-5-2" title="Permalink to this headline">¶</a></h2>
+<p>Bugfix Release, released on July 15th 2010</p>
+<ul class="simple">
+<li>fixed another issue with loading templates from directories when
+modules were used.</li>
+</ul>
+</div>
+<div class="section" id="version-0-5-1">
+<h2>Version 0.5.1<a class="headerlink" href="#version-0-5-1" title="Permalink to this headline">¶</a></h2>
+<p>Bugfix Release, released on July 6th 2010</p>
+<ul class="simple">
+<li>fixes an issue with template loading from directories when modules
+where used.</li>
+</ul>
+</div>
+<div class="section" id="version-0-5">
+<h2>Version 0.5<a class="headerlink" href="#version-0-5" title="Permalink to this headline">¶</a></h2>
+<p>Released on July 6th 2010, codename Calvados</p>
+<ul class="simple">
+<li>fixed a bug with subdomains that was caused by the inability to
+specify the server name. The server name can now be set with
+the <cite>SERVER_NAME</cite> config key. This key is now also used to set
+the session cookie cross-subdomain wide.</li>
+<li>autoescaping is no longer active for all templates. Instead it
+is only active for <tt class="docutils literal"><span class="pre">.html</span></tt>, <tt class="docutils literal"><span class="pre">.htm</span></tt>, <tt class="docutils literal"><span class="pre">.xml</span></tt> and <tt class="docutils literal"><span class="pre">.xhtml</span></tt>.
+Inside templates this behaviour can be changed with the
+<tt class="docutils literal"><span class="pre">autoescape</span></tt> tag.</li>
+<li>refactored Flask internally. It now consists of more than a
+single file.</li>
+<li><a class="reference internal" href="api.html#flask.send_file" title="flask.send_file"><tt class="xref py py-func docutils literal"><span class="pre">flask.send_file()</span></tt></a> now emits etags and has the ability to
+do conditional responses builtin.</li>
+<li>(temporarily) dropped support for zipped applications. This was a
+rarely used feature and led to some confusing behaviour.</li>
+<li>added support for per-package template and static-file directories.</li>
+<li>removed support for <cite>create_jinja_loader</cite> which is no longer used
+in 0.5 due to the improved module support.</li>
+<li>added a helper function to expose files from any directory.</li>
+</ul>
+</div>
+<div class="section" id="version-0-4">
+<h2>Version 0.4<a class="headerlink" href="#version-0-4" title="Permalink to this headline">¶</a></h2>
+<p>Released on June 18th 2010, codename Rakia</p>
+<ul class="simple">
+<li>added the ability to register application wide error handlers
+from modules.</li>
+<li><a class="reference internal" href="api.html#flask.Flask.after_request" title="flask.Flask.after_request"><tt class="xref py py-meth docutils literal"><span class="pre">after_request()</span></tt></a> handlers are now also invoked
+if the request dies with an exception and an error handling page
+kicks in.</li>
+<li>test client has not the ability to preserve the request context
+for a little longer. This can also be used to trigger custom
+requests that do not pop the request stack for testing.</li>
+<li>because the Python standard library caches loggers, the name of
+the logger is configurable now to better support unittests.</li>
+<li>added <cite>TESTING</cite> switch that can activate unittesting helpers.</li>
+<li>the logger switches to <cite>DEBUG</cite> mode now if debug is enabled.</li>
+</ul>
+</div>
+<div class="section" id="version-0-3-1">
+<h2>Version 0.3.1<a class="headerlink" href="#version-0-3-1" title="Permalink to this headline">¶</a></h2>
+<p>Bugfix release, released on May 28th 2010</p>
+<ul class="simple">
+<li>fixed a error reporting bug with <a class="reference internal" href="api.html#flask.Config.from_envvar" title="flask.Config.from_envvar"><tt class="xref py py-meth docutils literal"><span class="pre">flask.Config.from_envvar()</span></tt></a></li>
+<li>removed some unused code from flask</li>
+<li>release does no longer include development leftover files (.git
+folder for themes, built documentation in zip and pdf file and
+some .pyc files)</li>
+</ul>
+</div>
+<div class="section" id="version-0-3">
+<h2>Version 0.3<a class="headerlink" href="#version-0-3" title="Permalink to this headline">¶</a></h2>
+<p>Released on May 28th 2010, codename Schnaps</p>
+<ul class="simple">
+<li>added support for categories for flashed messages.</li>
+<li>the application now configures a <tt class="xref py py-class docutils literal"><span class="pre">logging.Handler</span></tt> and will
+log request handling exceptions to that logger when not in debug
+mode. This makes it possible to receive mails on server errors
+for example.</li>
+<li>added support for context binding that does not require the use of
+the with statement for playing in the console.</li>
+<li>the request context is now available within the with statement making
+it possible to further push the request context or pop it.</li>
+<li>added support for configurations.</li>
+</ul>
+</div>
+<div class="section" id="version-0-2">
+<h2>Version 0.2<a class="headerlink" href="#version-0-2" title="Permalink to this headline">¶</a></h2>
+<p>Released on May 12th 2010, codename Jägermeister</p>
+<ul class="simple">
+<li>various bugfixes</li>
+<li>integrated JSON support</li>
+<li>added <a class="reference internal" href="api.html#flask.get_template_attribute" title="flask.get_template_attribute"><tt class="xref py py-func docutils literal"><span class="pre">get_template_attribute()</span></tt></a> helper function.</li>
+<li><a class="reference internal" href="api.html#flask.Flask.add_url_rule" title="flask.Flask.add_url_rule"><tt class="xref py py-meth docutils literal"><span class="pre">add_url_rule()</span></tt></a> can now also register a
+view function.</li>
+<li>refactored internal request dispatching.</li>
+<li>server listens on 127.0.0.1 by default now to fix issues with chrome.</li>
+<li>added external URL support.</li>
+<li>added support for <a class="reference internal" href="api.html#flask.send_file" title="flask.send_file"><tt class="xref py py-func docutils literal"><span class="pre">send_file()</span></tt></a></li>
+<li>module support and internal request handling refactoring
+to better support pluggable applications.</li>
+<li>sessions can be set to be permanent now on a per-session basis.</li>
+<li>better error reporting on missing secret keys.</li>
+<li>added support for Google Appengine.</li>
+</ul>
+</div>
+<div class="section" id="version-0-1">
+<h2>Version 0.1<a class="headerlink" href="#version-0-1" title="Permalink to this headline">¶</a></h2>
+<p>First public preview release.</p>
+</div>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="index.html">
+ <img class="logo" src="_static/flask.png" alt="Logo"/>
+</a></p>
+ <h3><a href="index.html">Table Of Contents</a></h3>
+ <ul>
+<li><a class="reference internal" href="#">Flask Changelog</a><ul>
+<li><a class="reference internal" href="#version-0-9">Version 0.9</a></li>
+<li><a class="reference internal" href="#version-0-8">Version 0.8</a></li>
+<li><a class="reference internal" href="#version-0-7-3">Version 0.7.3</a></li>
+<li><a class="reference internal" href="#version-0-7-2">Version 0.7.2</a></li>
+<li><a class="reference internal" href="#version-0-7-1">Version 0.7.1</a></li>
+<li><a class="reference internal" href="#version-0-7">Version 0.7</a></li>
+<li><a class="reference internal" href="#version-0-6-1">Version 0.6.1</a></li>
+<li><a class="reference internal" href="#version-0-6">Version 0.6</a></li>
+<li><a class="reference internal" href="#version-0-5-2">Version 0.5.2</a></li>
+<li><a class="reference internal" href="#version-0-5-1">Version 0.5.1</a></li>
+<li><a class="reference internal" href="#version-0-5">Version 0.5</a></li>
+<li><a class="reference internal" href="#version-0-4">Version 0.4</a></li>
+<li><a class="reference internal" href="#version-0-3-1">Version 0.3.1</a></li>
+<li><a class="reference internal" href="#version-0-3">Version 0.3</a></li>
+<li><a class="reference internal" href="#version-0-2">Version 0.2</a></li>
+<li><a class="reference internal" href="#version-0-1">Version 0.1</a></li>
+</ul>
+</li>
+</ul>
+<h3>Related Topics</h3>
+<ul>
+ <li><a href="index.html">Documentation overview</a><ul>
+ <li>Previous: <a href="upgrading.html" title="previous chapter">Upgrading to Newer Releases</a></li>
+ <li>Next: <a href="license.html" title="next chapter">License</a></li>
+ </ul></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="_sources/changelog.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/config.html b/app/static/doc/flask-docs/config.html
new file mode 100644
index 0000000..c569e8f
--- /dev/null
+++ b/app/static/doc/flask-docs/config.html
@@ -0,0 +1,505 @@
+
+<!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>Configuration Handling &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="index.html" />
+ <link rel="next" title="Signals" href="signals.html" />
+ <link rel="prev" title="Handling Application Errors" href="errorhandling.html" />
+
+
+ <link rel="apple-touch-icon" href="_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <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="signals.html" title="Signals"
+ accesskey="N">next</a> |</li>
+ <li class="right" >
+ <a href="errorhandling.html" title="Handling Application Errors"
+ accesskey="P">previous</a> |</li>
+ <li><a href="index.html">Flask 0.8 documentation</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="configuration-handling">
+<span id="config"></span><h1>Configuration Handling<a class="headerlink" href="#configuration-handling" title="Permalink to this headline">¶</a></h1>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.3.</span></p>
+<p>Applications need some kind of configuration. There are different settings
+you might want to change depending on the application environment like
+toggling the debug mode, setting the secret key, and other such
+environment-specific things.</p>
+<p>The way Flask is designed usually requires the configuration to be
+available when the application starts up. You can hardcode the
+configuration in the code, which for many small applications is not
+actually that bad, but there are better ways.</p>
+<p>Independent of how you load your config, there is a config object
+available which holds the loaded configuration values:
+The <a class="reference internal" href="api.html#flask.Flask.config" title="flask.Flask.config"><tt class="xref py py-attr docutils literal"><span class="pre">config</span></tt></a> attribute of the <a class="reference internal" href="api.html#flask.Flask" title="flask.Flask"><tt class="xref py py-class docutils literal"><span class="pre">Flask</span></tt></a>
+object. This is the place where Flask itself puts certain configuration
+values and also where extensions can put their configuration values. But
+this is also where you can have your own configuration.</p>
+<div class="section" id="configuration-basics">
+<h2>Configuration Basics<a class="headerlink" href="#configuration-basics" title="Permalink to this headline">¶</a></h2>
+<p>The <a class="reference internal" href="api.html#flask.Flask.config" title="flask.Flask.config"><tt class="xref py py-attr docutils literal"><span class="pre">config</span></tt></a> is actually a subclass of a dictionary and
+can be modified just like any dictionary:</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">app</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s">&#39;DEBUG&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="bp">True</span>
+</pre></div>
+</div>
+<p>Certain configuration values are also forwarded to the
+<a class="reference internal" href="api.html#flask.Flask" title="flask.Flask"><tt class="xref py py-attr docutils literal"><span class="pre">Flask</span></tt></a> object so you can read and write them from there:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="n">app</span><span class="o">.</span><span class="n">debug</span> <span class="o">=</span> <span class="bp">True</span>
+</pre></div>
+</div>
+<p>To update multiple keys at once you can use the <a class="reference external" href="http://docs.python.org/dev/library/stdtypes.html#dict.update" title="(in Python v3.3)"><tt class="xref py py-meth docutils literal"><span class="pre">dict.update()</span></tt></a>
+method:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="n">app</span><span class="o">.</span><span class="n">config</span><span class="o">.</span><span class="n">update</span><span class="p">(</span>
+ <span class="n">DEBUG</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span>
+ <span class="n">SECRET_KEY</span><span class="o">=</span><span class="s">&#39;...&#39;</span>
+<span class="p">)</span>
+</pre></div>
+</div>
+</div>
+<div class="section" id="builtin-configuration-values">
+<h2>Builtin Configuration Values<a class="headerlink" href="#builtin-configuration-values" title="Permalink to this headline">¶</a></h2>
+<p>The following configuration values are used internally by Flask:</p>
+<table border="1" class="docutils">
+<colgroup>
+<col width="45%" />
+<col width="55%" />
+</colgroup>
+<tbody valign="top">
+<tr class="row-odd"><td><tt class="docutils literal"><span class="pre">DEBUG</span></tt></td>
+<td>enable/disable debug mode</td>
+</tr>
+<tr class="row-even"><td><tt class="docutils literal"><span class="pre">TESTING</span></tt></td>
+<td>enable/disable testing mode</td>
+</tr>
+<tr class="row-odd"><td><tt class="docutils literal"><span class="pre">PROPAGATE_EXCEPTIONS</span></tt></td>
+<td>explicitly enable or disable the
+propagation of exceptions. If not set or
+explicitly set to <cite>None</cite> this is
+implicitly true if either <cite>TESTING</cite> or
+<cite>DEBUG</cite> is true.</td>
+</tr>
+<tr class="row-even"><td><tt class="docutils literal"><span class="pre">PRESERVE_CONTEXT_ON_EXCEPTION</span></tt></td>
+<td>By default if the application is in
+debug mode the request context is not
+popped on exceptions to enable debuggers
+to introspect the data. This can be
+disabled by this key. You can also use
+this setting to force-enable it for non
+debug execution which might be useful to
+debug production applications (but also
+very risky).</td>
+</tr>
+<tr class="row-odd"><td><tt class="docutils literal"><span class="pre">SECRET_KEY</span></tt></td>
+<td>the secret key</td>
+</tr>
+<tr class="row-even"><td><tt class="docutils literal"><span class="pre">SESSION_COOKIE_NAME</span></tt></td>
+<td>the name of the session cookie</td>
+</tr>
+<tr class="row-odd"><td><tt class="docutils literal"><span class="pre">SESSION_COOKIE_DOMAIN</span></tt></td>
+<td>the domain for the session cookie. If
+this is not set, the cookie will be
+valid for all subdomains of
+<tt class="docutils literal"><span class="pre">SERVER_NAME</span></tt>.</td>
+</tr>
+<tr class="row-even"><td><tt class="docutils literal"><span class="pre">SESSION_COOKIE_PATH</span></tt></td>
+<td>the path for the session cookie. If
+this is not set the cookie will be valid
+for all of <tt class="docutils literal"><span class="pre">APPLICATION_ROOT</span></tt> or if
+that is not set for <tt class="docutils literal"><span class="pre">'/'</span></tt>.</td>
+</tr>
+<tr class="row-odd"><td><tt class="docutils literal"><span class="pre">SESSION_COOKIE_HTTPONLY</span></tt></td>
+<td>controls if the cookie should be set
+with the httponly flag. Defaults to
+<cite>True</cite>.</td>
+</tr>
+<tr class="row-even"><td><tt class="docutils literal"><span class="pre">SESSION_COOKIE_SECURE</span></tt></td>
+<td>controls if the cookie should be set
+with the secure flag. Defaults to
+<cite>False</cite>.</td>
+</tr>
+<tr class="row-odd"><td><tt class="docutils literal"><span class="pre">PERMANENT_SESSION_LIFETIME</span></tt></td>
+<td>the lifetime of a permanent session as
+<a class="reference external" href="http://docs.python.org/dev/library/datetime.html#datetime.timedelta" title="(in Python v3.3)"><tt class="xref py py-class docutils literal"><span class="pre">datetime.timedelta</span></tt></a> object.
+Starting with Flask 0.8 this can also be
+an integer representing seconds.</td>
+</tr>
+<tr class="row-even"><td><tt class="docutils literal"><span class="pre">USE_X_SENDFILE</span></tt></td>
+<td>enable/disable x-sendfile</td>
+</tr>
+<tr class="row-odd"><td><tt class="docutils literal"><span class="pre">LOGGER_NAME</span></tt></td>
+<td>the name of the logger</td>
+</tr>
+<tr class="row-even"><td><tt class="docutils literal"><span class="pre">SERVER_NAME</span></tt></td>
+<td>the name and port number of the server.
+Required for subdomain support (e.g.:
+<tt class="docutils literal"><span class="pre">'myapp.dev:5000'</span></tt>) Note that
+localhost does not support subdomains so
+setting this to “localhost” does not
+help.</td>
+</tr>
+<tr class="row-odd"><td><tt class="docutils literal"><span class="pre">APPLICATION_ROOT</span></tt></td>
+<td>If the application does not occupy
+a whole domain or subdomain this can
+be set to the path where the application
+is configured to live. This is for
+session cookie as path value. If
+domains are used, this should be
+<tt class="docutils literal"><span class="pre">None</span></tt>.</td>
+</tr>
+<tr class="row-even"><td><tt class="docutils literal"><span class="pre">MAX_CONTENT_LENGTH</span></tt></td>
+<td>If set to a value in bytes, Flask will
+reject incoming requests with a
+content length greater than this by
+returning a 413 status code.</td>
+</tr>
+<tr class="row-odd"><td><tt class="docutils literal"><span class="pre">TRAP_HTTP_EXCEPTIONS</span></tt></td>
+<td>If this is set to <tt class="docutils literal"><span class="pre">True</span></tt> Flask will
+not execute the error handlers of HTTP
+exceptions but instead treat the
+exception like any other and bubble it
+through the exception stack. This is
+helpful for hairy debugging situations
+where you have to find out where an HTTP
+exception is coming from.</td>
+</tr>
+<tr class="row-even"><td><tt class="docutils literal"><span class="pre">TRAP_BAD_REQUEST_ERRORS</span></tt></td>
+<td>Werkzeug&#8217;s internal data structures that
+deal with request specific data will
+raise special key errors that are also
+bad request exceptions. Likewise many
+operations can implicitly fail with a
+BadRequest exception for consistency.
+Since it&#8217;s nice for debugging to know
+why exactly it failed this flag can be
+used to debug those situations. If this
+config is set to <tt class="docutils literal"><span class="pre">True</span></tt> you will get
+a regular traceback instead.</td>
+</tr>
+</tbody>
+</table>
+<div class="admonition-more-on-server-name admonition ">
+<p class="first admonition-title">More on <tt class="docutils literal"><span class="pre">SERVER_NAME</span></tt></p>
+<p>The <tt class="docutils literal"><span class="pre">SERVER_NAME</span></tt> key is used for the subdomain support. Because
+Flask cannot guess the subdomain part without the knowledge of the
+actual server name, this is required if you want to work with
+subdomains. This is also used for the session cookie.</p>
+<p class="last">Please keep in mind that not only Flask has the problem of not knowing
+what subdomains are, your web browser does as well. Most modern web
+browsers will not allow cross-subdomain cookies to be set on a
+server name without dots in it. So if your server name is
+<tt class="docutils literal"><span class="pre">'localhost'</span></tt> you will not be able to set a cookie for
+<tt class="docutils literal"><span class="pre">'localhost'</span></tt> and every subdomain of it. Please chose a different
+server name in that case, like <tt class="docutils literal"><span class="pre">'myapplication.local'</span></tt> and add
+this name + the subdomains you want to use into your host config
+or setup a local <a class="reference external" href="https://www.isc.org/software/bind">bind</a>.</p>
+</div>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.4: </span><tt class="docutils literal"><span class="pre">LOGGER_NAME</span></tt></p>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.5: </span><tt class="docutils literal"><span class="pre">SERVER_NAME</span></tt></p>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.6: </span><tt class="docutils literal"><span class="pre">MAX_CONTENT_LENGTH</span></tt></p>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.7: </span><tt class="docutils literal"><span class="pre">PROPAGATE_EXCEPTIONS</span></tt>, <tt class="docutils literal"><span class="pre">PRESERVE_CONTEXT_ON_EXCEPTION</span></tt></p>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.8: </span><tt class="docutils literal"><span class="pre">TRAP_BAD_REQUEST_ERRORS</span></tt>, <tt class="docutils literal"><span class="pre">TRAP_HTTP_EXCEPTIONS</span></tt>,
+<tt class="docutils literal"><span class="pre">APPLICATION_ROOT</span></tt>, <tt class="docutils literal"><span class="pre">SESSION_COOKIE_DOMAIN</span></tt>,
+<tt class="docutils literal"><span class="pre">SESSION_COOKIE_PATH</span></tt>, <tt class="docutils literal"><span class="pre">SESSION_COOKIE_HTTPONLY</span></tt>,
+<tt class="docutils literal"><span class="pre">SESSION_COOKIE_SECURE</span></tt></p>
+</div>
+<div class="section" id="configuring-from-files">
+<h2>Configuring from Files<a class="headerlink" href="#configuring-from-files" title="Permalink to this headline">¶</a></h2>
+<p>Configuration becomes more useful if you can store it in a separate file,
+ideally located outside the actual application package. This makes
+packaging and distributing your application possible via various package
+handling tools (<a class="reference internal" href="patterns/distribute.html#distribute-deployment"><em>Deploying with Distribute</em></a>) and finally modifying the
+configuration file afterwards.</p>
+<p>So a common pattern is this:</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">app</span><span class="o">.</span><span class="n">config</span><span class="o">.</span><span class="n">from_object</span><span class="p">(</span><span class="s">&#39;yourapplication.default_settings&#39;</span><span class="p">)</span>
+<span class="n">app</span><span class="o">.</span><span class="n">config</span><span class="o">.</span><span class="n">from_envvar</span><span class="p">(</span><span class="s">&#39;YOURAPPLICATION_SETTINGS&#39;</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>This first loads the configuration from the
+<cite>yourapplication.default_settings</cite> module and then overrides the values
+with the contents of the file the <span class="target" id="index-0"></span><tt class="xref std std-envvar docutils literal"><span class="pre">YOURAPPLICATION_SETTINGS</span></tt>
+environment variable points to. This environment variable can be set on
+Linux or OS X with the export command in the shell before starting the
+server:</p>
+<div class="highlight-python"><pre>$ export YOURAPPLICATION_SETTINGS=/path/to/settings.cfg
+$ python run-app.py
+ * Running on http://127.0.0.1:5000/
+ * Restarting with reloader...</pre>
+</div>
+<p>On Windows systems use the <cite>set</cite> builtin instead:</p>
+<div class="highlight-python"><pre>&gt;set YOURAPPLICATION_SETTINGS=\path\to\settings.cfg</pre>
+</div>
+<p>The configuration files themselves are actual Python files. Only values
+in uppercase are actually stored in the config object later on. So make
+sure to use uppercase letters for your config keys.</p>
+<p>Here is an example of a configuration file:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="c"># Example configuration</span>
+<span class="n">DEBUG</span> <span class="o">=</span> <span class="bp">False</span>
+<span class="n">SECRET_KEY</span> <span class="o">=</span> <span class="s">&#39;?</span><span class="se">\xbf</span><span class="s">,</span><span class="se">\xb4\x8d\xa3</span><span class="s">&quot;&lt;</span><span class="se">\x9c\xb0</span><span class="s">@</span><span class="se">\x0f</span><span class="s">5</span><span class="se">\xab</span><span class="s">,w</span><span class="se">\xee\x8d</span><span class="s">$0</span><span class="se">\x13\x8b</span><span class="s">83&#39;</span>
+</pre></div>
+</div>
+<p>Make sure to load the configuration very early on, so that extensions have
+the ability to access the configuration when starting up. There are other
+methods on the config object as well to load from individual files. For a
+complete reference, read the <a class="reference internal" href="api.html#flask.Config" title="flask.Config"><tt class="xref py py-class docutils literal"><span class="pre">Config</span></tt></a> object&#8217;s
+documentation.</p>
+</div>
+<div class="section" id="configuration-best-practices">
+<h2>Configuration Best Practices<a class="headerlink" href="#configuration-best-practices" title="Permalink to this headline">¶</a></h2>
+<p>The downside with the approach mentioned earlier is that it makes testing
+a little harder. There is no single 100% solution for this problem in
+general, but there are a couple of things you can keep in mind to improve
+that experience:</p>
+<ol class="arabic simple">
+<li>create your application in a function and register blueprints on it.
+That way you can create multiple instances of your application with
+different configurations attached which makes unittesting a lot
+easier. You can use this to pass in configuration as needed.</li>
+<li>Do not write code that needs the configuration at import time. If you
+limit yourself to request-only accesses to the configuration you can
+reconfigure the object later on as needed.</li>
+</ol>
+</div>
+<div class="section" id="development-production">
+<h2>Development / Production<a class="headerlink" href="#development-production" title="Permalink to this headline">¶</a></h2>
+<p>Most applications need more than one configuration. There should be at
+least separate configurations for the production server and the one used
+during development. The easiest way to handle this is to use a default
+configuration that is always loaded and part of the version control, and a
+separate configuration that overrides the values as necessary as mentioned
+in the example above:</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">app</span><span class="o">.</span><span class="n">config</span><span class="o">.</span><span class="n">from_object</span><span class="p">(</span><span class="s">&#39;yourapplication.default_settings&#39;</span><span class="p">)</span>
+<span class="n">app</span><span class="o">.</span><span class="n">config</span><span class="o">.</span><span class="n">from_envvar</span><span class="p">(</span><span class="s">&#39;YOURAPPLICATION_SETTINGS&#39;</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>Then you just have to add a separate <cite>config.py</cite> file and export
+<tt class="docutils literal"><span class="pre">YOURAPPLICATION_SETTINGS=/path/to/config.py</span></tt> and you are done. However
+there are alternative ways as well. For example you could use imports or
+subclassing.</p>
+<p>What is very popular in the Django world is to make the import explicit in
+the config file by adding an <tt class="docutils literal"><span class="pre">from</span> <span class="pre">yourapplication.default_settings</span>
+<span class="pre">import</span> <span class="pre">*</span></tt> to the top of the file and then overriding the changes by hand.
+You could also inspect an environment variable like
+<tt class="docutils literal"><span class="pre">YOURAPPLICATION_MODE</span></tt> and set that to <cite>production</cite>, <cite>development</cite> etc
+and import different hardcoded files based on that.</p>
+<p>An interesting pattern is also to use classes and inheritance for
+configuration:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">class</span> <span class="nc">Config</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
+ <span class="n">DEBUG</span> <span class="o">=</span> <span class="bp">False</span>
+ <span class="n">TESTING</span> <span class="o">=</span> <span class="bp">False</span>
+ <span class="n">DATABASE_URI</span> <span class="o">=</span> <span class="s">&#39;sqlite://:memory:&#39;</span>
+
+<span class="k">class</span> <span class="nc">ProductionConfig</span><span class="p">(</span><span class="n">Config</span><span class="p">):</span>
+ <span class="n">DATABASE_URI</span> <span class="o">=</span> <span class="s">&#39;mysql://user@localhost/foo&#39;</span>
+
+<span class="k">class</span> <span class="nc">DevelopmentConfig</span><span class="p">(</span><span class="n">Config</span><span class="p">):</span>
+ <span class="n">DEBUG</span> <span class="o">=</span> <span class="bp">True</span>
+
+<span class="k">class</span> <span class="nc">TestingConfig</span><span class="p">(</span><span class="n">Config</span><span class="p">):</span>
+ <span class="n">TESTING</span> <span class="o">=</span> <span class="bp">True</span>
+</pre></div>
+</div>
+<p>To enable such a config you just have to call into
+<a class="reference internal" href="api.html#flask.Config.from_object" title="flask.Config.from_object"><tt class="xref py py-meth docutils literal"><span class="pre">from_object()</span></tt></a>:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="n">app</span><span class="o">.</span><span class="n">config</span><span class="o">.</span><span class="n">from_object</span><span class="p">(</span><span class="s">&#39;configmodule.ProductionConfig&#39;</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>There are many different ways and it&#8217;s up to you how you want to manage
+your configuration files. However here a list of good recommendations:</p>
+<ul class="simple">
+<li>keep a default configuration in version control. Either populate the
+config with this default configuration or import it in your own
+configuration files before overriding values.</li>
+<li>use an environment variable to switch between the configurations.
+This can be done from outside the Python interpreter and makes
+development and deployment much easier because you can quickly and
+easily switch between different configs without having to touch the
+code at all. If you are working often on different projects you can
+even create your own script for sourcing that activates a virtualenv
+and exports the development configuration for you.</li>
+<li>Use a tool like <a class="reference external" href="http://fabfile.org/">fabric</a> in production to push code and
+configurations separately to the production server(s). For some
+details about how to do that, head over to the
+<a class="reference internal" href="patterns/fabric.html#fabric-deployment"><em>Deploying with Fabric</em></a> pattern.</li>
+</ul>
+</div>
+<div class="section" id="instance-folders">
+<span id="id1"></span><h2>Instance Folders<a class="headerlink" href="#instance-folders" title="Permalink to this headline">¶</a></h2>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.8.</span></p>
+<p>Flask 0.8 introduces instance folders. Flask for a long time made it
+possible to refer to paths relative to the application&#8217;s folder directly
+(via <tt class="xref py py-attr docutils literal"><span class="pre">Flask.root_path</span></tt>). This was also how many developers loaded
+configurations stored next to the application. Unfortunately however this
+only works well if applications are not packages in which case the root
+path refers to the contents of the package.</p>
+<p>With Flask 0.8 a new attribute was introduced:
+<tt class="xref py py-attr docutils literal"><span class="pre">Flask.instance_path</span></tt>. It refers to a new concept called the
+“instance folder”. The instance folder is designed to not be under
+version control and be deployment specific. It&#8217;s the perfect place to
+drop things that either change at runtime or configuration files.</p>
+<p>You can either explicitly provide the path of the instance folder when
+creating the Flask application or you can let Flask autodetect the
+instance folder. For explicit configuration use the <cite>instance_path</cite>
+parameter:</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">instance_path</span><span class="o">=</span><span class="s">&#39;/path/to/instance/folder&#39;</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>Please keep in mind that this path <em>must</em> be absolute when provided.</p>
+<p>If the <cite>instance_path</cite> parameter is not provided the following default
+locations are used:</p>
+<ul>
+<li><p class="first">Uninstalled module:</p>
+<div class="highlight-python"><pre>/myapp.py
+/instance</pre>
+</div>
+</li>
+<li><p class="first">Uninstalled package:</p>
+<div class="highlight-python"><pre>/myapp
+ /__init__.py
+/instance</pre>
+</div>
+</li>
+<li><p class="first">Installed module or package:</p>
+<div class="highlight-python"><pre>$PREFIX/lib/python2.X/site-packages/myapp
+$PREFIX/var/myapp-instance</pre>
+</div>
+<p><tt class="docutils literal"><span class="pre">$PREFIX</span></tt> is the prefix of your Python installation. This can be
+<tt class="docutils literal"><span class="pre">/usr</span></tt> or the path to your virtualenv. You can print the value of
+<tt class="docutils literal"><span class="pre">sys.prefix</span></tt> to see what the prefix is set to.</p>
+</li>
+</ul>
+<p>Since the config object provided loading of configuration files from
+relative filenames we made it possible to change the loading via filenames
+to be relative to the instance path if wanted. The behavior of relative
+paths in config files can be flipped between “relative to the application
+root” (the default) to “relative to instance folder” via the
+<cite>instance_relative_config</cite> switch to the application constructor:</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">instance_relative_config</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>Here is a full example of how to configure Flask to preload the config
+from a module and then override the config from a file in the config
+folder if it exists:</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">instance_relative_config</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
+<span class="n">app</span><span class="o">.</span><span class="n">config</span><span class="o">.</span><span class="n">from_object</span><span class="p">(</span><span class="s">&#39;yourapplication.default_settings&#39;</span><span class="p">)</span>
+<span class="n">app</span><span class="o">.</span><span class="n">config</span><span class="o">.</span><span class="n">from_pyfile</span><span class="p">(</span><span class="s">&#39;application.cfg&#39;</span><span class="p">,</span> <span class="n">silent</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>The path to the instance folder can be found via the
+<tt class="xref py py-attr docutils literal"><span class="pre">Flask.instance_path</span></tt>. Flask also provides a shortcut to open a
+file from the instance folder with <tt class="xref py py-meth docutils literal"><span class="pre">Flask.open_instance_resource()</span></tt>.</p>
+<p>Example usage for both:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="n">filename</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">app</span><span class="o">.</span><span class="n">instance_root</span><span class="p">,</span> <span class="s">&#39;application.cfg&#39;</span><span class="p">)</span>
+<span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">filename</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
+ <span class="n">config</span> <span class="o">=</span> <span class="n">f</span><span class="o">.</span><span class="n">read</span><span class="p">()</span>
+
+<span class="c"># or via open_instance_resource:</span>
+<span class="k">with</span> <span class="n">app</span><span class="o">.</span><span class="n">open_instance_resource</span><span class="p">(</span><span class="s">&#39;application.cfg&#39;</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
+ <span class="n">config</span> <span class="o">=</span> <span class="n">f</span><span class="o">.</span><span class="n">read</span><span class="p">()</span>
+</pre></div>
+</div>
+</div>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="index.html">
+ <img class="logo" src="_static/flask.png" alt="Logo"/>
+</a></p>
+ <h3><a href="index.html">Table Of Contents</a></h3>
+ <ul>
+<li><a class="reference internal" href="#">Configuration Handling</a><ul>
+<li><a class="reference internal" href="#configuration-basics">Configuration Basics</a></li>
+<li><a class="reference internal" href="#builtin-configuration-values">Builtin Configuration Values</a></li>
+<li><a class="reference internal" href="#configuring-from-files">Configuring from Files</a></li>
+<li><a class="reference internal" href="#configuration-best-practices">Configuration Best Practices</a></li>
+<li><a class="reference internal" href="#development-production">Development / Production</a></li>
+<li><a class="reference internal" href="#instance-folders">Instance Folders</a></li>
+</ul>
+</li>
+</ul>
+<h3>Related Topics</h3>
+<ul>
+ <li><a href="index.html">Documentation overview</a><ul>
+ <li>Previous: <a href="errorhandling.html" title="previous chapter">Handling Application Errors</a></li>
+ <li>Next: <a href="signals.html" title="next chapter">Signals</a></li>
+ </ul></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="_sources/config.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/deploying/cgi.html b/app/static/doc/flask-docs/deploying/cgi.html
new file mode 100644
index 0000000..0471329
--- /dev/null
+++ b/app/static/doc/flask-docs/deploying/cgi.html
@@ -0,0 +1,153 @@
+
+<!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>CGI &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="../index.html" />
+ <link rel="up" title="Deployment Options" href="index.html" />
+ <link rel="next" title="FastCGI" href="fastcgi.html" />
+ <link rel="prev" title="mod_wsgi (Apache)" href="mod_wsgi.html" />
+
+
+ <link rel="apple-touch-icon" href="../_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="../_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <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="fastcgi.html" title="FastCGI"
+ accesskey="N">next</a> |</li>
+ <li class="right" >
+ <a href="mod_wsgi.html" title="mod_wsgi (Apache)"
+ accesskey="P">previous</a> |</li>
+ <li><a href="../index.html">Flask 0.8 documentation</a> &raquo;</li>
+ <li><a href="index.html" accesskey="U">Deployment Options</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="cgi">
+<h1>CGI<a class="headerlink" href="#cgi" title="Permalink to this headline">¶</a></h1>
+<p>If all other deployment methods do not work, CGI will work for sure.
+CGI is supported by all major servers but usually has a sub-optimal
+performance.</p>
+<p>This is also the way you can use a Flask application on Google&#8217;s <a class="reference external" href="http://code.google.com/appengine/">App
+Engine</a>, where execution happens in a CGI-like environment.</p>
+<div class="admonition-watch-out admonition ">
+<p class="first admonition-title">Watch Out</p>
+<p class="last">Please make sure in advance that any <tt class="docutils literal"><span class="pre">app.run()</span></tt> calls you might
+have in your application file are inside an <tt class="docutils literal"><span class="pre">if</span> <span class="pre">__name__</span> <span class="pre">==</span>
+<span class="pre">'__main__':</span></tt> block or moved to a separate file. Just make sure it&#8217;s
+not called because this will always start a local WSGI server which
+we do not want if we deploy that application to CGI / app engine.</p>
+</div>
+<div class="section" id="creating-a-cgi-file">
+<h2>Creating a <cite>.cgi</cite> file<a class="headerlink" href="#creating-a-cgi-file" title="Permalink to this headline">¶</a></h2>
+<p>First you need to create the CGI application file. Let&#8217;s call it
+<cite>yourapplication.cgi</cite>:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="c">#!/usr/bin/python</span>
+<span class="kn">from</span> <span class="nn">wsgiref.handlers</span> <span class="kn">import</span> <span class="n">CGIHandler</span>
+<span class="kn">from</span> <span class="nn">yourapplication</span> <span class="kn">import</span> <span class="n">app</span>
+
+<span class="n">CGIHandler</span><span class="p">()</span><span class="o">.</span><span class="n">run</span><span class="p">(</span><span class="n">app</span><span class="p">)</span>
+</pre></div>
+</div>
+</div>
+<div class="section" id="server-setup">
+<h2>Server Setup<a class="headerlink" href="#server-setup" title="Permalink to this headline">¶</a></h2>
+<p>Usually there are two ways to configure the server. Either just copy the
+<cite>.cgi</cite> into a <cite>cgi-bin</cite> (and use <cite>mod_rewrite</cite> or something similar to
+rewrite the URL) or let the server point to the file directly.</p>
+<p>In Apache for example you can put a like like this into the config:</p>
+<div class="highlight-apache"><div class="highlight"><pre><span class="nb">ScriptAlias</span> <span class="sx">/app</span> <span class="sx">/path/to/the/application.cgi</span>
+</pre></div>
+</div>
+<p>For more information consult the documentation of your webserver.</p>
+</div>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="../index.html">
+ <img class="logo" src="../_static/flask.png" alt="Logo"/>
+</a></p>
+ <h3><a href="../index.html">Table Of Contents</a></h3>
+ <ul>
+<li><a class="reference internal" href="#">CGI</a><ul>
+<li><a class="reference internal" href="#creating-a-cgi-file">Creating a <cite>.cgi</cite> file</a></li>
+<li><a class="reference internal" href="#server-setup">Server Setup</a></li>
+</ul>
+</li>
+</ul>
+<h3>Related Topics</h3>
+<ul>
+ <li><a href="../index.html">Documentation overview</a><ul>
+ <li><a href="index.html">Deployment Options</a><ul>
+ <li>Previous: <a href="mod_wsgi.html" title="previous chapter">mod_wsgi (Apache)</a></li>
+ <li>Next: <a href="fastcgi.html" title="next chapter">FastCGI</a></li>
+ </ul></li>
+ </ul></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="../_sources/deploying/cgi.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/deploying/fastcgi.html b/app/static/doc/flask-docs/deploying/fastcgi.html
new file mode 100644
index 0000000..7431826
--- /dev/null
+++ b/app/static/doc/flask-docs/deploying/fastcgi.html
@@ -0,0 +1,259 @@
+
+<!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>FastCGI &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="../index.html" />
+ <link rel="up" title="Deployment Options" href="index.html" />
+ <link rel="next" title="uWSGI" href="uwsgi.html" />
+ <link rel="prev" title="CGI" href="cgi.html" />
+
+
+ <link rel="apple-touch-icon" href="../_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="../_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <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="uwsgi.html" title="uWSGI"
+ accesskey="N">next</a> |</li>
+ <li class="right" >
+ <a href="cgi.html" title="CGI"
+ accesskey="P">previous</a> |</li>
+ <li><a href="../index.html">Flask 0.8 documentation</a> &raquo;</li>
+ <li><a href="index.html" accesskey="U">Deployment Options</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="fastcgi">
+<span id="deploying-fastcgi"></span><h1>FastCGI<a class="headerlink" href="#fastcgi" title="Permalink to this headline">¶</a></h1>
+<p>FastCGI is a deployment option on servers like <a class="reference external" href="http://nginx.org/">nginx</a>, <a class="reference external" href="http://www.lighttpd.net/">lighttpd</a>,
+and <a class="reference external" href="http://www.cherokee-project.com/">cherokee</a>; see <a class="reference internal" href="uwsgi.html#deploying-uwsgi"><em>uWSGI</em></a> and
+<a class="reference internal" href="others.html#deploying-other-servers"><em>Other Servers</em></a> for other options. To use your WSGI
+application with any of them you will need a FastCGI server first. The
+most popular one is <a class="reference external" href="http://trac.saddi.com/flup">flup</a> which we will use for this guide. Make sure
+to have it installed to follow along.</p>
+<div class="admonition-watch-out admonition ">
+<p class="first admonition-title">Watch Out</p>
+<p class="last">Please make sure in advance that any <tt class="docutils literal"><span class="pre">app.run()</span></tt> calls you might
+have in your application file are inside an <tt class="docutils literal"><span class="pre">if</span> <span class="pre">__name__</span> <span class="pre">==</span>
+<span class="pre">'__main__':</span></tt> block or moved to a separate file. Just make sure it&#8217;s
+not called because this will always start a local WSGI server which
+we do not want if we deploy that application to FastCGI.</p>
+</div>
+<div class="section" id="creating-a-fcgi-file">
+<h2>Creating a <cite>.fcgi</cite> file<a class="headerlink" href="#creating-a-fcgi-file" title="Permalink to this headline">¶</a></h2>
+<p>First you need to create the FastCGI server file. Let&#8217;s call it
+<cite>yourapplication.fcgi</cite>:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="c">#!/usr/bin/python</span>
+<span class="kn">from</span> <span class="nn">flup.server.fcgi</span> <span class="kn">import</span> <span class="n">WSGIServer</span>
+<span class="kn">from</span> <span class="nn">yourapplication</span> <span class="kn">import</span> <span class="n">app</span>
+
+<span class="k">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">&#39;__main__&#39;</span><span class="p">:</span>
+ <span class="n">WSGIServer</span><span class="p">(</span><span class="n">app</span><span class="p">)</span><span class="o">.</span><span class="n">run</span><span class="p">()</span>
+</pre></div>
+</div>
+<p>This is enough for Apache to work, however nginx and older versions of
+lighttpd need a socket to be explicitly passed to communicate with the
+FastCGI server. For that to work you need to pass the path to the
+socket to the <tt class="xref py py-class docutils literal"><span class="pre">WSGIServer</span></tt>:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="n">WSGIServer</span><span class="p">(</span><span class="n">application</span><span class="p">,</span> <span class="n">bindAddress</span><span class="o">=</span><span class="s">&#39;/path/to/fcgi.sock&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">run</span><span class="p">()</span>
+</pre></div>
+</div>
+<p>The path has to be the exact same path you define in the server
+config.</p>
+<p>Save the <cite>yourapplication.fcgi</cite> file somewhere you will find it again.
+It makes sense to have that in <cite>/var/www/yourapplication</cite> or something
+similar.</p>
+<p>Make sure to set the executable bit on that file so that the servers
+can execute it:</p>
+<div class="highlight-text"><div class="highlight"><pre># chmod +x /var/www/yourapplication/yourapplication.fcgi
+</pre></div>
+</div>
+</div>
+<div class="section" id="configuring-lighttpd">
+<h2>Configuring lighttpd<a class="headerlink" href="#configuring-lighttpd" title="Permalink to this headline">¶</a></h2>
+<p>A basic FastCGI configuration for lighttpd looks like that:</p>
+<div class="highlight-python"><pre>fastcgi.server = ("/yourapplication.fcgi" =&gt;
+ ((
+ "socket" =&gt; "/tmp/yourapplication-fcgi.sock",
+ "bin-path" =&gt; "/var/www/yourapplication/yourapplication.fcgi",
+ "check-local" =&gt; "disable",
+ "max-procs" =&gt; 1
+ ))
+)
+
+alias.url = (
+ "/static/" =&gt; "/path/to/your/static"
+)
+
+url.rewrite-once = (
+ "^(/static.*)$" =&gt; "$1",
+ "^(/.*)$" =&gt; "/yourapplication.fcgi$1"</pre>
+</div>
+<p>Remember to enable the FastCGI, alias and rewrite modules. This
+configuration binds the application to <cite>/yourapplication</cite>. If you want
+the application to work in the URL root you have to work around a
+lighttpd bug with the
+<a class="reference external" href="http://werkzeug.pocoo.org/docs/contrib/fixers/#werkzeug.contrib.fixers.LighttpdCGIRootFix" title="(in Werkzeug v0.7)"><tt class="xref py py-class docutils literal"><span class="pre">LighttpdCGIRootFix</span></tt></a> middleware.</p>
+<p>Make sure to apply it only if you are mounting the application the URL
+root. Also, see the Lighty docs for more information on <a class="reference external" href="http://redmine.lighttpd.net/wiki/lighttpd/Docs:ModFastCGI">FastCGI and
+Python</a>
+(note that explicitly passing a socket to run() is no longer necessary).</p>
+</div>
+<div class="section" id="configuring-nginx">
+<h2>Configuring nginx<a class="headerlink" href="#configuring-nginx" title="Permalink to this headline">¶</a></h2>
+<p>Installing FastCGI applications on nginx is a bit different because by
+default no FastCGI parameters are forwarded.</p>
+<p>A basic flask FastCGI configuration for nginx looks like this:</p>
+<div class="highlight-python"><pre>location = /yourapplication { rewrite ^ /yourapplication/ last; }
+location /yourapplication { try_files $uri @yourapplication; }
+location @yourapplication {
+ include fastcgi_params;
+ fastcgi_split_path_info ^(/yourapplication)(.*)$;
+ fastcgi_param PATH_INFO $fastcgi_path_info;
+ fastcgi_param SCRIPT_NAME $fastcgi_script_name;
+ fastcgi_pass unix:/tmp/yourapplication-fcgi.sock;
+}</pre>
+</div>
+<p>This configuration binds the application to <cite>/yourapplication</cite>. If you
+want to have it in the URL root it&#8217;s a bit simpler because you don&#8217;t
+have to figure out how to calculate <cite>PATH_INFO</cite> and <cite>SCRIPT_NAME</cite>:</p>
+<div class="highlight-python"><pre>location / { try_files $uri @yourapplication; }
+location @yourapplication {
+ include fastcgi_params;
+ fastcgi_param PATH_INFO $fastcgi_script_name;
+ fastcgi_param SCRIPT_NAME "";
+ fastcgi_pass unix:/tmp/yourapplication-fcgi.sock;
+}</pre>
+</div>
+</div>
+<div class="section" id="running-fastcgi-processes">
+<h2>Running FastCGI Processes<a class="headerlink" href="#running-fastcgi-processes" title="Permalink to this headline">¶</a></h2>
+<p>Since Nginx and others do not load FastCGI apps, you have to do it by
+yourself. <a class="reference external" href="http://supervisord.org/configuration.html#fcgi-program-x-section-settings">Supervisor can manage FastCGI processes.</a>
+You can look around for other FastCGI process managers or write a script
+to run your <cite>.fcgi</cite> file at boot, e.g. using a SysV <tt class="docutils literal"><span class="pre">init.d</span></tt> script.
+For a temporary solution, you can always run the <tt class="docutils literal"><span class="pre">.fcgi</span></tt> script inside
+GNU screen. See <tt class="docutils literal"><span class="pre">man</span> <span class="pre">screen</span></tt> for details, and note that this is a
+manual solution which does not persist across system restart:</p>
+<div class="highlight-python"><pre>$ screen
+$ /var/www/yourapplication/yourapplication.fcgi</pre>
+</div>
+</div>
+<div class="section" id="debugging">
+<h2>Debugging<a class="headerlink" href="#debugging" title="Permalink to this headline">¶</a></h2>
+<p>FastCGI deployments tend to be hard to debug on most webservers. Very
+often the only thing the server log tells you is something along the
+lines of &#8220;premature end of headers&#8221;. In order to debug the application
+the only thing that can really give you ideas why it breaks is switching
+to the correct user and executing the application by hand.</p>
+<p>This example assumes your application is called <cite>application.fcgi</cite> and
+that your webserver user is <cite>www-data</cite>:</p>
+<div class="highlight-python"><pre>$ su www-data
+$ cd /var/www/yourapplication
+$ python application.fcgi
+Traceback (most recent call last):
+ File "yourapplication.fcgi", line 4, in &lt;module&gt;
+ImportError: No module named yourapplication</pre>
+</div>
+<p>In this case the error seems to be &#8220;yourapplication&#8221; not being on the
+python path. Common problems are:</p>
+<ul class="simple">
+<li>Relative paths being used. Don&#8217;t rely on the current working directory</li>
+<li>The code depending on environment variables that are not set by the
+web server.</li>
+<li>Different python interpreters being used.</li>
+</ul>
+</div>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="../index.html">
+ <img class="logo" src="../_static/flask.png" alt="Logo"/>
+</a></p>
+ <h3><a href="../index.html">Table Of Contents</a></h3>
+ <ul>
+<li><a class="reference internal" href="#">FastCGI</a><ul>
+<li><a class="reference internal" href="#creating-a-fcgi-file">Creating a <cite>.fcgi</cite> file</a></li>
+<li><a class="reference internal" href="#configuring-lighttpd">Configuring lighttpd</a></li>
+<li><a class="reference internal" href="#configuring-nginx">Configuring nginx</a></li>
+<li><a class="reference internal" href="#running-fastcgi-processes">Running FastCGI Processes</a></li>
+<li><a class="reference internal" href="#debugging">Debugging</a></li>
+</ul>
+</li>
+</ul>
+<h3>Related Topics</h3>
+<ul>
+ <li><a href="../index.html">Documentation overview</a><ul>
+ <li><a href="index.html">Deployment Options</a><ul>
+ <li>Previous: <a href="cgi.html" title="previous chapter">CGI</a></li>
+ <li>Next: <a href="uwsgi.html" title="next chapter">uWSGI</a></li>
+ </ul></li>
+ </ul></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="../_sources/deploying/fastcgi.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/deploying/index.html b/app/static/doc/flask-docs/deploying/index.html
new file mode 100644
index 0000000..44127c0
--- /dev/null
+++ b/app/static/doc/flask-docs/deploying/index.html
@@ -0,0 +1,150 @@
+
+<!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>Deployment Options &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="../index.html" />
+ <link rel="next" title="mod_wsgi (Apache)" href="mod_wsgi.html" />
+ <link rel="prev" title="Deferred Request Callbacks" href="../patterns/deferredcallbacks.html" />
+
+
+ <link rel="apple-touch-icon" href="../_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="../_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <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="mod_wsgi.html" title="mod_wsgi (Apache)"
+ accesskey="N">next</a> |</li>
+ <li class="right" >
+ <a href="../patterns/deferredcallbacks.html" title="Deferred Request Callbacks"
+ accesskey="P">previous</a> |</li>
+ <li><a href="../index.html">Flask 0.8 documentation</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="deployment-options">
+<span id="deployment"></span><h1>Deployment Options<a class="headerlink" href="#deployment-options" title="Permalink to this headline">¶</a></h1>
+<p>Depending on what you have available there are multiple ways to run
+Flask applications. You can use the builtin server during development,
+but you should use a full deployment option for production applications.
+(Do not use the builtin development server in production.) Several
+options are available and documented here.</p>
+<p>If you have a different WSGI server look up the server documentation
+about how to use a WSGI app with it. Just remember that your
+<tt class="xref py py-class docutils literal"><span class="pre">Flask</span></tt> application object is the actual WSGI application.</p>
+<div class="toctree-wrapper compound">
+<ul>
+<li class="toctree-l1"><a class="reference internal" href="mod_wsgi.html">mod_wsgi (Apache)</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="mod_wsgi.html#installing-mod-wsgi">Installing <cite>mod_wsgi</cite></a></li>
+<li class="toctree-l2"><a class="reference internal" href="mod_wsgi.html#creating-a-wsgi-file">Creating a <cite>.wsgi</cite> file</a></li>
+<li class="toctree-l2"><a class="reference internal" href="mod_wsgi.html#configuring-apache">Configuring Apache</a></li>
+<li class="toctree-l2"><a class="reference internal" href="mod_wsgi.html#troubleshooting">Troubleshooting</a></li>
+<li class="toctree-l2"><a class="reference internal" href="mod_wsgi.html#support-for-automatic-reloading">Support for Automatic Reloading</a></li>
+<li class="toctree-l2"><a class="reference internal" href="mod_wsgi.html#working-with-virtual-environments">Working with Virtual Environments</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="cgi.html">CGI</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="cgi.html#creating-a-cgi-file">Creating a <cite>.cgi</cite> file</a></li>
+<li class="toctree-l2"><a class="reference internal" href="cgi.html#server-setup">Server Setup</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="fastcgi.html">FastCGI</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="fastcgi.html#creating-a-fcgi-file">Creating a <cite>.fcgi</cite> file</a></li>
+<li class="toctree-l2"><a class="reference internal" href="fastcgi.html#configuring-lighttpd">Configuring lighttpd</a></li>
+<li class="toctree-l2"><a class="reference internal" href="fastcgi.html#configuring-nginx">Configuring nginx</a></li>
+<li class="toctree-l2"><a class="reference internal" href="fastcgi.html#running-fastcgi-processes">Running FastCGI Processes</a></li>
+<li class="toctree-l2"><a class="reference internal" href="fastcgi.html#debugging">Debugging</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="uwsgi.html">uWSGI</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="uwsgi.html#starting-your-app-with-uwsgi">Starting your app with uwsgi</a></li>
+<li class="toctree-l2"><a class="reference internal" href="uwsgi.html#configuring-nginx">Configuring nginx</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="others.html">Other Servers</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="others.html#tornado">Tornado</a></li>
+<li class="toctree-l2"><a class="reference internal" href="others.html#gevent">Gevent</a></li>
+<li class="toctree-l2"><a class="reference internal" href="others.html#gunicorn">Gunicorn</a></li>
+<li class="toctree-l2"><a class="reference internal" href="others.html#proxy-setups">Proxy Setups</a></li>
+</ul>
+</li>
+</ul>
+</div>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="../index.html">
+ <img class="logo" src="../_static/flask.png" alt="Logo"/>
+</a></p><h3>Related Topics</h3>
+<ul>
+ <li><a href="../index.html">Documentation overview</a><ul>
+ <li>Previous: <a href="../patterns/deferredcallbacks.html" title="previous chapter">Deferred Request Callbacks</a></li>
+ <li>Next: <a href="mod_wsgi.html" title="next chapter">mod_wsgi (Apache)</a></li>
+ </ul></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="../_sources/deploying/index.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/deploying/mod_wsgi.html b/app/static/doc/flask-docs/deploying/mod_wsgi.html
new file mode 100644
index 0000000..a431756
--- /dev/null
+++ b/app/static/doc/flask-docs/deploying/mod_wsgi.html
@@ -0,0 +1,255 @@
+
+<!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>mod_wsgi (Apache) &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="../index.html" />
+ <link rel="up" title="Deployment Options" href="index.html" />
+ <link rel="next" title="CGI" href="cgi.html" />
+ <link rel="prev" title="Deployment Options" href="index.html" />
+
+
+ <link rel="apple-touch-icon" href="../_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="../_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <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="cgi.html" title="CGI"
+ accesskey="N">next</a> |</li>
+ <li class="right" >
+ <a href="index.html" title="Deployment Options"
+ accesskey="P">previous</a> |</li>
+ <li><a href="../index.html">Flask 0.8 documentation</a> &raquo;</li>
+ <li><a href="index.html" accesskey="U">Deployment Options</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="mod-wsgi-apache">
+<span id="mod-wsgi-deployment"></span><h1>mod_wsgi (Apache)<a class="headerlink" href="#mod-wsgi-apache" title="Permalink to this headline">¶</a></h1>
+<p>If you are using the <a class="reference external" href="http://httpd.apache.org/">Apache</a> webserver, consider using <a class="reference external" href="http://code.google.com/p/modwsgi/">mod_wsgi</a>.</p>
+<div class="admonition-watch-out admonition ">
+<p class="first admonition-title">Watch Out</p>
+<p class="last">Please make sure in advance that any <tt class="docutils literal"><span class="pre">app.run()</span></tt> calls you might
+have in your application file are inside an <tt class="docutils literal"><span class="pre">if</span> <span class="pre">__name__</span> <span class="pre">==</span>
+<span class="pre">'__main__':</span></tt> block or moved to a separate file. Just make sure it&#8217;s
+not called because this will always start a local WSGI server which
+we do not want if we deploy that application to mod_wsgi.</p>
+</div>
+<div class="section" id="installing-mod-wsgi">
+<h2>Installing <cite>mod_wsgi</cite><a class="headerlink" href="#installing-mod-wsgi" title="Permalink to this headline">¶</a></h2>
+<p>If you don&#8217;t have <cite>mod_wsgi</cite> installed yet you have to either install it
+using a package manager or compile it yourself. The mod_wsgi
+<a class="reference external" href="http://code.google.com/p/modwsgi/wiki/QuickInstallationGuide">installation instructions</a> cover source installations on UNIX systems.</p>
+<p>If you are using Ubuntu/Debian you can apt-get it and activate it as
+follows:</p>
+<div class="highlight-text"><div class="highlight"><pre># apt-get install libapache2-mod-wsgi
+</pre></div>
+</div>
+<p>On FreeBSD install <cite>mod_wsgi</cite> by compiling the <cite>www/mod_wsgi</cite> port or by
+using pkg_add:</p>
+<div class="highlight-text"><div class="highlight"><pre># pkg_add -r mod_wsgi
+</pre></div>
+</div>
+<p>If you are using pkgsrc you can install <cite>mod_wsgi</cite> by compiling the
+<cite>www/ap2-wsgi</cite> package.</p>
+<p>If you encounter segfaulting child processes after the first apache
+reload you can safely ignore them. Just restart the server.</p>
+</div>
+<div class="section" id="creating-a-wsgi-file">
+<h2>Creating a <cite>.wsgi</cite> file<a class="headerlink" href="#creating-a-wsgi-file" title="Permalink to this headline">¶</a></h2>
+<p>To run your application you need a <cite>yourapplication.wsgi</cite> file. This file
+contains the code <cite>mod_wsgi</cite> is executing on startup to get the application
+object. The object called <cite>application</cite> in that file is then used as
+application.</p>
+<p>For most applications the following file should be sufficient:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">yourapplication</span> <span class="kn">import</span> <span class="n">app</span> <span class="k">as</span> <span class="n">application</span>
+</pre></div>
+</div>
+<p>If you don&#8217;t have a factory function for application creation but a singleton
+instance you can directly import that one as <cite>application</cite>.</p>
+<p>Store that file somewhere that you will find it again (e.g.:
+<cite>/var/www/yourapplication</cite>) and make sure that <cite>yourapplication</cite> and all
+the libraries that are in use are on the python load path. If you don&#8217;t
+want to install it system wide consider using a <a class="reference external" href="http://pypi.python.org/pypi/virtualenv">virtual python</a>
+instance.</p>
+</div>
+<div class="section" id="configuring-apache">
+<h2>Configuring Apache<a class="headerlink" href="#configuring-apache" title="Permalink to this headline">¶</a></h2>
+<p>The last thing you have to do is to create an Apache configuration file
+for your application. In this example we are telling <cite>mod_wsgi</cite> to
+execute the application under a different user for security reasons:</p>
+<div class="highlight-apache"><div class="highlight"><pre><span class="nt">&lt;VirtualHost</span> <span class="s">*</span><span class="nt">&gt;</span>
+ <span class="nb">ServerName</span> example.com
+
+ <span class="nb">WSGIDaemonProcess</span> yourapplication <span class="k">user</span>=user1 <span class="k">group</span>=group1 threads=5
+ <span class="nb">WSGIScriptAlias</span> / <span class="sx">/var/www/yourapplication/yourapplication.wsgi</span>
+
+ <span class="nt">&lt;Directory</span> <span class="s">/var/www/yourapplication</span><span class="nt">&gt;</span>
+ <span class="nb">WSGIProcessGroup</span> yourapplication
+ <span class="nb">WSGIApplicationGroup</span> %{GLOBAL}
+ <span class="nb">Order</span> deny,allow
+ <span class="nb">Allow</span> from <span class="k">all</span>
+ <span class="nt">&lt;/Directory&gt;</span>
+<span class="nt">&lt;/VirtualHost&gt;</span>
+</pre></div>
+</div>
+<p>For more information consult the <a class="reference external" href="http://code.google.com/p/modwsgi/wiki/">mod_wsgi wiki</a>.</p>
+</div>
+<div class="section" id="troubleshooting">
+<h2>Troubleshooting<a class="headerlink" href="#troubleshooting" title="Permalink to this headline">¶</a></h2>
+<p>If your application does not run, follow this guide to troubleshoot:</p>
+<dl class="docutils">
+<dt><strong>Problem:</strong> application does not run, errorlog shows SystemExit ignored</dt>
+<dd>You have a <tt class="docutils literal"><span class="pre">app.run()</span></tt> call in your application file that is not
+guarded by an <tt class="docutils literal"><span class="pre">if</span> <span class="pre">__name__</span> <span class="pre">==</span> <span class="pre">'__main__':</span></tt> condition. Either
+remove that <a class="reference internal" href="../api.html#flask.Flask.run" title="flask.Flask.run"><tt class="xref py py-meth docutils literal"><span class="pre">run()</span></tt></a> call from the file and move it
+into a separate <cite>run.py</cite> file or put it into such an if block.</dd>
+<dt><strong>Problem:</strong> application gives permission errors</dt>
+<dd>Probably caused by your application running as the wrong user. Make
+sure the folders the application needs access to have the proper
+privileges set and the application runs as the correct user
+(<tt class="docutils literal"><span class="pre">user</span></tt> and <tt class="docutils literal"><span class="pre">group</span></tt> parameter to the <cite>WSGIDaemonProcess</cite>
+directive)</dd>
+<dt><strong>Problem:</strong> application dies with an error on print</dt>
+<dd><p class="first">Keep in mind that mod_wsgi disallows doing anything with
+<a class="reference external" href="http://docs.python.org/dev/library/sys.html#sys.stdout" title="(in Python v3.3)"><tt class="xref py py-data docutils literal"><span class="pre">sys.stdout</span></tt></a> and <a class="reference external" href="http://docs.python.org/dev/library/sys.html#sys.stderr" title="(in Python v3.3)"><tt class="xref py py-data docutils literal"><span class="pre">sys.stderr</span></tt></a>. You can disable this
+protection from the config by setting the <cite>WSGIRestrictStdout</cite> to
+<tt class="docutils literal"><span class="pre">off</span></tt>:</p>
+<div class="highlight-apache"><div class="highlight"><pre><span class="nb">WSGIRestrictStdout</span> <span class="k">Off</span>
+</pre></div>
+</div>
+<p>Alternatively you can also replace the standard out in the .wsgi file
+with a different stream:</p>
+<div class="last highlight-python"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">sys</span>
+<span class="n">sys</span><span class="o">.</span><span class="n">stdout</span> <span class="o">=</span> <span class="n">sys</span><span class="o">.</span><span class="n">stderr</span>
+</pre></div>
+</div>
+</dd>
+<dt><strong>Problem:</strong> accessing resources gives IO errors</dt>
+<dd><p class="first">Your application probably is a single .py file you symlinked into
+the site-packages folder. Please be aware that this does not work,
+instead you either have to put the folder into the pythonpath the
+file is stored in, or convert your application into a package.</p>
+<p class="last">The reason for this is that for non-installed packages, the module
+filename is used to locate the resources and for symlinks the wrong
+filename is picked up.</p>
+</dd>
+</dl>
+</div>
+<div class="section" id="support-for-automatic-reloading">
+<h2>Support for Automatic Reloading<a class="headerlink" href="#support-for-automatic-reloading" title="Permalink to this headline">¶</a></h2>
+<p>To help deployment tools you can activate support for automatic
+reloading. Whenever something changes the <cite>.wsgi</cite> file, <cite>mod_wsgi</cite> will
+reload all the daemon processes for us.</p>
+<p>For that, just add the following directive to your <cite>Directory</cite> section:</p>
+<div class="highlight-apache"><div class="highlight"><pre><span class="nb">WSGIScriptReloading</span> <span class="k">On</span>
+</pre></div>
+</div>
+</div>
+<div class="section" id="working-with-virtual-environments">
+<h2>Working with Virtual Environments<a class="headerlink" href="#working-with-virtual-environments" title="Permalink to this headline">¶</a></h2>
+<p>Virtual environments have the advantage that they never install the
+required dependencies system wide so you have a better control over what
+is used where. If you want to use a virtual environment with mod_wsgi
+you have to modify your <cite>.wsgi</cite> file slightly.</p>
+<p>Add the following lines to the top of your <cite>.wsgi</cite> file:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="n">activate_this</span> <span class="o">=</span> <span class="s">&#39;/path/to/env/bin/activate_this.py&#39;</span>
+<span class="nb">execfile</span><span class="p">(</span><span class="n">activate_this</span><span class="p">,</span> <span class="nb">dict</span><span class="p">(</span><span class="n">__file__</span><span class="o">=</span><span class="n">activate_this</span><span class="p">))</span>
+</pre></div>
+</div>
+<p>This sets up the load paths according to the settings of the virtual
+environment. Keep in mind that the path has to be absolute.</p>
+</div>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="../index.html">
+ <img class="logo" src="../_static/flask.png" alt="Logo"/>
+</a></p>
+ <h3><a href="../index.html">Table Of Contents</a></h3>
+ <ul>
+<li><a class="reference internal" href="#">mod_wsgi (Apache)</a><ul>
+<li><a class="reference internal" href="#installing-mod-wsgi">Installing <cite>mod_wsgi</cite></a></li>
+<li><a class="reference internal" href="#creating-a-wsgi-file">Creating a <cite>.wsgi</cite> file</a></li>
+<li><a class="reference internal" href="#configuring-apache">Configuring Apache</a></li>
+<li><a class="reference internal" href="#troubleshooting">Troubleshooting</a></li>
+<li><a class="reference internal" href="#support-for-automatic-reloading">Support for Automatic Reloading</a></li>
+<li><a class="reference internal" href="#working-with-virtual-environments">Working with Virtual Environments</a></li>
+</ul>
+</li>
+</ul>
+<h3>Related Topics</h3>
+<ul>
+ <li><a href="../index.html">Documentation overview</a><ul>
+ <li><a href="index.html">Deployment Options</a><ul>
+ <li>Previous: <a href="index.html" title="previous chapter">Deployment Options</a></li>
+ <li>Next: <a href="cgi.html" title="next chapter">CGI</a></li>
+ </ul></li>
+ </ul></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="../_sources/deploying/mod_wsgi.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/deploying/others.html b/app/static/doc/flask-docs/deploying/others.html
new file mode 100644
index 0000000..b1e545b
--- /dev/null
+++ b/app/static/doc/flask-docs/deploying/others.html
@@ -0,0 +1,200 @@
+
+<!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>Other Servers &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="../index.html" />
+ <link rel="up" title="Deployment Options" href="index.html" />
+ <link rel="next" title="Becoming Big" href="../becomingbig.html" />
+ <link rel="prev" title="uWSGI" href="uwsgi.html" />
+
+
+ <link rel="apple-touch-icon" href="../_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="../_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <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="../becomingbig.html" title="Becoming Big"
+ accesskey="N">next</a> |</li>
+ <li class="right" >
+ <a href="uwsgi.html" title="uWSGI"
+ accesskey="P">previous</a> |</li>
+ <li><a href="../index.html">Flask 0.8 documentation</a> &raquo;</li>
+ <li><a href="index.html" accesskey="U">Deployment Options</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="other-servers">
+<span id="deploying-other-servers"></span><h1>Other Servers<a class="headerlink" href="#other-servers" title="Permalink to this headline">¶</a></h1>
+<p>There are popular servers written in Python that allow the execution of WSGI
+applications as well. These servers stand alone when they run; you can proxy
+to them from your web server.</p>
+<div class="section" id="tornado">
+<h2>Tornado<a class="headerlink" href="#tornado" title="Permalink to this headline">¶</a></h2>
+<p><a class="reference external" href="http://www.tornadoweb.org/">Tornado</a> is an open source version of the scalable, non-blocking web
+server and tools that power <a class="reference external" href="http://friendfeed.com/">FriendFeed</a>. Because it is non-blocking and
+uses epoll, it can handle thousands of simultaneous standing connections,
+which means it is ideal for real-time web services. Integrating this
+service with Flask is a trivial task:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">tornado.wsgi</span> <span class="kn">import</span> <span class="n">WSGIContainer</span>
+<span class="kn">from</span> <span class="nn">tornado.httpserver</span> <span class="kn">import</span> <span class="n">HTTPServer</span>
+<span class="kn">from</span> <span class="nn">tornado.ioloop</span> <span class="kn">import</span> <span class="n">IOLoop</span>
+<span class="kn">from</span> <span class="nn">yourapplication</span> <span class="kn">import</span> <span class="n">app</span>
+
+<span class="n">http_server</span> <span class="o">=</span> <span class="n">HTTPServer</span><span class="p">(</span><span class="n">WSGIContainer</span><span class="p">(</span><span class="n">app</span><span class="p">))</span>
+<span class="n">http_server</span><span class="o">.</span><span class="n">listen</span><span class="p">(</span><span class="mi">5000</span><span class="p">)</span>
+<span class="n">IOLoop</span><span class="o">.</span><span class="n">instance</span><span class="p">()</span><span class="o">.</span><span class="n">start</span><span class="p">()</span>
+</pre></div>
+</div>
+</div>
+<div class="section" id="gevent">
+<h2>Gevent<a class="headerlink" href="#gevent" title="Permalink to this headline">¶</a></h2>
+<p><a class="reference external" href="http://www.gevent.org/">Gevent</a> is a coroutine-based Python networking library that uses
+<a class="reference external" href="http://codespeak.net/py/0.9.2/greenlet.html">greenlet</a> to provide a high-level synchronous API on top of <a class="reference external" href="http://monkey.org/~provos/libevent/">libevent</a>
+event loop:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">gevent.wsgi</span> <span class="kn">import</span> <span class="n">WSGIServer</span>
+<span class="kn">from</span> <span class="nn">yourapplication</span> <span class="kn">import</span> <span class="n">app</span>
+
+<span class="n">http_server</span> <span class="o">=</span> <span class="n">WSGIServer</span><span class="p">((</span><span class="s">&#39;&#39;</span><span class="p">,</span> <span class="mi">5000</span><span class="p">),</span> <span class="n">app</span><span class="p">)</span>
+<span class="n">http_server</span><span class="o">.</span><span class="n">serve_forever</span><span class="p">()</span>
+</pre></div>
+</div>
+</div>
+<div class="section" id="gunicorn">
+<h2>Gunicorn<a class="headerlink" href="#gunicorn" title="Permalink to this headline">¶</a></h2>
+<p><a class="reference external" href="http://gunicorn.org/">Gunicorn</a> &#8216;Green Unicorn&#8217; is a WSGI HTTP Server for UNIX. It&#8217;s a pre-fork
+worker model ported from Ruby&#8217;s Unicorn project. It supports both <a class="reference external" href="http://eventlet.net/">eventlet</a>
+and <a class="reference external" href="http://codespeak.net/py/0.9.2/greenlet.html">greenlet</a>. Running a Flask application on this server is quite simple:</p>
+<div class="highlight-python"><pre>gunicorn myproject:app</pre>
+</div>
+<p><a class="reference external" href="http://gunicorn.org/">Gunicorn</a> provides many command-line options &#8211; see <tt class="docutils literal"><span class="pre">gunicorn</span> <span class="pre">-h</span></tt>.
+For example, to run a Flask application with 4 worker processes (<tt class="docutils literal"><span class="pre">-w</span>
+<span class="pre">4</span></tt>) binding to localhost port 4000 (<tt class="docutils literal"><span class="pre">-b</span> <span class="pre">127.0.0.1:4000</span></tt>):</p>
+<div class="highlight-python"><pre>gunicorn -w 4 -b 127.0.0.1:4000 myproject:app</pre>
+</div>
+</div>
+<div class="section" id="proxy-setups">
+<h2>Proxy Setups<a class="headerlink" href="#proxy-setups" title="Permalink to this headline">¶</a></h2>
+<p>If you deploy your application using one of these servers behind an HTTP
+proxy you will need to rewrite a few headers in order for the
+application to work. The two problematic values in the WSGI environment
+usually are <cite>REMOTE_ADDR</cite> and <cite>HTTP_HOST</cite>. Werkzeug ships a fixer that
+will solve some common setups, but you might want to write your own WSGI
+middleware for specific setups.</p>
+<p>The most common setup invokes the host being set from <cite>X-Forwarded-Host</cite>
+and the remote address from <cite>X-Forwarded-For</cite>:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">werkzeug.contrib.fixers</span> <span class="kn">import</span> <span class="n">ProxyFix</span>
+<span class="n">app</span><span class="o">.</span><span class="n">wsgi_app</span> <span class="o">=</span> <span class="n">ProxyFix</span><span class="p">(</span><span class="n">app</span><span class="o">.</span><span class="n">wsgi_app</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>Please keep in mind that it is a security issue to use such a middleware
+in a non-proxy setup because it will blindly trust the incoming
+headers which might be forged by malicious clients.</p>
+<p>If you want to rewrite the headers from another header, you might want to
+use a fixer like this:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">class</span> <span class="nc">CustomProxyFix</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
+
+ <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">app</span><span class="p">):</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">app</span> <span class="o">=</span> <span class="n">app</span>
+
+ <span class="k">def</span> <span class="nf">__call__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">environ</span><span class="p">,</span> <span class="n">start_response</span><span class="p">):</span>
+ <span class="n">host</span> <span class="o">=</span> <span class="n">environ</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;HTTP_X_FHOST&#39;</span><span class="p">,</span> <span class="s">&#39;&#39;</span><span class="p">)</span>
+ <span class="k">if</span> <span class="n">host</span><span class="p">:</span>
+ <span class="n">environ</span><span class="p">[</span><span class="s">&#39;HTTP_HOST&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">host</span>
+ <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">app</span><span class="p">(</span><span class="n">environ</span><span class="p">,</span> <span class="n">start_response</span><span class="p">)</span>
+
+<span class="n">app</span><span class="o">.</span><span class="n">wsgi_app</span> <span class="o">=</span> <span class="n">CustomProxyFix</span><span class="p">(</span><span class="n">app</span><span class="o">.</span><span class="n">wsgi_app</span><span class="p">)</span>
+</pre></div>
+</div>
+</div>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="../index.html">
+ <img class="logo" src="../_static/flask.png" alt="Logo"/>
+</a></p>
+ <h3><a href="../index.html">Table Of Contents</a></h3>
+ <ul>
+<li><a class="reference internal" href="#">Other Servers</a><ul>
+<li><a class="reference internal" href="#tornado">Tornado</a></li>
+<li><a class="reference internal" href="#gevent">Gevent</a></li>
+<li><a class="reference internal" href="#gunicorn">Gunicorn</a></li>
+<li><a class="reference internal" href="#proxy-setups">Proxy Setups</a></li>
+</ul>
+</li>
+</ul>
+<h3>Related Topics</h3>
+<ul>
+ <li><a href="../index.html">Documentation overview</a><ul>
+ <li><a href="index.html">Deployment Options</a><ul>
+ <li>Previous: <a href="uwsgi.html" title="previous chapter">uWSGI</a></li>
+ <li>Next: <a href="../becomingbig.html" title="next chapter">Becoming Big</a></li>
+ </ul></li>
+ </ul></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="../_sources/deploying/others.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/deploying/uwsgi.html b/app/static/doc/flask-docs/deploying/uwsgi.html
new file mode 100644
index 0000000..38eeed0
--- /dev/null
+++ b/app/static/doc/flask-docs/deploying/uwsgi.html
@@ -0,0 +1,167 @@
+
+<!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>uWSGI &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="../index.html" />
+ <link rel="up" title="Deployment Options" href="index.html" />
+ <link rel="next" title="Other Servers" href="others.html" />
+ <link rel="prev" title="FastCGI" href="fastcgi.html" />
+
+
+ <link rel="apple-touch-icon" href="../_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="../_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <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="others.html" title="Other Servers"
+ accesskey="N">next</a> |</li>
+ <li class="right" >
+ <a href="fastcgi.html" title="FastCGI"
+ accesskey="P">previous</a> |</li>
+ <li><a href="../index.html">Flask 0.8 documentation</a> &raquo;</li>
+ <li><a href="index.html" accesskey="U">Deployment Options</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="uwsgi">
+<span id="deploying-uwsgi"></span><h1>uWSGI<a class="headerlink" href="#uwsgi" title="Permalink to this headline">¶</a></h1>
+<p>uWSGI is a deployment option on servers like <a class="reference external" href="http://nginx.org/">nginx</a>, <a class="reference external" href="http://www.lighttpd.net/">lighttpd</a>, and
+<a class="reference external" href="http://www.cherokee-project.com/">cherokee</a>; see <a class="reference internal" href="fastcgi.html#deploying-fastcgi"><em>FastCGI</em></a> and
+<a class="reference internal" href="others.html#deploying-other-servers"><em>Other Servers</em></a> for other options. To use your WSGI
+application with uWSGI protocol you will need a uWSGI server
+first. uWSGI is both a protocol and an application server; the
+application server can serve uWSGI, FastCGI, and HTTP protocols.</p>
+<p>The most popular uWSGI server is <a class="reference external" href="http://projects.unbit.it/uwsgi/">uwsgi</a>, which we will use for this
+guide. Make sure to have it installed to follow along.</p>
+<div class="admonition-watch-out admonition ">
+<p class="first admonition-title">Watch Out</p>
+<p class="last">Please make sure in advance that any <tt class="docutils literal"><span class="pre">app.run()</span></tt> calls you might
+have in your application file are inside an <tt class="docutils literal"><span class="pre">if</span> <span class="pre">__name__</span> <span class="pre">==</span>
+<span class="pre">'__main__':</span></tt> block or moved to a separate file. Just make sure it&#8217;s
+not called because this will always start a local WSGI server which
+we do not want if we deploy that application to uWSGI.</p>
+</div>
+<div class="section" id="starting-your-app-with-uwsgi">
+<h2>Starting your app with uwsgi<a class="headerlink" href="#starting-your-app-with-uwsgi" title="Permalink to this headline">¶</a></h2>
+<p><cite>uwsgi</cite> is designed to operate on WSGI callables found in python modules.</p>
+<p>Given a flask application in myapp.py, use the following command:</p>
+<div class="highlight-text"><div class="highlight"><pre>$ uwsgi -s /tmp/uwsgi.sock --module myapp --callable app
+</pre></div>
+</div>
+<p>Or, if you prefer:</p>
+<div class="highlight-text"><div class="highlight"><pre>$ uwsgi -s /tmp/uwsgi.sock -w myapp:app
+</pre></div>
+</div>
+</div>
+<div class="section" id="configuring-nginx">
+<h2>Configuring nginx<a class="headerlink" href="#configuring-nginx" title="Permalink to this headline">¶</a></h2>
+<p>A basic flask uWSGI configuration for nginx looks like this:</p>
+<div class="highlight-python"><pre>location = /yourapplication { rewrite ^ /yourapplication/; }
+location /yourapplication { try_files $uri @yourapplication; }
+location @yourapplication {
+ include uwsgi_params;
+ uwsgi_param SCRIPT_NAME /yourapplication;
+ uwsgi_modifier1 30;
+ uwsgi_pass unix:/tmp/uwsgi.sock;
+}</pre>
+</div>
+<p>This configuration binds the application to <cite>/yourapplication</cite>. If you want
+to have it in the URL root it&#8217;s a bit simpler because you don&#8217;t have to tell
+it the WSGI <cite>SCRIPT_NAME</cite> or set the uwsgi modifier to make use of it:</p>
+<div class="highlight-python"><pre>location / { try_files $uri @yourapplication; }
+location @yourapplication {
+ include uwsgi_params;
+ uwsgi_pass unix:/tmp/uwsgi.sock;
+}</pre>
+</div>
+</div>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="../index.html">
+ <img class="logo" src="../_static/flask.png" alt="Logo"/>
+</a></p>
+ <h3><a href="../index.html">Table Of Contents</a></h3>
+ <ul>
+<li><a class="reference internal" href="#">uWSGI</a><ul>
+<li><a class="reference internal" href="#starting-your-app-with-uwsgi">Starting your app with uwsgi</a></li>
+<li><a class="reference internal" href="#configuring-nginx">Configuring nginx</a></li>
+</ul>
+</li>
+</ul>
+<h3>Related Topics</h3>
+<ul>
+ <li><a href="../index.html">Documentation overview</a><ul>
+ <li><a href="index.html">Deployment Options</a><ul>
+ <li>Previous: <a href="fastcgi.html" title="previous chapter">FastCGI</a></li>
+ <li>Next: <a href="others.html" title="next chapter">Other Servers</a></li>
+ </ul></li>
+ </ul></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="../_sources/deploying/uwsgi.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/design.html b/app/static/doc/flask-docs/design.html
new file mode 100644
index 0000000..b5dd479
--- /dev/null
+++ b/app/static/doc/flask-docs/design.html
@@ -0,0 +1,276 @@
+
+<!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>Design Decisions in Flask &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="index.html" />
+ <link rel="next" title="HTML/XHTML FAQ" href="htmlfaq.html" />
+ <link rel="prev" title="API" href="api.html" />
+
+
+ <link rel="apple-touch-icon" href="_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <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="htmlfaq.html" title="HTML/XHTML FAQ"
+ accesskey="N">next</a> |</li>
+ <li class="right" >
+ <a href="api.html" title="API"
+ accesskey="P">previous</a> |</li>
+ <li><a href="index.html">Flask 0.8 documentation</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="design-decisions-in-flask">
+<span id="design"></span><h1>Design Decisions in Flask<a class="headerlink" href="#design-decisions-in-flask" title="Permalink to this headline">¶</a></h1>
+<p>If you are curious why Flask does certain things the way it does and not
+differently, this section is for you. This should give you an idea about
+some of the design decisions that may appear arbitrary and surprising at
+first, especially in direct comparison with other frameworks.</p>
+<div class="section" id="the-explicit-application-object">
+<h2>The Explicit Application Object<a class="headerlink" href="#the-explicit-application-object" title="Permalink to this headline">¶</a></h2>
+<p>A Python web application based on WSGI has to have one central callable
+object that implements the actual application. In Flask this is an
+instance of the <a class="reference internal" href="api.html#flask.Flask" title="flask.Flask"><tt class="xref py py-class docutils literal"><span class="pre">Flask</span></tt></a> class. Each Flask application has
+to create an instance of this class itself and pass it the name of the
+module, but why can&#8217;t Flask do that itself?</p>
+<p>Without such an explicit application object the following code:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">Flask</span>
+<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="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/&#39;</span><span class="p">)</span>
+<span class="k">def</span> <span class="nf">index</span><span class="p">():</span>
+ <span class="k">return</span> <span class="s">&#39;Hello World!&#39;</span>
+</pre></div>
+</div>
+<p>Would look like this instead:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">hypothetical_flask</span> <span class="kn">import</span> <span class="n">route</span>
+
+<span class="nd">@route</span><span class="p">(</span><span class="s">&#39;/&#39;</span><span class="p">)</span>
+<span class="k">def</span> <span class="nf">index</span><span class="p">():</span>
+ <span class="k">return</span> <span class="s">&#39;Hello World!&#39;</span>
+</pre></div>
+</div>
+<p>There are three major reasons for this. The most important one is that
+implicit application objects require that there may only be one instance at
+the time. There are ways to fake multiple applications with a single
+application object, like maintaining a stack of applications, but this
+causes some problems I won&#8217;t outline here in detail. Now the question is:
+when does a microframework need more than one application at the same
+time? A good example for this is unittesting. When you want to test
+something it can be very helpful to create a minimal application to test
+specific behavior. When the application object is deleted everything it
+allocated will be freed again.</p>
+<p>Another thing that becomes possible when you have an explicit object lying
+around in your code is that you can subclass the base class
+(<a class="reference internal" href="api.html#flask.Flask" title="flask.Flask"><tt class="xref py py-class docutils literal"><span class="pre">Flask</span></tt></a>) to alter specific behaviour. This would not be
+possible without hacks if the object were created ahead of time for you
+based on a class that is not exposed to you.</p>
+<p>But there is another very important reason why Flask depends on an
+explicit instantiation of that class: the package name. Whenever you
+create a Flask instance you usually pass it <cite>__name__</cite> as package name.
+Flask depends on that information to properly load resources relative
+to your module. With Python&#8217;s outstanding support for reflection it can
+then access the package to figure out where the templates and static files
+are stored (see <a class="reference internal" href="api.html#flask.Flask.open_resource" title="flask.Flask.open_resource"><tt class="xref py py-meth docutils literal"><span class="pre">open_resource()</span></tt></a>). Now obviously there
+are frameworks around that do not need any configuration and will still be
+able to load templates relative to your application module. But they have
+to use the current working directory for that, which is a very unreliable
+way to determine where the application is. The current working directory
+is process-wide and if you are running multiple applications in one
+process (which could happen in a webserver without you knowing) the paths
+will be off. Worse: many webservers do not set the working directory to
+the directory of your application but to the document root which does not
+have to be the same folder.</p>
+<p>The third reason is &#8220;explicit is better than implicit&#8221;. That object is
+your WSGI application, you don&#8217;t have to remember anything else. If you
+want to apply a WSGI middleware, just wrap it and you&#8217;re done (though
+there are better ways to do that so that you do not lose the reference
+to the application object <a class="reference internal" href="api.html#flask.Flask.wsgi_app" title="flask.Flask.wsgi_app"><tt class="xref py py-meth docutils literal"><span class="pre">wsgi_app()</span></tt></a>).</p>
+<p>Furthermore this design makes it possible to use a factory function to
+create the application which is very helpful for unittesting and similar
+things (<a class="reference internal" href="patterns/appfactories.html#app-factories"><em>Application Factories</em></a>).</p>
+</div>
+<div class="section" id="the-routing-system">
+<h2>The Routing System<a class="headerlink" href="#the-routing-system" title="Permalink to this headline">¶</a></h2>
+<p>Flask uses the Werkzeug routing system which has was designed to
+automatically order routes by complexity. This means that you can declare
+routes in arbitrary order and they will still work as expected. This is a
+requirement if you want to properly implement decorator based routing
+since decorators could be fired in undefined order when the application is
+split into multiple modules.</p>
+<p>Another design decision with the Werkzeug routing system is that routes
+in Werkzeug try to ensure that there is that URLs are unique. Werkzeug
+will go quite far with that in that it will automatically redirect to a
+canonical URL if a route is ambiguous.</p>
+</div>
+<div class="section" id="one-template-engine">
+<h2>One Template Engine<a class="headerlink" href="#one-template-engine" title="Permalink to this headline">¶</a></h2>
+<p>Flask decides on one template engine: Jinja2. Why doesn&#8217;t Flask have a
+pluggable template engine interface? You can obviously use a different
+template engine, but Flask will still configure Jinja2 for you. While
+that limitation that Jinja2 is <em>always</em> configured will probably go away,
+the decision to bundle one template engine and use that will not.</p>
+<p>Template engines are like programming languages and each of those engines
+has a certain understanding about how things work. On the surface they
+all work the same: you tell the engine to evaluate a template with a set
+of variables and take the return value as string.</p>
+<p>But that&#8217;s about where similarities end. Jinja2 for example has an
+extensive filter system, a certain way to do template inheritance, support
+for reusable blocks (macros) that can be used from inside templates and
+also from Python code, uses Unicode for all operations, supports
+iterative template rendering, configurable syntax and more. On the other
+hand an engine like Genshi is based on XML stream evaluation, template
+inheritance by taking the availability of XPath into account and more.
+Mako on the other hand treats templates similar to Python modules.</p>
+<p>When it comes to connecting a template engine with an application or
+framework there is more than just rendering templates. For instance,
+Flask uses Jinja2&#8217;s extensive autoescaping support. Also it provides
+ways to access macros from Jinja2 templates.</p>
+<p>A template abstraction layer that would not take the unique features of
+the template engines away is a science on its own and a too large
+undertaking for a microframework like Flask.</p>
+<p>Furthermore extensions can then easily depend on one template language
+being present. You can easily use your own templating language, but an
+extension could still depend on Jinja itself.</p>
+</div>
+<div class="section" id="micro-with-dependencies">
+<h2>Micro with Dependencies<a class="headerlink" href="#micro-with-dependencies" title="Permalink to this headline">¶</a></h2>
+<p>Why does Flask call itself a microframework and yet it depends on two
+libraries (namely Werkzeug and Jinja2). Why shouldn&#8217;t it? If we look
+over to the Ruby side of web development there we have a protocol very
+similar to WSGI. Just that it&#8217;s called Rack there, but besides that it
+looks very much like a WSGI rendition for Ruby. But nearly all
+applications in Ruby land do not work with Rack directly, but on top of a
+library with the same name. This Rack library has two equivalents in
+Python: WebOb (formerly Paste) and Werkzeug. Paste is still around but
+from my understanding it&#8217;s sort of deprecated in favour of WebOb. The
+development of WebOb and Werkzeug started side by side with similar ideas
+in mind: be a good implementation of WSGI for other applications to take
+advantage.</p>
+<p>Flask is a framework that takes advantage of the work already done by
+Werkzeug to properly interface WSGI (which can be a complex task at
+times). Thanks to recent developments in the Python package
+infrastructure, packages with dependencies are no longer an issue and
+there are very few reasons against having libraries that depend on others.</p>
+</div>
+<div class="section" id="thread-locals">
+<h2>Thread Locals<a class="headerlink" href="#thread-locals" title="Permalink to this headline">¶</a></h2>
+<p>Flask uses thread local objects (context local objects in fact, they
+support greenlet contexts as well) for request, session and an extra
+object you can put your own things on (<a class="reference internal" href="api.html#flask.g" title="flask.g"><tt class="xref py py-data docutils literal"><span class="pre">g</span></tt></a>). Why is that and
+isn&#8217;t that a bad idea?</p>
+<p>Yes it is usually not such a bright idea to use thread locals. They cause
+troubles for servers that are not based on the concept of threads and make
+large applications harder to maintain. However Flask is just not designed
+for large applications or asynchronous servers. Flask wants to make it
+quick and easy to write a traditional web application.</p>
+<p>Also see the <a class="reference internal" href="becomingbig.html#becomingbig"><em>Becoming Big</em></a> section of the documentation for some
+inspiration for larger applications based on Flask.</p>
+</div>
+<div class="section" id="what-flask-is-what-flask-is-not">
+<h2>What Flask is, What Flask is Not<a class="headerlink" href="#what-flask-is-what-flask-is-not" title="Permalink to this headline">¶</a></h2>
+<p>Flask will never have a database layer. It will not have a form library
+or anything else in that direction. Flask itself just bridges to Werkzeug
+to implement a proper WSGI application and to Jinja2 to handle templating.
+It also binds to a few common standard library packages such as logging.
+Everything else is up for extensions.</p>
+<p>Why is this the case? Because people have different preferences and
+requirements and Flask could not meet those if it would force any of this
+into the core. The majority of web applications will need a template
+engine in some sort. However not every application needs a SQL database.</p>
+<p>The idea of Flask is to build a good foundation for all applications.
+Everything else is up to you or extensions.</p>
+</div>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="index.html">
+ <img class="logo" src="_static/flask.png" alt="Logo"/>
+</a></p>
+ <h3><a href="index.html">Table Of Contents</a></h3>
+ <ul>
+<li><a class="reference internal" href="#">Design Decisions in Flask</a><ul>
+<li><a class="reference internal" href="#the-explicit-application-object">The Explicit Application Object</a></li>
+<li><a class="reference internal" href="#the-routing-system">The Routing System</a></li>
+<li><a class="reference internal" href="#one-template-engine">One Template Engine</a></li>
+<li><a class="reference internal" href="#micro-with-dependencies">Micro with Dependencies</a></li>
+<li><a class="reference internal" href="#thread-locals">Thread Locals</a></li>
+<li><a class="reference internal" href="#what-flask-is-what-flask-is-not">What Flask is, What Flask is Not</a></li>
+</ul>
+</li>
+</ul>
+<h3>Related Topics</h3>
+<ul>
+ <li><a href="index.html">Documentation overview</a><ul>
+ <li>Previous: <a href="api.html" title="previous chapter">API</a></li>
+ <li>Next: <a href="htmlfaq.html" title="next chapter">HTML/XHTML FAQ</a></li>
+ </ul></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="_sources/design.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/errorhandling.html b/app/static/doc/flask-docs/errorhandling.html
new file mode 100644
index 0000000..9698707
--- /dev/null
+++ b/app/static/doc/flask-docs/errorhandling.html
@@ -0,0 +1,347 @@
+
+<!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>Handling Application Errors &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="index.html" />
+ <link rel="next" title="Configuration Handling" href="config.html" />
+ <link rel="prev" title="Testing Flask Applications" href="testing.html" />
+
+
+ <link rel="apple-touch-icon" href="_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <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="config.html" title="Configuration Handling"
+ accesskey="N">next</a> |</li>
+ <li class="right" >
+ <a href="testing.html" title="Testing Flask Applications"
+ accesskey="P">previous</a> |</li>
+ <li><a href="index.html">Flask 0.8 documentation</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="handling-application-errors">
+<span id="application-errors"></span><h1>Handling Application Errors<a class="headerlink" href="#handling-application-errors" title="Permalink to this headline">¶</a></h1>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.3.</span></p>
+<p>Applications fail, servers fail. Sooner or later you will see an exception
+in production. Even if your code is 100% correct, you will still see
+exceptions from time to time. Why? Because everything else involved will
+fail. Here some situations where perfectly fine code can lead to server
+errors:</p>
+<ul class="simple">
+<li>the client terminated the request early and the application was still
+reading from the incoming data.</li>
+<li>the database server was overloaded and could not handle the query.</li>
+<li>a filesystem is full</li>
+<li>a harddrive crashed</li>
+<li>a backend server overloaded</li>
+<li>a programming error in a library you are using</li>
+<li>network connection of the server to another system failed.</li>
+</ul>
+<p>And that&#8217;s just a small sample of issues you could be facing. So how do we
+deal with that sort of problem? By default if your application runs in
+production mode, Flask will display a very simple page for you and log the
+exception to the <a class="reference internal" href="api.html#flask.Flask.logger" title="flask.Flask.logger"><tt class="xref py py-attr docutils literal"><span class="pre">logger</span></tt></a>.</p>
+<p>But there is more you can do, and we will cover some better setups to deal
+with errors.</p>
+<div class="section" id="error-mails">
+<h2>Error Mails<a class="headerlink" href="#error-mails" title="Permalink to this headline">¶</a></h2>
+<p>If the application runs in production mode (which it will do on your
+server) you won&#8217;t see any log messages by default. Why is that? Flask
+tries to be a zero-configuration framework. Where should it drop the logs
+for you if there is no configuration? Guessing is not a good idea because
+chances are, the place it guessed is not the place where the user has
+permission to create a logfile. Also, for most small applications nobody
+will look at the logs anyways.</p>
+<p>In fact, I promise you right now that if you configure a logfile for the
+application errors you will never look at it except for debugging an issue
+when a user reported it for you. What you want instead is a mail the
+second the exception happened. Then you get an alert and you can do
+something about it.</p>
+<p>Flask uses the Python builtin logging system, and it can actually send
+you mails for errors which is probably what you want. Here is how you can
+configure the Flask logger to send you mails for exceptions:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="n">ADMINS</span> <span class="o">=</span> <span class="p">[</span><span class="s">&#39;yourname@example.com&#39;</span><span class="p">]</span>
+<span class="k">if</span> <span class="ow">not</span> <span class="n">app</span><span class="o">.</span><span class="n">debug</span><span class="p">:</span>
+ <span class="kn">import</span> <span class="nn">logging</span>
+ <span class="kn">from</span> <span class="nn">logging.handlers</span> <span class="kn">import</span> <span class="n">SMTPHandler</span>
+ <span class="n">mail_handler</span> <span class="o">=</span> <span class="n">SMTPHandler</span><span class="p">(</span><span class="s">&#39;127.0.0.1&#39;</span><span class="p">,</span>
+ <span class="s">&#39;server-error@example.com&#39;</span><span class="p">,</span>
+ <span class="n">ADMINS</span><span class="p">,</span> <span class="s">&#39;YourApplication Failed&#39;</span><span class="p">)</span>
+ <span class="n">mail_handler</span><span class="o">.</span><span class="n">setLevel</span><span class="p">(</span><span class="n">logging</span><span class="o">.</span><span class="n">ERROR</span><span class="p">)</span>
+ <span class="n">app</span><span class="o">.</span><span class="n">logger</span><span class="o">.</span><span class="n">addHandler</span><span class="p">(</span><span class="n">mail_handler</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>So what just happened? We created a new
+<a class="reference external" href="http://docs.python.org/dev/library/logging.handlers.html#logging.handlers.SMTPHandler" title="(in Python v3.3)"><tt class="xref py py-class docutils literal"><span class="pre">SMTPHandler</span></tt></a> that will send mails with the mail
+server listening on <tt class="docutils literal"><span class="pre">127.0.0.1</span></tt> to all the <cite>ADMINS</cite> from the address
+<em>server-error&#64;example.com</em> with the subject &#8220;YourApplication Failed&#8221;. If
+your mail server requires credentials, these can also be provided. For
+that check out the documentation for the
+<a class="reference external" href="http://docs.python.org/dev/library/logging.handlers.html#logging.handlers.SMTPHandler" title="(in Python v3.3)"><tt class="xref py py-class docutils literal"><span class="pre">SMTPHandler</span></tt></a>.</p>
+<p>We also tell the handler to only send errors and more critical messages.
+Because we certainly don&#8217;t want to get a mail for warnings or other
+useless logs that might happen during request handling.</p>
+<p>Before you run that in production, please also look at <a class="reference internal" href="#logformat"><em>Controlling the Log Format</em></a> to
+put more information into that error mail. That will save you from a lot
+of frustration.</p>
+</div>
+<div class="section" id="logging-to-a-file">
+<h2>Logging to a File<a class="headerlink" href="#logging-to-a-file" title="Permalink to this headline">¶</a></h2>
+<p>Even if you get mails, you probably also want to log warnings. It&#8217;s a
+good idea to keep as much information around that might be required to
+debug a problem. Please note that Flask itself will not issue any
+warnings in the core system, so it&#8217;s your responsibility to warn in the
+code if something seems odd.</p>
+<p>There are a couple of handlers provided by the logging system out of the
+box but not all of them are useful for basic error logging. The most
+interesting are probably the following:</p>
+<ul class="simple">
+<li><a class="reference external" href="http://docs.python.org/dev/library/logging.handlers.html#logging.FileHandler" title="(in Python v3.3)"><tt class="xref py py-class docutils literal"><span class="pre">FileHandler</span></tt></a> - logs messages to a file on the
+filesystem.</li>
+<li><a class="reference external" href="http://docs.python.org/dev/library/logging.handlers.html#logging.handlers.RotatingFileHandler" title="(in Python v3.3)"><tt class="xref py py-class docutils literal"><span class="pre">RotatingFileHandler</span></tt></a> - logs messages to a file
+on the filesystem and will rotate after a certain number of messages.</li>
+<li><a class="reference external" href="http://docs.python.org/dev/library/logging.handlers.html#logging.handlers.NTEventLogHandler" title="(in Python v3.3)"><tt class="xref py py-class docutils literal"><span class="pre">NTEventLogHandler</span></tt></a> - will log to the system
+event log of a Windows system. If you are deploying on a Windows box,
+this is what you want to use.</li>
+<li><a class="reference external" href="http://docs.python.org/dev/library/logging.handlers.html#logging.handlers.SysLogHandler" title="(in Python v3.3)"><tt class="xref py py-class docutils literal"><span class="pre">SysLogHandler</span></tt></a> - sends logs to a UNIX
+syslog.</li>
+</ul>
+<p>Once you picked your log handler, do like you did with the SMTP handler
+above, just make sure to use a lower setting (I would recommend
+<cite>WARNING</cite>):</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">if</span> <span class="ow">not</span> <span class="n">app</span><span class="o">.</span><span class="n">debug</span><span class="p">:</span>
+ <span class="kn">import</span> <span class="nn">logging</span>
+ <span class="kn">from</span> <span class="nn">themodule</span> <span class="kn">import</span> <span class="n">TheHandlerYouWant</span>
+ <span class="n">file_handler</span> <span class="o">=</span> <span class="n">TheHandlerYouWant</span><span class="p">(</span><span class="o">...</span><span class="p">)</span>
+ <span class="n">file_handler</span><span class="o">.</span><span class="n">setLevel</span><span class="p">(</span><span class="n">logging</span><span class="o">.</span><span class="n">WARNING</span><span class="p">)</span>
+ <span class="n">app</span><span class="o">.</span><span class="n">logger</span><span class="o">.</span><span class="n">addHandler</span><span class="p">(</span><span class="n">file_handler</span><span class="p">)</span>
+</pre></div>
+</div>
+</div>
+<div class="section" id="controlling-the-log-format">
+<span id="logformat"></span><h2>Controlling the Log Format<a class="headerlink" href="#controlling-the-log-format" title="Permalink to this headline">¶</a></h2>
+<p>By default a handler will only write the message string into a file or
+send you that message as mail. A log record stores more information,
+and it makes a lot of sense to configure your logger to also contain that
+information so that you have a better idea of why that error happened, and
+more importantly, where it did.</p>
+<p>A formatter can be instantiated with a format string. Note that
+tracebacks are appended to the log entry automatically. You don&#8217;t have to
+do that in the log formatter format string.</p>
+<p>Here some example setups:</p>
+<div class="section" id="email">
+<h3>Email<a class="headerlink" href="#email" title="Permalink to this headline">¶</a></h3>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">logging</span> <span class="kn">import</span> <span class="n">Formatter</span>
+<span class="n">mail_handler</span><span class="o">.</span><span class="n">setFormatter</span><span class="p">(</span><span class="n">Formatter</span><span class="p">(</span><span class="s">&#39;&#39;&#39;</span>
+<span class="s">Message type: </span><span class="si">%(levelname)s</span><span class="s"></span>
+<span class="s">Location: </span><span class="si">%(pathname)s</span><span class="s">:</span><span class="si">%(lineno)d</span><span class="s"></span>
+<span class="s">Module: </span><span class="si">%(module)s</span><span class="s"></span>
+<span class="s">Function: </span><span class="si">%(funcName)s</span><span class="s"></span>
+<span class="s">Time: </span><span class="si">%(asctime)s</span><span class="s"></span>
+
+<span class="s">Message:</span>
+
+<span class="si">%(message)s</span><span class="s"></span>
+<span class="s">&#39;&#39;&#39;</span><span class="p">))</span>
+</pre></div>
+</div>
+</div>
+<div class="section" id="file-logging">
+<h3>File logging<a class="headerlink" href="#file-logging" title="Permalink to this headline">¶</a></h3>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">logging</span> <span class="kn">import</span> <span class="n">Formatter</span>
+<span class="n">file_handler</span><span class="o">.</span><span class="n">setFormatter</span><span class="p">(</span><span class="n">Formatter</span><span class="p">(</span>
+ <span class="s">&#39;</span><span class="si">%(asctime)s</span><span class="s"> </span><span class="si">%(levelname)s</span><span class="s">: </span><span class="si">%(message)s</span><span class="s"> &#39;</span>
+ <span class="s">&#39;[in </span><span class="si">%(pathname)s</span><span class="s">:</span><span class="si">%(lineno)d</span><span class="s">]&#39;</span>
+<span class="p">))</span>
+</pre></div>
+</div>
+</div>
+<div class="section" id="complex-log-formatting">
+<h3>Complex Log Formatting<a class="headerlink" href="#complex-log-formatting" title="Permalink to this headline">¶</a></h3>
+<p>Here is a list of useful formatting variables for the format string. Note
+that this list is not complete, consult the official documentation of the
+<a class="reference external" href="http://docs.python.org/dev/library/logging.html#logging" title="(in Python v3.3)"><tt class="xref py py-mod docutils literal"><span class="pre">logging</span></tt></a> package for a full list.</p>
+<table border="1" class="docutils">
+<colgroup>
+<col width="26%" />
+<col width="74%" />
+</colgroup>
+<thead valign="bottom">
+<tr class="row-odd"><th class="head">Format</th>
+<th class="head">Description</th>
+</tr>
+</thead>
+<tbody valign="top">
+<tr class="row-even"><td><tt class="docutils literal"><span class="pre">%(levelname)s</span></tt></td>
+<td>Text logging level for the message
+(<tt class="docutils literal"><span class="pre">'DEBUG'</span></tt>, <tt class="docutils literal"><span class="pre">'INFO'</span></tt>, <tt class="docutils literal"><span class="pre">'WARNING'</span></tt>,
+<tt class="docutils literal"><span class="pre">'ERROR'</span></tt>, <tt class="docutils literal"><span class="pre">'CRITICAL'</span></tt>).</td>
+</tr>
+<tr class="row-odd"><td><tt class="docutils literal"><span class="pre">%(pathname)s</span></tt></td>
+<td>Full pathname of the source file where the
+logging call was issued (if available).</td>
+</tr>
+<tr class="row-even"><td><tt class="docutils literal"><span class="pre">%(filename)s</span></tt></td>
+<td>Filename portion of pathname.</td>
+</tr>
+<tr class="row-odd"><td><tt class="docutils literal"><span class="pre">%(module)s</span></tt></td>
+<td>Module (name portion of filename).</td>
+</tr>
+<tr class="row-even"><td><tt class="docutils literal"><span class="pre">%(funcName)s</span></tt></td>
+<td>Name of function containing the logging call.</td>
+</tr>
+<tr class="row-odd"><td><tt class="docutils literal"><span class="pre">%(lineno)d</span></tt></td>
+<td>Source line number where the logging call was
+issued (if available).</td>
+</tr>
+<tr class="row-even"><td><tt class="docutils literal"><span class="pre">%(asctime)s</span></tt></td>
+<td>Human-readable time when the LogRecord` was
+created. By default this is of the form
+<tt class="docutils literal"><span class="pre">&quot;2003-07-08</span> <span class="pre">16:49:45,896&quot;</span></tt> (the numbers after
+the comma are millisecond portion of the time).
+This can be changed by subclassing the formatter
+and overriding the
+<a class="reference external" href="http://docs.python.org/dev/library/logging.html#logging.Formatter.formatTime" title="(in Python v3.3)"><tt class="xref py py-meth docutils literal"><span class="pre">formatTime()</span></tt></a> method.</td>
+</tr>
+<tr class="row-odd"><td><tt class="docutils literal"><span class="pre">%(message)s</span></tt></td>
+<td>The logged message, computed as <tt class="docutils literal"><span class="pre">msg</span> <span class="pre">%</span> <span class="pre">args</span></tt></td>
+</tr>
+</tbody>
+</table>
+<p>If you want to further customize the formatting, you can subclass the
+formatter. The formatter has three interesting methods:</p>
+<dl class="docutils">
+<dt><a class="reference external" href="http://docs.python.org/dev/library/logging.html#logging.Formatter.format" title="(in Python v3.3)"><tt class="xref py py-meth docutils literal"><span class="pre">format()</span></tt></a>:</dt>
+<dd>handles the actual formatting. It is passed a
+<a class="reference external" href="http://docs.python.org/dev/library/logging.html#logging.LogRecord" title="(in Python v3.3)"><tt class="xref py py-class docutils literal"><span class="pre">LogRecord</span></tt></a> object and has to return the formatted
+string.</dd>
+<dt><a class="reference external" href="http://docs.python.org/dev/library/logging.html#logging.Formatter.formatTime" title="(in Python v3.3)"><tt class="xref py py-meth docutils literal"><span class="pre">formatTime()</span></tt></a>:</dt>
+<dd>called for <cite>asctime</cite> formatting. If you want a different time format
+you can override this method.</dd>
+<dt><a class="reference external" href="http://docs.python.org/dev/library/logging.html#logging.Formatter.formatException" title="(in Python v3.3)"><tt class="xref py py-meth docutils literal"><span class="pre">formatException()</span></tt></a></dt>
+<dd>called for exception formatting. It is passed an <tt class="xref py py-attr docutils literal"><span class="pre">exc_info</span></tt>
+tuple and has to return a string. The default is usually fine, you
+don&#8217;t have to override it.</dd>
+</dl>
+<p>For more information, head over to the official documentation.</p>
+</div>
+</div>
+<div class="section" id="other-libraries">
+<h2>Other Libraries<a class="headerlink" href="#other-libraries" title="Permalink to this headline">¶</a></h2>
+<p>So far we only configured the logger your application created itself.
+Other libraries might log themselves as well. For example, SQLAlchemy uses
+logging heavily in its core. While there is a method to configure all
+loggers at once in the <a class="reference external" href="http://docs.python.org/dev/library/logging.html#logging" title="(in Python v3.3)"><tt class="xref py py-mod docutils literal"><span class="pre">logging</span></tt></a> package, I would not recommend using
+it. There might be a situation in which you want to have multiple
+separate applications running side by side in the same Python interpreter
+and then it becomes impossible to have different logging setups for those.</p>
+<p>Instead, I would recommend figuring out which loggers you are interested
+in, getting the loggers with the <a class="reference external" href="http://docs.python.org/dev/library/logging.html#logging.getLogger" title="(in Python v3.3)"><tt class="xref py py-func docutils literal"><span class="pre">getLogger()</span></tt></a> function and
+iterating over them to attach handlers:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">logging</span> <span class="kn">import</span> <span class="n">getLogger</span>
+<span class="n">loggers</span> <span class="o">=</span> <span class="p">[</span><span class="n">app</span><span class="o">.</span><span class="n">logger</span><span class="p">,</span> <span class="n">getLogger</span><span class="p">(</span><span class="s">&#39;sqlalchemy&#39;</span><span class="p">),</span>
+ <span class="n">getLogger</span><span class="p">(</span><span class="s">&#39;otherlibrary&#39;</span><span class="p">)]</span>
+<span class="k">for</span> <span class="n">logger</span> <span class="ow">in</span> <span class="n">loggers</span><span class="p">:</span>
+ <span class="n">logger</span><span class="o">.</span><span class="n">addHandler</span><span class="p">(</span><span class="n">mail_handler</span><span class="p">)</span>
+ <span class="n">logger</span><span class="o">.</span><span class="n">addHandler</span><span class="p">(</span><span class="n">file_handler</span><span class="p">)</span>
+</pre></div>
+</div>
+</div>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="index.html">
+ <img class="logo" src="_static/flask.png" alt="Logo"/>
+</a></p>
+ <h3><a href="index.html">Table Of Contents</a></h3>
+ <ul>
+<li><a class="reference internal" href="#">Handling Application Errors</a><ul>
+<li><a class="reference internal" href="#error-mails">Error Mails</a></li>
+<li><a class="reference internal" href="#logging-to-a-file">Logging to a File</a></li>
+<li><a class="reference internal" href="#controlling-the-log-format">Controlling the Log Format</a><ul>
+<li><a class="reference internal" href="#email">Email</a></li>
+<li><a class="reference internal" href="#file-logging">File logging</a></li>
+<li><a class="reference internal" href="#complex-log-formatting">Complex Log Formatting</a></li>
+</ul>
+</li>
+<li><a class="reference internal" href="#other-libraries">Other Libraries</a></li>
+</ul>
+</li>
+</ul>
+<h3>Related Topics</h3>
+<ul>
+ <li><a href="index.html">Documentation overview</a><ul>
+ <li>Previous: <a href="testing.html" title="previous chapter">Testing Flask Applications</a></li>
+ <li>Next: <a href="config.html" title="next chapter">Configuration Handling</a></li>
+ </ul></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="_sources/errorhandling.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/extensiondev.html b/app/static/doc/flask-docs/extensiondev.html
new file mode 100644
index 0000000..05044b0
--- /dev/null
+++ b/app/static/doc/flask-docs/extensiondev.html
@@ -0,0 +1,475 @@
+
+<!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>Flask Extension Development &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="index.html" />
+ <link rel="next" title="Pocoo Styleguide" href="styleguide.html" />
+ <link rel="prev" title="Unicode in Flask" href="unicode.html" />
+
+
+ <link rel="apple-touch-icon" href="_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <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="styleguide.html" title="Pocoo Styleguide"
+ accesskey="N">next</a> |</li>
+ <li class="right" >
+ <a href="unicode.html" title="Unicode in Flask"
+ accesskey="P">previous</a> |</li>
+ <li><a href="index.html">Flask 0.8 documentation</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="flask-extension-development">
+<h1>Flask Extension Development<a class="headerlink" href="#flask-extension-development" title="Permalink to this headline">¶</a></h1>
+<p>Flask, being a microframework, often requires some repetitive steps to get
+a third party library working. Because very often these steps could be
+abstracted to support multiple projects the <a class="reference external" href="http://flask.pocoo.org/extensions/">Flask Extension Registry</a>
+was created.</p>
+<p>If you want to create your own Flask extension for something that does not
+exist yet, this guide to extension development will help you get your
+extension running in no time and to feel like users would expect your
+extension to behave.</p>
+<div class="section" id="anatomy-of-an-extension">
+<h2>Anatomy of an Extension<a class="headerlink" href="#anatomy-of-an-extension" title="Permalink to this headline">¶</a></h2>
+<p>Extensions are all located in a package called <tt class="docutils literal"><span class="pre">flask_something</span></tt>
+where &#8220;something&#8221; is the name of the library you want to bridge. So for
+example if you plan to add support for a library named <cite>simplexml</cite> to
+Flask, you would name your extension&#8217;s package <tt class="docutils literal"><span class="pre">flask_simplexml</span></tt>.</p>
+<p>The name of the actual extension (the human readable name) however would
+be something like &#8220;Flask-SimpleXML&#8221;. Make sure to include the name
+&#8220;Flask&#8221; somewhere in that name and that you check the capitalization.
+This is how users can then register dependencies to your extension in
+their <cite>setup.py</cite> files.</p>
+<p>Flask sets up a redirect package called <tt class="xref py py-data docutils literal"><span class="pre">flask.ext</span></tt> where users
+should import the extensions from. If you for instance have a package
+called <tt class="docutils literal"><span class="pre">flask_something</span></tt> users would import it as
+<tt class="docutils literal"><span class="pre">flask.ext.something</span></tt>. This is done to transition from the old
+namespace packages. See <a class="reference internal" href="#ext-import-transition"><em>Extension Import Transition</em></a> for more details.</p>
+<p>But how do extensions look like themselves? An extension has to ensure
+that it works with multiple Flask application instances at once. This is
+a requirement because many people will use patterns like the
+<a class="reference internal" href="patterns/appfactories.html#app-factories"><em>Application Factories</em></a> pattern to create their application as needed to aid
+unittests and to support multiple configurations. Because of that it is
+crucial that your application supports that kind of behaviour.</p>
+<p>Most importantly the extension must be shipped with a <cite>setup.py</cite> file and
+registered on PyPI. Also the development checkout link should work so
+that people can easily install the development version into their
+virtualenv without having to download the library by hand.</p>
+<p>Flask extensions must be licensed as BSD or MIT or a more liberal license
+to be enlisted on the Flask Extension Registry. Keep in mind that the
+Flask Extension Registry is a moderated place and libraries will be
+reviewed upfront if they behave as required.</p>
+</div>
+<div class="section" id="hello-flaskext">
+<h2>&#8220;Hello Flaskext!&#8221;<a class="headerlink" href="#hello-flaskext" title="Permalink to this headline">¶</a></h2>
+<p>So let&#8217;s get started with creating such a Flask extension. The extension
+we want to create here will provide very basic support for SQLite3.</p>
+<p>First we create the following folder structure:</p>
+<div class="highlight-python"><pre>flask-sqlite3/
+ flask_sqlite3.py
+ LICENSE
+ README</pre>
+</div>
+<p>Here&#8217;s the contents of the most important files:</p>
+<div class="section" id="setup-py">
+<h3>setup.py<a class="headerlink" href="#setup-py" title="Permalink to this headline">¶</a></h3>
+<p>The next file that is absolutely required is the <cite>setup.py</cite> file which is
+used to install your Flask extension. The following contents are
+something you can work with:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">Flask-SQLite3</span>
+<span class="sd">-------------</span>
+
+<span class="sd">This is the description for that library</span>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="kn">from</span> <span class="nn">setuptools</span> <span class="kn">import</span> <span class="n">setup</span>
+
+
+<span class="n">setup</span><span class="p">(</span>
+ <span class="n">name</span><span class="o">=</span><span class="s">&#39;Flask-SQLite3&#39;</span><span class="p">,</span>
+ <span class="n">version</span><span class="o">=</span><span class="s">&#39;1.0&#39;</span><span class="p">,</span>
+ <span class="n">url</span><span class="o">=</span><span class="s">&#39;http://example.com/flask-sqlite3/&#39;</span><span class="p">,</span>
+ <span class="n">license</span><span class="o">=</span><span class="s">&#39;BSD&#39;</span><span class="p">,</span>
+ <span class="n">author</span><span class="o">=</span><span class="s">&#39;Your Name&#39;</span><span class="p">,</span>
+ <span class="n">author_email</span><span class="o">=</span><span class="s">&#39;your-email@example.com&#39;</span><span class="p">,</span>
+ <span class="n">description</span><span class="o">=</span><span class="s">&#39;Very short description&#39;</span><span class="p">,</span>
+ <span class="n">long_description</span><span class="o">=</span><span class="n">__doc__</span><span class="p">,</span>
+ <span class="n">py_modules</span><span class="o">=</span><span class="p">[</span><span class="s">&#39;flask_sqlite3&#39;</span><span class="p">],</span>
+ <span class="c"># if you would be using a package instead use packages instead</span>
+ <span class="c"># of py_modules:</span>
+ <span class="c"># packages=[&#39;flask_sqlite3&#39;],</span>
+ <span class="n">zip_safe</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span>
+ <span class="n">include_package_data</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span>
+ <span class="n">platforms</span><span class="o">=</span><span class="s">&#39;any&#39;</span><span class="p">,</span>
+ <span class="n">install_requires</span><span class="o">=</span><span class="p">[</span>
+ <span class="s">&#39;Flask&#39;</span>
+ <span class="p">],</span>
+ <span class="n">classifiers</span><span class="o">=</span><span class="p">[</span>
+ <span class="s">&#39;Environment :: Web Environment&#39;</span><span class="p">,</span>
+ <span class="s">&#39;Intended Audience :: Developers&#39;</span><span class="p">,</span>
+ <span class="s">&#39;License :: OSI Approved :: BSD License&#39;</span><span class="p">,</span>
+ <span class="s">&#39;Operating System :: OS Independent&#39;</span><span class="p">,</span>
+ <span class="s">&#39;Programming Language :: Python&#39;</span><span class="p">,</span>
+ <span class="s">&#39;Topic :: Internet :: WWW/HTTP :: Dynamic Content&#39;</span><span class="p">,</span>
+ <span class="s">&#39;Topic :: Software Development :: Libraries :: Python Modules&#39;</span>
+ <span class="p">]</span>
+<span class="p">)</span>
+</pre></div>
+</div>
+<p>That&#8217;s a lot of code but you can really just copy/paste that from existing
+extensions and adapt.</p>
+</div>
+<div class="section" id="flask-sqlite3-py">
+<h3>flask_sqlite3.py<a class="headerlink" href="#flask-sqlite3-py" title="Permalink to this headline">¶</a></h3>
+<p>Now this is where your extension code goes. But how exactly should such
+an extension look like? What are the best practices? Continue reading
+for some insight.</p>
+</div>
+</div>
+<div class="section" id="initializing-extensions">
+<h2>Initializing Extensions<a class="headerlink" href="#initializing-extensions" title="Permalink to this headline">¶</a></h2>
+<p>Many extensions will need some kind of initialization step. For example,
+consider your application is currently connecting to SQLite like the
+documentation suggests (<a class="reference internal" href="patterns/sqlite3.html#sqlite3"><em>Using SQLite 3 with Flask</em></a>) you will need to provide a few
+functions and before / after request handlers. So how does the extension
+know the name of the application object?</p>
+<p>Quite simple: you pass it to it.</p>
+<p>There are two recommended ways for an extension to initialize:</p>
+<dl class="docutils">
+<dt>initialization functions:</dt>
+<dd>If your extension is called <cite>helloworld</cite> you might have a function
+called <tt class="docutils literal"><span class="pre">init_helloworld(app[,</span> <span class="pre">extra_args])</span></tt> that initializes the
+extension for that application. It could attach before / after
+handlers etc.</dd>
+<dt>classes:</dt>
+<dd>Classes work mostly like initialization functions but can later be
+used to further change the behaviour. For an example look at how the
+<a class="reference external" href="http://packages.python.org/Flask-OAuth/">OAuth extension</a> works: there is an <cite>OAuth</cite> object that provides
+some helper functions like <cite>OAuth.remote_app</cite> to create a reference to
+a remote application that uses OAuth.</dd>
+</dl>
+<p>What to use depends on what you have in mind. For the SQLite 3 extension
+we will use the class based approach because it will provide users with a
+manager object that handles opening and closing database connections.</p>
+</div>
+<div class="section" id="the-extension-code">
+<h2>The Extension Code<a class="headerlink" href="#the-extension-code" title="Permalink to this headline">¶</a></h2>
+<p>Here&#8217;s the contents of the <cite>flask_sqlite3.py</cite> for copy/paste:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">__future__</span> <span class="kn">import</span> <span class="n">absolute_import</span>
+<span class="kn">import</span> <span class="nn">sqlite3</span>
+
+<span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">_request_ctx_stack</span>
+
+<span class="k">class</span> <span class="nc">SQLite3</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
+
+ <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">app</span><span class="p">):</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">app</span> <span class="o">=</span> <span class="n">app</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">app</span><span class="o">.</span><span class="n">config</span><span class="o">.</span><span class="n">setdefault</span><span class="p">(</span><span class="s">&#39;SQLITE3_DATABASE&#39;</span><span class="p">,</span> <span class="s">&#39;:memory:&#39;</span><span class="p">)</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">app</span><span class="o">.</span><span class="n">teardown_request</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">teardown_request</span><span class="p">)</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">app</span><span class="o">.</span><span class="n">before_request</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">before_request</span><span class="p">)</span>
+
+ <span class="k">def</span> <span class="nf">connect</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+ <span class="k">return</span> <span class="n">sqlite3</span><span class="o">.</span><span class="n">connect</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">app</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s">&#39;SQLITE3_DATABASE&#39;</span><span class="p">])</span>
+
+ <span class="k">def</span> <span class="nf">before_request</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+ <span class="n">ctx</span> <span class="o">=</span> <span class="n">_request_ctx_stack</span><span class="o">.</span><span class="n">top</span>
+ <span class="n">ctx</span><span class="o">.</span><span class="n">sqlite3_db</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
+
+ <span class="k">def</span> <span class="nf">teardown_request</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">exception</span><span class="p">):</span>
+ <span class="n">ctx</span> <span class="o">=</span> <span class="n">_request_ctx_stack</span><span class="o">.</span><span class="n">top</span>
+ <span class="n">ctx</span><span class="o">.</span><span class="n">sqlite3_db</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
+
+ <span class="k">def</span> <span class="nf">get_db</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+ <span class="n">ctx</span> <span class="o">=</span> <span class="n">_request_ctx_stack</span><span class="o">.</span><span class="n">top</span>
+ <span class="k">if</span> <span class="n">ctx</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+ <span class="k">return</span> <span class="n">ctx</span><span class="o">.</span><span class="n">sqlite3_db</span>
+</pre></div>
+</div>
+<p>So here&#8217;s what these lines of code do:</p>
+<ol class="arabic simple">
+<li>The <tt class="docutils literal"><span class="pre">__future__</span></tt> import is necessary to activate absolute imports.
+Otherwise we could not call our module <cite>sqlite3.py</cite> and import the
+top-level <cite>sqlite3</cite> module which actually implements the connection to
+SQLite.</li>
+<li>We create a class for our extension that requires a supplied <cite>app</cite> object,
+sets a configuration for the database if it&#8217;s not there
+(<a class="reference external" href="http://docs.python.org/dev/library/stdtypes.html#dict.setdefault" title="(in Python v3.3)"><tt class="xref py py-meth docutils literal"><span class="pre">dict.setdefault()</span></tt></a>), and attaches <cite>before_request</cite> and
+<cite>teardown_request</cite> handlers.</li>
+<li>Next, we define a <cite>connect</cite> function that opens a database connection.</li>
+<li>Then we set up the request handlers we bound to the app above. Note here
+that we&#8217;re attaching our database connection to the top request context via
+<cite>_request_ctx_stack.top</cite>. Extensions should use the top context and not the
+<cite>g</cite> object to store things like database connections.</li>
+<li>Finally, we add a <cite>get_db</cite> function that simplifies access to the context&#8217;s
+database.</li>
+</ol>
+<p>So why did we decide on a class based approach here? Because using our
+extension looks something like this:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">Flask</span>
+<span class="kn">from</span> <span class="nn">flask_sqlite3</span> <span class="kn">import</span> <span class="n">SQLite3</span>
+
+<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">app</span><span class="o">.</span><span class="n">config</span><span class="o">.</span><span class="n">from_pyfile</span><span class="p">(</span><span class="s">&#39;the-config.cfg&#39;</span><span class="p">)</span>
+<span class="n">manager</span> <span class="o">=</span> <span class="n">SQLite3</span><span class="p">(</span><span class="n">app</span><span class="p">)</span>
+<span class="n">db</span> <span class="o">=</span> <span class="n">manager</span><span class="o">.</span><span class="n">get_db</span><span class="p">()</span>
+</pre></div>
+</div>
+<p>You can then use the database from views like this:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/&#39;</span><span class="p">)</span>
+<span class="k">def</span> <span class="nf">show_all</span><span class="p">():</span>
+ <span class="n">cur</span> <span class="o">=</span> <span class="n">db</span><span class="o">.</span><span class="n">cursor</span><span class="p">()</span>
+ <span class="n">cur</span><span class="o">.</span><span class="n">execute</span><span class="p">(</span><span class="o">...</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>Opening a database connection from outside a view function is simple.</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">yourapplication</span> <span class="kn">import</span> <span class="n">db</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">cur</span> <span class="o">=</span> <span class="n">db</span><span class="o">.</span><span class="n">cursor</span><span class="p">()</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">cur</span><span class="o">.</span><span class="n">execute</span><span class="p">(</span><span class="o">...</span><span class="p">)</span>
+</pre></div>
+</div>
+</div>
+<div class="section" id="adding-an-init-app-function">
+<h2>Adding an <cite>init_app</cite> Function<a class="headerlink" href="#adding-an-init-app-function" title="Permalink to this headline">¶</a></h2>
+<p>In practice, you&#8217;ll almost always want to permit users to initialize your
+extension and provide an app object after the fact. This can help avoid
+circular import problems when a user is breaking their app into multiple files.
+Our extension could add an <cite>init_app</cite> function as follows:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">class</span> <span class="nc">SQLite3</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
+
+ <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">app</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+ <span class="k">if</span> <span class="n">app</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">app</span> <span class="o">=</span> <span class="n">app</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">init_app</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">app</span><span class="p">)</span>
+ <span class="k">else</span><span class="p">:</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">app</span> <span class="o">=</span> <span class="bp">None</span>
+
+ <span class="k">def</span> <span class="nf">init_app</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">app</span><span class="p">):</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">app</span> <span class="o">=</span> <span class="n">app</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">app</span><span class="o">.</span><span class="n">config</span><span class="o">.</span><span class="n">setdefault</span><span class="p">(</span><span class="s">&#39;SQLITE3_DATABASE&#39;</span><span class="p">,</span> <span class="s">&#39;:memory:&#39;</span><span class="p">)</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">app</span><span class="o">.</span><span class="n">teardown_request</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">teardown_request</span><span class="p">)</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">app</span><span class="o">.</span><span class="n">before_request</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">before_request</span><span class="p">)</span>
+
+ <span class="k">def</span> <span class="nf">connect</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+ <span class="k">return</span> <span class="n">sqlite3</span><span class="o">.</span><span class="n">connect</span><span class="p">(</span><span class="n">app</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s">&#39;SQLITE3_DATABASE&#39;</span><span class="p">])</span>
+
+ <span class="k">def</span> <span class="nf">before_request</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+ <span class="n">ctx</span> <span class="o">=</span> <span class="n">_request_ctx_stack</span><span class="o">.</span><span class="n">top</span>
+ <span class="n">ctx</span><span class="o">.</span><span class="n">sqlite3_db</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
+
+ <span class="k">def</span> <span class="nf">teardown_request</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">exception</span><span class="p">):</span>
+ <span class="n">ctx</span> <span class="o">=</span> <span class="n">_request_ctx_stack</span><span class="o">.</span><span class="n">top</span>
+ <span class="n">ctx</span><span class="o">.</span><span class="n">sqlite3_db</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
+
+ <span class="k">def</span> <span class="nf">get_db</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+ <span class="n">ctx</span> <span class="o">=</span> <span class="n">_request_ctx_stack</span><span class="o">.</span><span class="n">top</span>
+ <span class="k">if</span> <span class="n">ctx</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+ <span class="k">return</span> <span class="n">ctx</span><span class="o">.</span><span class="n">sqlite3_db</span>
+</pre></div>
+</div>
+<p>The user could then initialize the extension in one file:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="n">manager</span> <span class="o">=</span> <span class="n">SQLite3</span><span class="p">()</span>
+</pre></div>
+</div>
+<p>and bind their app to the extension in another file:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="n">manager</span><span class="o">.</span><span class="n">init_app</span><span class="p">(</span><span class="n">app</span><span class="p">)</span>
+</pre></div>
+</div>
+</div>
+<div class="section" id="end-of-request-behavior">
+<h2>End-Of-Request Behavior<a class="headerlink" href="#end-of-request-behavior" title="Permalink to this headline">¶</a></h2>
+<p>Due to the change in Flask 0.7 regarding functions that are run at the end
+of the request your extension will have to be extra careful there if it
+wants to continue to support older versions of Flask. The following
+pattern is a good way to support both:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">def</span> <span class="nf">close_connection</span><span class="p">(</span><span class="n">response</span><span class="p">):</span>
+ <span class="n">ctx</span> <span class="o">=</span> <span class="n">_request_ctx_stack</span><span class="o">.</span><span class="n">top</span>
+ <span class="n">ctx</span><span class="o">.</span><span class="n">sqlite3_db</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
+ <span class="k">return</span> <span class="n">response</span>
+
+<span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="n">app</span><span class="p">,</span> <span class="s">&#39;teardown_request&#39;</span><span class="p">):</span>
+ <span class="n">app</span><span class="o">.</span><span class="n">teardown_request</span><span class="p">(</span><span class="n">close_connection</span><span class="p">)</span>
+<span class="k">else</span><span class="p">:</span>
+ <span class="n">app</span><span class="o">.</span><span class="n">after_request</span><span class="p">(</span><span class="n">close_connection</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>Strictly speaking the above code is wrong, because teardown functions are
+passed the exception and typically don&#8217;t return anything. However because
+the return value is discarded this will just work assuming that the code
+in between does not touch the passed parameter.</p>
+</div>
+<div class="section" id="learn-from-others">
+<h2>Learn from Others<a class="headerlink" href="#learn-from-others" title="Permalink to this headline">¶</a></h2>
+<p>This documentation only touches the bare minimum for extension
+development. If you want to learn more, it&#8217;s a very good idea to check
+out existing extensions on the <a class="reference external" href="http://flask.pocoo.org/extensions/">Flask Extension Registry</a>. If you feel
+lost there is still the <a class="reference external" href="http://flask.pocoo.org/mailinglist/">mailinglist</a> and the <a class="reference external" href="http://flask.pocoo.org/community/irc/">IRC channel</a> to get some
+ideas for nice looking APIs. Especially if you do something nobody before
+you did, it might be a very good idea to get some more input. This not
+only to get an idea about what people might want to have from an
+extension, but also to avoid having multiple developers working on pretty
+much the same side by side.</p>
+<p>Remember: good API design is hard, so introduce your project on the
+mailinglist, and let other developers give you a helping hand with
+designing the API.</p>
+<p>The best Flask extensions are extensions that share common idioms for the
+API. And this can only work if collaboration happens early.</p>
+</div>
+<div class="section" id="approved-extensions">
+<h2>Approved Extensions<a class="headerlink" href="#approved-extensions" title="Permalink to this headline">¶</a></h2>
+<p>Flask also has the concept of approved extensions. Approved extensions
+are tested as part of Flask itself to ensure extensions do not break on
+new releases. These approved extensions are listed on the <a class="reference external" href="http://flask.pocoo.org/extensions/">Flask
+Extension Registry</a> and marked appropriately. If you want your own
+extension to be approved you have to follow these guidelines:</p>
+<ol class="arabic simple">
+<li>An approved Flask extension must provide exactly one package or module
+named <tt class="docutils literal"><span class="pre">flask_extensionname</span></tt>. They might also reside inside a
+<tt class="docutils literal"><span class="pre">flaskext</span></tt> namespace packages though this is discouraged now.</li>
+<li>It must ship a testing suite that can either be invoked with <tt class="docutils literal"><span class="pre">make</span> <span class="pre">test</span></tt>
+or <tt class="docutils literal"><span class="pre">python</span> <span class="pre">setup.py</span> <span class="pre">test</span></tt>. For test suites invoked with <tt class="docutils literal"><span class="pre">make</span>
+<span class="pre">test</span></tt> the extension has to ensure that all dependencies for the test
+are installed automatically, in case of <tt class="docutils literal"><span class="pre">python</span> <span class="pre">setup.py</span> <span class="pre">test</span></tt>
+dependencies for tests alone can be specified in the <cite>setup.py</cite>
+file. The test suite also has to be part of the distribution.</li>
+<li>APIs of approved extensions will be checked for the following
+characteristics:<ul>
+<li>an approved extension has to support multiple applications
+running in the same Python process.</li>
+<li>it must be possible to use the factory pattern for creating
+applications.</li>
+</ul>
+</li>
+<li>The license must be BSD/MIT/WTFPL licensed.</li>
+<li>The naming scheme for official extensions is <em>Flask-ExtensionName</em> or
+<em>ExtensionName-Flask</em>.</li>
+<li>Approved extensions must define all their dependencies in the
+<cite>setup.py</cite> file unless a dependency cannot be met because it is not
+available on PyPI.</li>
+<li>The extension must have documentation that uses one of the two Flask
+themes for Sphinx documentation.</li>
+<li>The setup.py description (and thus the PyPI description) has to
+link to the documentation, website (if there is one) and there
+must be a link to automatically install the development version
+(<tt class="docutils literal"><span class="pre">PackageName==dev</span></tt>).</li>
+<li>The <tt class="docutils literal"><span class="pre">zip_safe</span></tt> flag in the setup script must be set to <tt class="docutils literal"><span class="pre">False</span></tt>,
+even if the extension would be safe for zipping.</li>
+<li>An extension currently has to support Python 2.5, 2.6 as well as
+Python 2.7</li>
+</ol>
+</div>
+<div class="section" id="extension-import-transition">
+<span id="ext-import-transition"></span><h2>Extension Import Transition<a class="headerlink" href="#extension-import-transition" title="Permalink to this headline">¶</a></h2>
+<p>For a while we recommended using namespace packages for Flask extensions.
+This turned out to be problematic in practice because many different
+competing namespace package systems exist and pip would automatically
+switch between different systems and this caused a lot of problems for
+users.</p>
+<p>Instead we now recommend naming packages <tt class="docutils literal"><span class="pre">flask_foo</span></tt> instead of the now
+deprecated <tt class="docutils literal"><span class="pre">flaskext.foo</span></tt>. Flask 0.8 introduces a redirect import
+system that lets uses import from <tt class="docutils literal"><span class="pre">flask.ext.foo</span></tt> and it will try
+<tt class="docutils literal"><span class="pre">flask_foo</span></tt> first and if that fails <tt class="docutils literal"><span class="pre">flaskext.foo</span></tt>.</p>
+<p>Flask extensions should urge users to import from <tt class="docutils literal"><span class="pre">flask.ext.foo</span></tt>
+instead of <tt class="docutils literal"><span class="pre">flask_foo</span></tt> or <tt class="docutils literal"><span class="pre">flaskext_foo</span></tt> so that extensions can
+transition to the new package name without affecting users.</p>
+</div>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="index.html">
+ <img class="logo" src="_static/flask.png" alt="Logo"/>
+</a></p>
+ <h3><a href="index.html">Table Of Contents</a></h3>
+ <ul>
+<li><a class="reference internal" href="#">Flask Extension Development</a><ul>
+<li><a class="reference internal" href="#anatomy-of-an-extension">Anatomy of an Extension</a></li>
+<li><a class="reference internal" href="#hello-flaskext">&#8220;Hello Flaskext!&#8221;</a><ul>
+<li><a class="reference internal" href="#setup-py">setup.py</a></li>
+<li><a class="reference internal" href="#flask-sqlite3-py">flask_sqlite3.py</a></li>
+</ul>
+</li>
+<li><a class="reference internal" href="#initializing-extensions">Initializing Extensions</a></li>
+<li><a class="reference internal" href="#the-extension-code">The Extension Code</a></li>
+<li><a class="reference internal" href="#adding-an-init-app-function">Adding an <cite>init_app</cite> Function</a></li>
+<li><a class="reference internal" href="#end-of-request-behavior">End-Of-Request Behavior</a></li>
+<li><a class="reference internal" href="#learn-from-others">Learn from Others</a></li>
+<li><a class="reference internal" href="#approved-extensions">Approved Extensions</a></li>
+<li><a class="reference internal" href="#extension-import-transition">Extension Import Transition</a></li>
+</ul>
+</li>
+</ul>
+<h3>Related Topics</h3>
+<ul>
+ <li><a href="index.html">Documentation overview</a><ul>
+ <li>Previous: <a href="unicode.html" title="previous chapter">Unicode in Flask</a></li>
+ <li>Next: <a href="styleguide.html" title="next chapter">Pocoo Styleguide</a></li>
+ </ul></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="_sources/extensiondev.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/extensions.html b/app/static/doc/flask-docs/extensions.html
new file mode 100644
index 0000000..d5ee4a7
--- /dev/null
+++ b/app/static/doc/flask-docs/extensions.html
@@ -0,0 +1,153 @@
+
+<!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>Flask Extensions &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="index.html" />
+ <link rel="next" title="Working with the Shell" href="shell.html" />
+ <link rel="prev" title="Modular Applications with Blueprints" href="blueprints.html" />
+
+
+ <link rel="apple-touch-icon" href="_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <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="shell.html" title="Working with the Shell"
+ accesskey="N">next</a> |</li>
+ <li class="right" >
+ <a href="blueprints.html" title="Modular Applications with Blueprints"
+ accesskey="P">previous</a> |</li>
+ <li><a href="index.html">Flask 0.8 documentation</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="flask-extensions">
+<h1>Flask Extensions<a class="headerlink" href="#flask-extensions" title="Permalink to this headline">¶</a></h1>
+<p>Flask extensions extend the functionality of Flask in various different
+ways. For instance they add support for databases and other common tasks.</p>
+<div class="section" id="finding-extensions">
+<h2>Finding Extensions<a class="headerlink" href="#finding-extensions" title="Permalink to this headline">¶</a></h2>
+<p>Flask extensions are listed on the <a class="reference external" href="http://flask.pocoo.org/extensions/">Flask Extension Registry</a> and can be
+downloaded with <tt class="docutils literal"><span class="pre">easy_install</span></tt> or <tt class="docutils literal"><span class="pre">pip</span></tt>. If you add a Flask extension
+as dependency to your <tt class="docutils literal"><span class="pre">requirements.rst</span></tt> or <tt class="docutils literal"><span class="pre">setup.py</span></tt> file they are
+usually installed with a simple command or when your application installs.</p>
+</div>
+<div class="section" id="using-extensions">
+<h2>Using Extensions<a class="headerlink" href="#using-extensions" title="Permalink to this headline">¶</a></h2>
+<p>Extensions typically have documentation that goes along that shows how to
+use it. There are no general rules in how extensions are supposed to
+behave but they are imported from common locations. If you have an
+extension called <tt class="docutils literal"><span class="pre">Flask-Foo</span></tt> or <tt class="docutils literal"><span class="pre">Foo-Flask</span></tt> it will be always
+importable from <tt class="docutils literal"><span class="pre">flask.ext.foo</span></tt>:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">flask.ext</span> <span class="kn">import</span> <span class="n">foo</span>
+</pre></div>
+</div>
+</div>
+<div class="section" id="flask-before-0-8">
+<h2>Flask Before 0.8<a class="headerlink" href="#flask-before-0-8" title="Permalink to this headline">¶</a></h2>
+<p>If you are using Flask 0.7 or earlier the <tt class="xref py py-data docutils literal"><span class="pre">flask.ext</span></tt> package will not
+exist, instead you have to import from <tt class="docutils literal"><span class="pre">flaskext.foo</span></tt> or <tt class="docutils literal"><span class="pre">flask_foo</span></tt>
+depending on how the extension is distributed. If you want to develop an
+application that supports Flask 0.7 or earlier you should still import
+from the <tt class="xref py py-data docutils literal"><span class="pre">flask.ext</span></tt> package. We provide you with a compatibility
+module that provides this package for older versions of Flask. You can
+download it from github: <a class="reference external" href="https://github.com/mitsuhiko/flask/raw/master/scripts/flaskext_compat.py">flaskext_compat.py</a></p>
+<p>And here is how you can use it:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">flaskext_compat</span>
+<span class="n">flaskext_compat</span><span class="o">.</span><span class="n">activate</span><span class="p">()</span>
+
+<span class="kn">from</span> <span class="nn">flask.ext</span> <span class="kn">import</span> <span class="n">foo</span>
+</pre></div>
+</div>
+<p>Once the <tt class="docutils literal"><span class="pre">flaskext_compat</span></tt> module is activated the <tt class="xref py py-data docutils literal"><span class="pre">flask.ext</span></tt> will
+exist and you can start importing from there.</p>
+</div>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="index.html">
+ <img class="logo" src="_static/flask.png" alt="Logo"/>
+</a></p>
+ <h3><a href="index.html">Table Of Contents</a></h3>
+ <ul>
+<li><a class="reference internal" href="#">Flask Extensions</a><ul>
+<li><a class="reference internal" href="#finding-extensions">Finding Extensions</a></li>
+<li><a class="reference internal" href="#using-extensions">Using Extensions</a></li>
+<li><a class="reference internal" href="#flask-before-0-8">Flask Before 0.8</a></li>
+</ul>
+</li>
+</ul>
+<h3>Related Topics</h3>
+<ul>
+ <li><a href="index.html">Documentation overview</a><ul>
+ <li>Previous: <a href="blueprints.html" title="previous chapter">Modular Applications with Blueprints</a></li>
+ <li>Next: <a href="shell.html" title="next chapter">Working with the Shell</a></li>
+ </ul></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="_sources/extensions.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/foreword.html b/app/static/doc/flask-docs/foreword.html
new file mode 100644
index 0000000..8cf1096
--- /dev/null
+++ b/app/static/doc/flask-docs/foreword.html
@@ -0,0 +1,198 @@
+
+<!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>Foreword &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="index.html" />
+ <link rel="next" title="Installation" href="installation.html" />
+ <link rel="prev" title="Welcome to Flask" href="index.html" />
+
+
+ <link rel="apple-touch-icon" href="_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <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="installation.html" title="Installation"
+ accesskey="N">next</a> |</li>
+ <li class="right" >
+ <a href="index.html" title="Welcome to Flask"
+ accesskey="P">previous</a> |</li>
+ <li><a href="index.html">Flask 0.8 documentation</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="foreword">
+<h1>Foreword<a class="headerlink" href="#foreword" title="Permalink to this headline">¶</a></h1>
+<p>Read this before you get started with Flask. This hopefully answers some
+questions about the purpose and goals of the project, and when you
+should or should not be using it.</p>
+<div class="section" id="what-does-micro-mean">
+<h2>What does &#8220;micro&#8221; mean?<a class="headerlink" href="#what-does-micro-mean" title="Permalink to this headline">¶</a></h2>
+<p>To me, the &#8220;micro&#8221; in microframework refers not only to the simplicity and
+small size of the framework, but also the fact that it does not make much
+decisions for you. While Flask does pick a templating engine for you, we
+won&#8217;t make such decisions for your datastore or other parts.</p>
+<p>For us however the term “micro” does not mean that the whole implementation
+has to fit into a single Python file.</p>
+<p>One of the design decisions with Flask was that simple tasks should be
+simple and not take up a lot of code and yet not limit yourself. Because
+of that we took a few design choices that some people might find
+surprising or unorthodox. For example, Flask uses thread-local objects
+internally so that you don&#8217;t have to pass objects around from function to
+function within a request in order to stay threadsafe. While this is a
+really easy approach and saves you a lot of time, it might also cause some
+troubles for very large applications because changes on these thread-local
+objects can happen anywhere in the same thread. In order to solve these
+problems we don&#8217;t hide the thread locals for you but instead embrace them
+and provide you with a lot of tools to make it as pleasant as possible to
+work with them.</p>
+<p>Flask is also based on convention over configuration, which means that
+many things are preconfigured. For example, by convention, templates and
+static files are in subdirectories within the Python source tree of the
+application. While this can be changed you usually don&#8217;t have to.</p>
+<p>The main reason however why Flask is called a &#8220;microframework&#8221; is the idea
+to keep the core simple but extensible. There is no database abstraction
+layer, no form validation or anything else where different libraries
+already exist that can handle that. However Flask knows the concept of
+extensions that can add this functionality into your application as if it
+was implemented in Flask itself. There are currently extensions for
+object relational mappers, form validation, upload handling, various open
+authentication technologies and more.</p>
+<p>Since Flask is based on a very solid foundation there is not a lot of code
+in Flask itself. As such it&#8217;s easy to adapt even for lage applications
+and we are making sure that you can either configure it as much as
+possible by subclassing things or by forking the entire codebase. If you
+are interested in that, check out the <a class="reference internal" href="becomingbig.html#becomingbig"><em>Becoming Big</em></a> chapter.</p>
+<p>If you are curious about the Flask design principles, head over to the
+section about <a class="reference internal" href="design.html#design"><em>Design Decisions in Flask</em></a>.</p>
+</div>
+<div class="section" id="web-development-is-dangerous">
+<h2>Web Development is Dangerous<a class="headerlink" href="#web-development-is-dangerous" title="Permalink to this headline">¶</a></h2>
+<p>I&#8217;m not joking. Well, maybe a little. If you write a web
+application, you are probably allowing users to register and leave their
+data on your server. The users are entrusting you with data. And even if
+you are the only user that might leave data in your application, you still
+want that data to be stored securely.</p>
+<p>Unfortunately, there are many ways the security of a web application can be
+compromised. Flask protects you against one of the most common security
+problems of modern web applications: cross-site scripting (XSS). Unless
+you deliberately mark insecure HTML as secure, Flask and the underlying
+Jinja2 template engine have you covered. But there are many more ways to
+cause security problems.</p>
+<p>The documentation will warn you about aspects of web development that
+require attention to security. Some of these security concerns
+are far more complex than one might think, and we all sometimes underestimate
+the likelihood that a vulnerability will be exploited, until a clever
+attacker figures out a way to exploit our applications. And don&#8217;t think
+that your application is not important enough to attract an attacker.
+Depending on the kind of attack, chances are that automated bots are
+probing for ways to fill your database with spam, links to malicious
+software, and the like.</p>
+<p>So always keep security in mind when doing web development.</p>
+</div>
+<div class="section" id="the-status-of-python-3">
+<h2>The Status of Python 3<a class="headerlink" href="#the-status-of-python-3" title="Permalink to this headline">¶</a></h2>
+<p>Currently the Python community is in the process of improving libraries to
+support the new iteration of the Python programming language. While the
+situation is greatly improving there are still some issues that make it
+hard for us to switch over to Python 3 just now. These problems are
+partially caused by changes in the language that went unreviewed for too
+long, partially also because we have not quite worked out how the lower
+level API should change for the unicode differences in Python3.</p>
+<p>Werkzeug and Flask will be ported to Python 3 as soon as a solution for
+the changes is found, and we will provide helpful tips how to upgrade
+existing applications to Python 3. Until then, we strongly recommend
+using Python 2.6 and 2.7 with activated Python 3 warnings during
+development. If you plan on upgrading to Python 3 in the near future we
+strongly recommend that you read <a class="reference external" href="http://lucumr.pocoo.org/2011/1/22/forwards-compatible-python/">How to write forwards compatible
+Python code</a>.</p>
+</div>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="index.html">
+ <img class="logo" src="_static/flask.png" alt="Logo"/>
+</a></p>
+ <h3><a href="index.html">Table Of Contents</a></h3>
+ <ul>
+<li><a class="reference internal" href="#">Foreword</a><ul>
+<li><a class="reference internal" href="#what-does-micro-mean">What does &#8220;micro&#8221; mean?</a></li>
+<li><a class="reference internal" href="#web-development-is-dangerous">Web Development is Dangerous</a></li>
+<li><a class="reference internal" href="#the-status-of-python-3">The Status of Python 3</a></li>
+</ul>
+</li>
+</ul>
+<h3>Related Topics</h3>
+<ul>
+ <li><a href="index.html">Documentation overview</a><ul>
+ <li>Previous: <a href="index.html" title="previous chapter">Welcome to Flask</a></li>
+ <li>Next: <a href="installation.html" title="next chapter">Installation</a></li>
+ </ul></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="_sources/foreword.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/genindex.html b/app/static/doc/flask-docs/genindex.html
new file mode 100644
index 0000000..6ce9a91
--- /dev/null
+++ b/app/static/doc/flask-docs/genindex.html
@@ -0,0 +1,1287 @@
+
+
+
+<!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>Index &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="index.html" />
+
+
+ <link rel="apple-touch-icon" href="_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <h3>Navigation</h3>
+ <ul>
+ <li class="right" style="margin-right: 10px">
+ <a href="#" title="General Index"
+ accesskey="I">index</a></li>
+ <li><a href="index.html">Flask 0.8 documentation</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+
+<h1 id="index">Index</h1>
+
+<div class="genindex-jumpbox">
+ <a href="#_"><strong>_</strong></a>
+ | <a href="#A"><strong>A</strong></a>
+ | <a href="#B"><strong>B</strong></a>
+ | <a href="#C"><strong>C</strong></a>
+ | <a href="#D"><strong>D</strong></a>
+ | <a href="#E"><strong>E</strong></a>
+ | <a href="#F"><strong>F</strong></a>
+ | <a href="#G"><strong>G</strong></a>
+ | <a href="#H"><strong>H</strong></a>
+ | <a href="#I"><strong>I</strong></a>
+ | <a href="#J"><strong>J</strong></a>
+ | <a href="#L"><strong>L</strong></a>
+ | <a href="#M"><strong>M</strong></a>
+ | <a href="#N"><strong>N</strong></a>
+ | <a href="#O"><strong>O</strong></a>
+ | <a href="#P"><strong>P</strong></a>
+ | <a href="#R"><strong>R</strong></a>
+ | <a href="#S"><strong>S</strong></a>
+ | <a href="#T"><strong>T</strong></a>
+ | <a href="#U"><strong>U</strong></a>
+ | <a href="#V"><strong>V</strong></a>
+ | <a href="#W"><strong>W</strong></a>
+ | <a href="#Y"><strong>Y</strong></a>
+
+</div>
+<h2 id="_">_</h2>
+<table style="width: 100%" class="indextable genindextable"><tr>
+ <td style="width: 33%" valign="top"><dl>
+
+ <dt><a href="api.html#flask._request_ctx_stack">_request_ctx_stack (in module flask)</a>
+ </dt>
+
+ </dl></td>
+</tr></table>
+
+<h2 id="A">A</h2>
+<table style="width: 100%" class="indextable genindextable"><tr>
+ <td style="width: 33%" valign="top"><dl>
+
+ <dt><a href="api.html#flask.abort">abort() (in module flask)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Blueprint.add_url_rule">add_url_rule() (flask.Blueprint method)</a>
+ </dt>
+
+ <dd><dl>
+
+ <dt><a href="api.html#flask.Flask.add_url_rule">(flask.Flask method)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.blueprints.BlueprintSetupState.add_url_rule">(flask.blueprints.BlueprintSetupState method)</a>
+ </dt>
+
+ </dl></dd>
+
+ <dt><a href="api.html#flask.Blueprint.after_app_request">after_app_request() (flask.Blueprint method)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Blueprint.after_request">after_request() (flask.Blueprint method)</a>
+ </dt>
+
+ <dd><dl>
+
+ <dt><a href="api.html#flask.Flask.after_request">(flask.Flask method)</a>
+ </dt>
+
+ </dl></dd>
+
+ <dt><a href="api.html#flask.Flask.after_request_funcs">after_request_funcs (flask.Flask attribute)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.blueprints.BlueprintSetupState.app">app (flask.blueprints.BlueprintSetupState attribute)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Blueprint.app_context_processor">app_context_processor() (flask.Blueprint method)</a>
+ </dt>
+
+ </dl></td>
+ <td style="width: 33%" valign="top"><dl>
+
+ <dt><a href="api.html#flask.Blueprint.app_errorhandler">app_errorhandler() (flask.Blueprint method)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Blueprint.app_url_defaults">app_url_defaults() (flask.Blueprint method)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Blueprint.app_url_value_preprocessor">app_url_value_preprocessor() (flask.Blueprint method)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Request.args">args (flask.Request attribute)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.views.View.as_view">as_view() (flask.views.View class method)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Flask.auto_find_instance_path">auto_find_instance_path() (flask.Flask method)</a>
+ </dt>
+
+ </dl></td>
+</tr></table>
+
+<h2 id="B">B</h2>
+<table style="width: 100%" class="indextable genindextable"><tr>
+ <td style="width: 33%" valign="top"><dl>
+
+ <dt><a href="api.html#flask.Request.base_url">base_url (flask.Request attribute)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Blueprint.before_app_first_request">before_app_first_request() (flask.Blueprint method)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Blueprint.before_app_request">before_app_request() (flask.Blueprint method)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Flask.before_first_request">before_first_request() (flask.Flask method)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Flask.before_first_request_funcs">before_first_request_funcs (flask.Flask attribute)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Blueprint.before_request">before_request() (flask.Blueprint method)</a>
+ </dt>
+
+ <dd><dl>
+
+ <dt><a href="api.html#flask.Flask.before_request">(flask.Flask method)</a>
+ </dt>
+
+ </dl></dd>
+ </dl></td>
+ <td style="width: 33%" valign="top"><dl>
+
+ <dt><a href="api.html#flask.Flask.before_request_funcs">before_request_funcs (flask.Flask attribute)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Blueprint">Blueprint (class in flask)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.blueprints.BlueprintSetupState.blueprint">blueprint (flask.blueprints.BlueprintSetupState attribute)</a>
+ </dt>
+
+ <dd><dl>
+
+ <dt><a href="api.html#flask.Request.blueprint">(flask.Request attribute)</a>
+ </dt>
+
+ </dl></dd>
+
+ <dt><a href="api.html#flask.Flask.blueprints">blueprints (flask.Flask attribute)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.blueprints.BlueprintSetupState">BlueprintSetupState (class in flask.blueprints)</a>
+ </dt>
+
+ </dl></td>
+</tr></table>
+
+<h2 id="C">C</h2>
+<table style="width: 100%" class="indextable genindextable"><tr>
+ <td style="width: 33%" valign="top"><dl>
+
+ <dt><a href="api.html#flask.Config">Config (class in flask)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Flask.config">config (flask.Flask attribute)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Blueprint.context_processor">context_processor() (flask.Blueprint method)</a>
+ </dt>
+
+ <dd><dl>
+
+ <dt><a href="api.html#flask.Flask.context_processor">(flask.Flask method)</a>
+ </dt>
+
+ </dl></dd>
+
+ <dt><a href="api.html#flask.Request.cookies">cookies (flask.Request attribute)</a>
+ </dt>
+
+ </dl></td>
+ <td style="width: 33%" valign="top"><dl>
+
+ <dt><a href="api.html#flask.Flask.create_global_jinja_loader">create_global_jinja_loader() (flask.Flask method)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Flask.create_jinja_environment">create_jinja_environment() (flask.Flask method)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Flask.create_url_adapter">create_url_adapter() (flask.Flask method)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.current_app">current_app (in module flask)</a>
+ </dt>
+
+ </dl></td>
+</tr></table>
+
+<h2 id="D">D</h2>
+<table style="width: 100%" class="indextable genindextable"><tr>
+ <td style="width: 33%" valign="top"><dl>
+
+ <dt><a href="api.html#flask.Request.data">data (flask.Request attribute)</a>
+ </dt>
+
+ <dd><dl>
+
+ <dt><a href="api.html#flask.Response.data">(flask.Response attribute)</a>
+ </dt>
+
+ </dl></dd>
+
+ <dt><a href="api.html#flask.Flask.debug">debug (flask.Flask attribute)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Flask.debug_log_format">debug_log_format (flask.Flask attribute)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.views.View.decorators">decorators (flask.views.View attribute)</a>
+ </dt>
+
+ </dl></td>
+ <td style="width: 33%" valign="top"><dl>
+
+ <dt><a href="api.html#flask.Flask.default_config">default_config (flask.Flask attribute)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Flask.dispatch_request">dispatch_request() (flask.Flask method)</a>
+ </dt>
+
+ <dd><dl>
+
+ <dt><a href="api.html#flask.views.View.dispatch_request">(flask.views.View method)</a>
+ </dt>
+
+ </dl></dd>
+
+ <dt><a href="api.html#flask.Flask.do_teardown_request">do_teardown_request() (flask.Flask method)</a>
+ </dt>
+
+ </dl></td>
+</tr></table>
+
+<h2 id="E">E</h2>
+<table style="width: 100%" class="indextable genindextable"><tr>
+ <td style="width: 33%" valign="top"><dl>
+
+ <dt><a href="api.html#flask.Flask.enable_modules">enable_modules (flask.Flask attribute)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Request.endpoint">endpoint (flask.Request attribute)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Blueprint.endpoint">endpoint() (flask.Blueprint method)</a>
+ </dt>
+
+ <dd><dl>
+
+ <dt><a href="api.html#flask.Flask.endpoint">(flask.Flask method)</a>
+ </dt>
+
+ </dl></dd>
+
+ <dt><a href="api.html#flask.Request.environ">environ (flask.Request attribute)</a>
+ </dt>
+
+
+ <dt>
+ environment variable
+ </dt>
+
+ <dd><dl>
+
+ <dt><a href="tutorial/setup.html#index-0">FLASKR_SETTINGS</a>
+ </dt>
+
+
+ <dt><a href="config.html#index-0">YOURAPPLICATION_SETTINGS</a>
+ </dt>
+
+ </dl></dd>
+ </dl></td>
+ <td style="width: 33%" valign="top"><dl>
+
+ <dt><a href="api.html#flask.Flask.error_handler_spec">error_handler_spec (flask.Flask attribute)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Blueprint.errorhandler">errorhandler() (flask.Blueprint method)</a>
+ </dt>
+
+ <dd><dl>
+
+ <dt><a href="api.html#flask.Flask.errorhandler">(flask.Flask method)</a>
+ </dt>
+
+ </dl></dd>
+
+ <dt><a href="api.html#flask.Markup.escape">escape() (flask.Markup class method)</a>
+ </dt>
+
+ <dd><dl>
+
+ <dt><a href="api.html#flask.escape">(in module flask)</a>
+ </dt>
+
+ </dl></dd>
+
+ <dt><a href="api.html#flask.Flask.extensions">extensions (flask.Flask attribute)</a>
+ </dt>
+
+ </dl></td>
+</tr></table>
+
+<h2 id="F">F</h2>
+<table style="width: 100%" class="indextable genindextable"><tr>
+ <td style="width: 33%" valign="top"><dl>
+
+ <dt><a href="api.html#flask.Request.files">files (flask.Request attribute)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.blueprints.BlueprintSetupState.first_registration">first_registration (flask.blueprints.BlueprintSetupState attribute)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.flash">flash() (in module flask)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Flask">Flask (class in flask)</a>
+ </dt>
+
+
+ <dt><a href="api.html#module-flask">flask (module)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.flask.ext">flask.ext (in module flask)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.signals.Namespace">flask.signals.Namespace (built-in class)</a>
+ </dt>
+
+ </dl></td>
+ <td style="width: 33%" valign="top"><dl>
+
+ <dt><a href="api.html#flask.testing.FlaskClient">FlaskClient (class in flask.testing)</a>
+ </dt>
+
+
+ <dt><a href="tutorial/setup.html#index-0">FLASKR_SETTINGS</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Request.form">form (flask.Request attribute)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Config.from_envvar">from_envvar() (flask.Config method)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Config.from_object">from_object() (flask.Config method)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Config.from_pyfile">from_pyfile() (flask.Config method)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Flask.full_dispatch_request">full_dispatch_request() (flask.Flask method)</a>
+ </dt>
+
+ </dl></td>
+</tr></table>
+
+<h2 id="G">G</h2>
+<table style="width: 100%" class="indextable genindextable"><tr>
+ <td style="width: 33%" valign="top"><dl>
+
+ <dt><a href="api.html#flask.g">g (in module flask)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.sessions.SessionInterface.get_cookie_domain">get_cookie_domain() (flask.sessions.SessionInterface method)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.sessions.SessionInterface.get_cookie_httponly">get_cookie_httponly() (flask.sessions.SessionInterface method)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.sessions.SessionInterface.get_cookie_path">get_cookie_path() (flask.sessions.SessionInterface method)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.sessions.SessionInterface.get_cookie_secure">get_cookie_secure() (flask.sessions.SessionInterface method)</a>
+ </dt>
+
+ </dl></td>
+ <td style="width: 33%" valign="top"><dl>
+
+ <dt><a href="api.html#flask.sessions.SessionInterface.get_expiration_time">get_expiration_time() (flask.sessions.SessionInterface method)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.get_flashed_messages">get_flashed_messages() (in module flask)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.get_template_attribute">get_template_attribute() (in module flask)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Flask.got_first_request">got_first_request (flask.Flask attribute)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.got_request_exception">got_request_exception (in module flask)</a>
+ </dt>
+
+ </dl></td>
+</tr></table>
+
+<h2 id="H">H</h2>
+<table style="width: 100%" class="indextable genindextable"><tr>
+ <td style="width: 33%" valign="top"><dl>
+
+ <dt><a href="api.html#flask.Flask.handle_exception">handle_exception() (flask.Flask method)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Flask.handle_http_exception">handle_http_exception() (flask.Flask method)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Flask.handle_user_exception">handle_user_exception() (flask.Flask method)</a>
+ </dt>
+
+ </dl></td>
+ <td style="width: 33%" valign="top"><dl>
+
+ <dt><a href="api.html#flask.has_request_context">has_request_context() (in module flask)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Blueprint.has_static_folder">has_static_folder (flask.Blueprint attribute)</a>
+ </dt>
+
+ <dd><dl>
+
+ <dt><a href="api.html#flask.Flask.has_static_folder">(flask.Flask attribute)</a>
+ </dt>
+
+ </dl></dd>
+
+ <dt><a href="api.html#flask.Request.headers">headers (flask.Request attribute)</a>
+ </dt>
+
+ <dd><dl>
+
+ <dt><a href="api.html#flask.Response.headers">(flask.Response attribute)</a>
+ </dt>
+
+ </dl></dd>
+ </dl></td>
+</tr></table>
+
+<h2 id="I">I</h2>
+<table style="width: 100%" class="indextable genindextable"><tr>
+ <td style="width: 33%" valign="top"><dl>
+
+ <dt><a href="api.html#flask.Flask.init_jinja_globals">init_jinja_globals() (flask.Flask method)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Flask.inject_url_defaults">inject_url_defaults() (flask.Flask method)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Flask.instance_path">instance_path (flask.Flask attribute)</a>
+ </dt>
+
+ </dl></td>
+ <td style="width: 33%" valign="top"><dl>
+
+ <dt><a href="api.html#flask.sessions.SessionInterface.is_null_session">is_null_session() (flask.sessions.SessionInterface method)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Request.is_xhr">is_xhr (flask.Request attribute)</a>
+ </dt>
+
+ </dl></td>
+</tr></table>
+
+<h2 id="J">J</h2>
+<table style="width: 100%" class="indextable genindextable"><tr>
+ <td style="width: 33%" valign="top"><dl>
+
+ <dt><a href="api.html#flask.Flask.jinja_env">jinja_env (flask.Flask attribute)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Blueprint.jinja_loader">jinja_loader (flask.Blueprint attribute)</a>
+ </dt>
+
+ <dd><dl>
+
+ <dt><a href="api.html#flask.Flask.jinja_loader">(flask.Flask attribute)</a>
+ </dt>
+
+ </dl></dd>
+
+ <dt><a href="api.html#flask.Flask.jinja_options">jinja_options (flask.Flask attribute)</a>
+ </dt>
+
+ </dl></td>
+ <td style="width: 33%" valign="top"><dl>
+
+ <dt><a href="api.html#flask.Request.json">json (flask.Request attribute)</a>
+ </dt>
+
+ <dd><dl>
+
+ <dt><a href="api.html#flask.json">(in module flask)</a>
+ </dt>
+
+ </dl></dd>
+
+ <dt><a href="api.html#flask.jsonify">jsonify() (in module flask)</a>
+ </dt>
+
+ </dl></td>
+</tr></table>
+
+<h2 id="L">L</h2>
+<table style="width: 100%" class="indextable genindextable"><tr>
+ <td style="width: 33%" valign="top"><dl>
+
+ <dt><a href="api.html#flask.Flask.log_exception">log_exception() (flask.Flask method)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Flask.logger">logger (flask.Flask attribute)</a>
+ </dt>
+
+ </dl></td>
+ <td style="width: 33%" valign="top"><dl>
+
+ <dt><a href="api.html#flask.Flask.logger_name">logger_name (flask.Flask attribute)</a>
+ </dt>
+
+ </dl></td>
+</tr></table>
+
+<h2 id="M">M</h2>
+<table style="width: 100%" class="indextable genindextable"><tr>
+ <td style="width: 33%" valign="top"><dl>
+
+ <dt><a href="api.html#flask.Flask.make_config">make_config() (flask.Flask method)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Flask.make_default_options_response">make_default_options_response() (flask.Flask method)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Flask.make_null_session">make_null_session() (flask.Flask method)</a>
+ </dt>
+
+ <dd><dl>
+
+ <dt><a href="api.html#flask.sessions.SessionInterface.make_null_session">(flask.sessions.SessionInterface method)</a>
+ </dt>
+
+ </dl></dd>
+
+ <dt><a href="api.html#flask.Flask.make_response">make_response() (flask.Flask method)</a>
+ </dt>
+
+ <dd><dl>
+
+ <dt><a href="api.html#flask.make_response">(in module flask)</a>
+ </dt>
+
+ </dl></dd>
+
+ <dt><a href="api.html#flask.Blueprint.make_setup_state">make_setup_state() (flask.Blueprint method)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Markup">Markup (class in flask)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.ctx.RequestContext.match_request">match_request() (flask.ctx.RequestContext method)</a>
+ </dt>
+
+ </dl></td>
+ <td style="width: 33%" valign="top"><dl>
+
+ <dt><a href="api.html#flask.Request.max_content_length">max_content_length (flask.Request attribute)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Request.method">method (flask.Request attribute)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.views.View.methods">methods (flask.views.View attribute)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.views.MethodView">MethodView (class in flask.views)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Response.mimetype">mimetype (flask.Response attribute)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.session.modified">modified (flask.session attribute)</a>
+ </dt>
+
+ <dd><dl>
+
+ <dt><a href="api.html#flask.sessions.SessionMixin.modified">(flask.sessions.SessionMixin attribute)</a>
+ </dt>
+
+ </dl></dd>
+
+ <dt><a href="api.html#flask.Request.module">module (flask.Request attribute)</a>
+ </dt>
+
+ </dl></td>
+</tr></table>
+
+<h2 id="N">N</h2>
+<table style="width: 100%" class="indextable genindextable"><tr>
+ <td style="width: 33%" valign="top"><dl>
+
+ <dt><a href="api.html#flask.Flask.name">name (flask.Flask attribute)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.session.new">new (flask.session attribute)</a>
+ </dt>
+
+ <dd><dl>
+
+ <dt><a href="api.html#flask.sessions.SessionMixin.new">(flask.sessions.SessionMixin attribute)</a>
+ </dt>
+
+ </dl></dd>
+ </dl></td>
+ <td style="width: 33%" valign="top"><dl>
+
+ <dt><a href="api.html#flask.sessions.SessionInterface.null_session_class">null_session_class (flask.sessions.SessionInterface attribute)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.sessions.NullSession">NullSession (class in flask.sessions)</a>
+ </dt>
+
+ </dl></td>
+</tr></table>
+
+<h2 id="O">O</h2>
+<table style="width: 100%" class="indextable genindextable"><tr>
+ <td style="width: 33%" valign="top"><dl>
+
+ <dt><a href="api.html#flask.Request.on_json_loading_failed">on_json_loading_failed() (flask.Request method)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Flask.open_instance_resource">open_instance_resource() (flask.Flask method)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Blueprint.open_resource">open_resource() (flask.Blueprint method)</a>
+ </dt>
+
+ <dd><dl>
+
+ <dt><a href="api.html#flask.Flask.open_resource">(flask.Flask method)</a>
+ </dt>
+
+ </dl></dd>
+ </dl></td>
+ <td style="width: 33%" valign="top"><dl>
+
+ <dt><a href="api.html#flask.Flask.open_session">open_session() (flask.Flask method)</a>
+ </dt>
+
+ <dd><dl>
+
+ <dt><a href="api.html#flask.sessions.SessionInterface.open_session">(flask.sessions.SessionInterface method)</a>
+ </dt>
+
+ </dl></dd>
+
+ <dt><a href="api.html#flask.blueprints.BlueprintSetupState.options">options (flask.blueprints.BlueprintSetupState attribute)</a>
+ </dt>
+
+ </dl></td>
+</tr></table>
+
+<h2 id="P">P</h2>
+<table style="width: 100%" class="indextable genindextable"><tr>
+ <td style="width: 33%" valign="top"><dl>
+
+ <dt><a href="api.html#flask.Request.path">path (flask.Request attribute)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.session.permanent">permanent (flask.session attribute)</a>
+ </dt>
+
+ <dd><dl>
+
+ <dt><a href="api.html#flask.sessions.SessionMixin.permanent">(flask.sessions.SessionMixin attribute)</a>
+ </dt>
+
+ </dl></dd>
+
+ <dt><a href="api.html#flask.Flask.permanent_session_lifetime">permanent_session_lifetime (flask.Flask attribute)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.ctx.RequestContext.pop">pop() (flask.ctx.RequestContext method)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Flask.preprocess_request">preprocess_request() (flask.Flask method)</a>
+ </dt>
+
+ </dl></td>
+ <td style="width: 33%" valign="top"><dl>
+
+ <dt><a href="api.html#flask.Flask.preserve_context_on_exception">preserve_context_on_exception (flask.Flask attribute)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Flask.process_response">process_response() (flask.Flask method)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Flask.propagate_exceptions">propagate_exceptions (flask.Flask attribute)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.ctx.RequestContext.push">push() (flask.ctx.RequestContext method)</a>
+ </dt>
+
+
+ <dt>
+ Python Enhancement Proposals
+ </dt>
+
+ <dd><dl>
+
+ <dt><a href="styleguide.html#index-0">PEP 8</a>
+ </dt>
+
+ </dl></dd>
+ </dl></td>
+</tr></table>
+
+<h2 id="R">R</h2>
+<table style="width: 100%" class="indextable genindextable"><tr>
+ <td style="width: 33%" valign="top"><dl>
+
+ <dt><a href="api.html#flask.Blueprint.record">record() (flask.Blueprint method)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Blueprint.record_once">record_once() (flask.Blueprint method)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.redirect">redirect() (in module flask)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Blueprint.register">register() (flask.Blueprint method)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Flask.register_blueprint">register_blueprint() (flask.Flask method)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Flask.register_error_handler">register_error_handler() (flask.Flask method)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Flask.register_module">register_module() (flask.Flask method)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.render_template">render_template() (in module flask)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.render_template_string">render_template_string() (in module flask)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.request">request (class in flask)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Request">Request (class in flask)</a>
+ </dt>
+
+ </dl></td>
+ <td style="width: 33%" valign="top"><dl>
+
+ <dt><a href="api.html#flask.Flask.request_class">request_class (flask.Flask attribute)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Flask.request_context">request_context() (flask.Flask method)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.request_finished">request_finished (in module flask)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.request_started">request_started (in module flask)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.request_tearing_down">request_tearing_down (in module flask)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.ctx.RequestContext">RequestContext (class in flask.ctx)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Response">Response (class in flask)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Flask.response_class">response_class (flask.Flask attribute)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Blueprint.route">route() (flask.Blueprint method)</a>
+ </dt>
+
+ <dd><dl>
+
+ <dt><a href="api.html#flask.Flask.route">(flask.Flask method)</a>
+ </dt>
+
+ </dl></dd>
+
+ <dt><a href="api.html#flask.Request.routing_exception">routing_exception (flask.Request attribute)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Flask.run">run() (flask.Flask method)</a>
+ </dt>
+
+ </dl></td>
+</tr></table>
+
+<h2 id="S">S</h2>
+<table style="width: 100%" class="indextable genindextable"><tr>
+ <td style="width: 33%" valign="top"><dl>
+
+ <dt><a href="api.html#flask.safe_join">safe_join() (in module flask)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Flask.save_session">save_session() (flask.Flask method)</a>
+ </dt>
+
+ <dd><dl>
+
+ <dt><a href="api.html#flask.sessions.SessionInterface.save_session">(flask.sessions.SessionInterface method)</a>
+ </dt>
+
+ </dl></dd>
+
+ <dt><a href="api.html#flask.Request.script_root">script_root (flask.Request attribute)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Flask.secret_key">secret_key (flask.Flask attribute)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.sessions.SecureCookieSessionInterface">SecureCookieSessionInterface (class in flask.sessions)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Flask.select_jinja_autoescape">select_jinja_autoescape() (flask.Flask method)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.send_file">send_file() (in module flask)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.send_from_directory">send_from_directory() (in module flask)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Blueprint.send_static_file">send_static_file() (flask.Blueprint method)</a>
+ </dt>
+
+ <dd><dl>
+
+ <dt><a href="api.html#flask.Flask.send_static_file">(flask.Flask method)</a>
+ </dt>
+
+ </dl></dd>
+
+ <dt><a href="api.html#flask.session">session (class in flask)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.sessions.SecureCookieSessionInterface.session_class">session_class (flask.sessions.SecureCookieSessionInterface attribute)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Flask.session_cookie_name">session_cookie_name (flask.Flask attribute)</a>
+ </dt>
+
+ </dl></td>
+ <td style="width: 33%" valign="top"><dl>
+
+ <dt><a href="api.html#flask.Flask.session_interface">session_interface (flask.Flask attribute)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.testing.FlaskClient.session_transaction">session_transaction() (flask.testing.FlaskClient method)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.sessions.SessionInterface">SessionInterface (class in flask.sessions)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.sessions.SessionMixin">SessionMixin (class in flask.sessions)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Response.set_cookie">set_cookie() (flask.Response method)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.signals.Namespace.signal">signal() (flask.signals.Namespace method)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.signals_available">signals_available (in module flask)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Response.status_code">status_code (flask.Response attribute)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Request.stream">stream (flask.Request attribute)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Markup.striptags">striptags() (flask.Markup method)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.blueprints.BlueprintSetupState.subdomain">subdomain (flask.blueprints.BlueprintSetupState attribute)</a>
+ </dt>
+
+ </dl></td>
+</tr></table>
+
+<h2 id="T">T</h2>
+<table style="width: 100%" class="indextable genindextable"><tr>
+ <td style="width: 33%" valign="top"><dl>
+
+ <dt><a href="api.html#flask.Blueprint.teardown_app_request">teardown_app_request() (flask.Blueprint method)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Blueprint.teardown_request">teardown_request() (flask.Blueprint method)</a>
+ </dt>
+
+ <dd><dl>
+
+ <dt><a href="api.html#flask.Flask.teardown_request">(flask.Flask method)</a>
+ </dt>
+
+ </dl></dd>
+
+ <dt><a href="api.html#flask.Flask.teardown_request_funcs">teardown_request_funcs (flask.Flask attribute)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Flask.template_context_processors">template_context_processors (flask.Flask attribute)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Flask.template_filter">template_filter() (flask.Flask method)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.template_rendered">template_rendered (in module flask)</a>
+ </dt>
+
+ </dl></td>
+ <td style="width: 33%" valign="top"><dl>
+
+ <dt><a href="api.html#flask.Flask.test_client">test_client() (flask.Flask method)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Flask.test_client_class">test_client_class (flask.Flask attribute)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Flask.test_request_context">test_request_context() (flask.Flask method)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Flask.testing">testing (flask.Flask attribute)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Flask.trap_http_exception">trap_http_exception() (flask.Flask method)</a>
+ </dt>
+
+ </dl></td>
+</tr></table>
+
+<h2 id="U">U</h2>
+<table style="width: 100%" class="indextable genindextable"><tr>
+ <td style="width: 33%" valign="top"><dl>
+
+ <dt><a href="api.html#flask.Markup.unescape">unescape() (flask.Markup method)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Flask.update_template_context">update_template_context() (flask.Flask method)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Request.url">url (flask.Request attribute)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Flask.url_default_functions">url_default_functions (flask.Flask attribute)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.blueprints.BlueprintSetupState.url_defaults">url_defaults (flask.blueprints.BlueprintSetupState attribute)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Blueprint.url_defaults">url_defaults() (flask.Blueprint method)</a>
+ </dt>
+
+ <dd><dl>
+
+ <dt><a href="api.html#flask.Flask.url_defaults">(flask.Flask method)</a>
+ </dt>
+
+ </dl></dd>
+
+ <dt><a href="api.html#flask.url_for">url_for() (in module flask)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Flask.url_map">url_map (flask.Flask attribute)</a>
+ </dt>
+
+ </dl></td>
+ <td style="width: 33%" valign="top"><dl>
+
+ <dt><a href="api.html#flask.blueprints.BlueprintSetupState.url_prefix">url_prefix (flask.blueprints.BlueprintSetupState attribute)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Request.url_root">url_root (flask.Request attribute)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Request.url_rule">url_rule (flask.Request attribute)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Flask.url_rule_class">url_rule_class (flask.Flask attribute)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Blueprint.url_value_preprocessor">url_value_preprocessor() (flask.Blueprint method)</a>
+ </dt>
+
+ <dd><dl>
+
+ <dt><a href="api.html#flask.Flask.url_value_preprocessor">(flask.Flask method)</a>
+ </dt>
+
+ </dl></dd>
+
+ <dt><a href="api.html#flask.Flask.url_value_preprocessors">url_value_preprocessors (flask.Flask attribute)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Flask.use_x_sendfile">use_x_sendfile (flask.Flask attribute)</a>
+ </dt>
+
+ </dl></td>
+</tr></table>
+
+<h2 id="V">V</h2>
+<table style="width: 100%" class="indextable genindextable"><tr>
+ <td style="width: 33%" valign="top"><dl>
+
+ <dt><a href="api.html#flask.Request.values">values (flask.Request attribute)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.views.View">View (class in flask.views)</a>
+ </dt>
+
+ </dl></td>
+ <td style="width: 33%" valign="top"><dl>
+
+ <dt><a href="api.html#flask.Request.view_args">view_args (flask.Request attribute)</a>
+ </dt>
+
+
+ <dt><a href="api.html#flask.Flask.view_functions">view_functions (flask.Flask attribute)</a>
+ </dt>
+
+ </dl></td>
+</tr></table>
+
+<h2 id="W">W</h2>
+<table style="width: 100%" class="indextable genindextable"><tr>
+ <td style="width: 33%" valign="top"><dl>
+
+ <dt><a href="api.html#flask.Flask.wsgi_app">wsgi_app() (flask.Flask method)</a>
+ </dt>
+
+ </dl></td>
+</tr></table>
+
+<h2 id="Y">Y</h2>
+<table style="width: 100%" class="indextable genindextable"><tr>
+ <td style="width: 33%" valign="top"><dl>
+
+ <dt><a href="config.html#index-0">YOURAPPLICATION_SETTINGS</a>
+ </dt>
+
+ </dl></td>
+</tr></table>
+
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="index.html">
+ <img class="logo" src="_static/flask.png" alt="Logo"/>
+</a></p><h3>Related Topics</h3>
+<ul>
+ <li><a href="index.html">Documentation overview</a><ul>
+ </ul></li>
+</ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/htmlfaq.html b/app/static/doc/flask-docs/htmlfaq.html
new file mode 100644
index 0000000..e018009
--- /dev/null
+++ b/app/static/doc/flask-docs/htmlfaq.html
@@ -0,0 +1,357 @@
+
+<!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>HTML/XHTML FAQ &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="index.html" />
+ <link rel="next" title="Security Considerations" href="security.html" />
+ <link rel="prev" title="Design Decisions in Flask" href="design.html" />
+
+
+ <link rel="apple-touch-icon" href="_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <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="security.html" title="Security Considerations"
+ accesskey="N">next</a> |</li>
+ <li class="right" >
+ <a href="design.html" title="Design Decisions in Flask"
+ accesskey="P">previous</a> |</li>
+ <li><a href="index.html">Flask 0.8 documentation</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="html-xhtml-faq">
+<h1>HTML/XHTML FAQ<a class="headerlink" href="#html-xhtml-faq" title="Permalink to this headline">¶</a></h1>
+<p>The Flask documentation and example applications are using HTML5. You
+may notice that in many situations, when end tags are optional they are
+not used, so that the HTML is cleaner and faster to load. Because there
+is much confusion about HTML and XHTML among developers, this document tries
+to answer some of the major questions.</p>
+<div class="section" id="history-of-xhtml">
+<h2>History of XHTML<a class="headerlink" href="#history-of-xhtml" title="Permalink to this headline">¶</a></h2>
+<p>For a while, it appeared that HTML was about to be replaced by XHTML.
+However, barely any websites on the Internet are actual XHTML (which is
+HTML processed using XML rules). There are a couple of major reasons
+why this is the case. One of them is Internet Explorer&#8217;s lack of proper
+XHTML support. The XHTML spec states that XHTML must be served with the MIME
+type <cite>application/xhtml+xml</cite>, but Internet Explorer refuses to read files
+with that MIME type.
+While it is relatively easy to configure Web servers to serve XHTML properly,
+few people do. This is likely because properly using XHTML can be quite
+painful.</p>
+<p>One of the most important causes of pain is XML&#8217;s draconian (strict and
+ruthless) error handling. When an XML parsing error is encountered,
+the browser is supposed to show the user an ugly error message, instead
+of attempting to recover from the error and display what it can. Most of
+the (X)HTML generation on the web is based on non-XML template engines
+(such as Jinja, the one used in Flask) which do not protect you from
+accidentally creating invalid XHTML. There are XML based template engines,
+such as Kid and the popular Genshi, but they often come with a larger
+runtime overhead and, are not as straightforward to use because they have
+to obey XML rules.</p>
+<p>The majority of users, however, assumed they were properly using XHTML.
+They wrote an XHTML doctype at the top of the document and self-closed all
+the necessary tags (<tt class="docutils literal"><span class="pre">&lt;br&gt;</span></tt> becomes <tt class="docutils literal"><span class="pre">&lt;br/&gt;</span></tt> or <tt class="docutils literal"><span class="pre">&lt;br&gt;&lt;/br&gt;</span></tt> in XHTML).
+However, even if the document properly validates as XHTML, what really
+determines XHTML/HTML processing in browsers is the MIME type, which as
+said before is often not set properly. So the valid XHTML was being treated
+as invalid HTML.</p>
+<p>XHTML also changed the way JavaScript is used. To properly work with XHTML,
+programmers have to use the namespaced DOM interface with the XHTML
+namespace to query for HTML elements.</p>
+</div>
+<div class="section" id="history-of-html5">
+<h2>History of HTML5<a class="headerlink" href="#history-of-html5" title="Permalink to this headline">¶</a></h2>
+<p>Development of the HTML5 specification was started in 2004 under the name
+&#8220;Web Applications 1.0&#8221; by the Web Hypertext Application Technology Working
+Group, or WHATWG (which was formed by the major browser vendors Apple,
+Mozilla, and Opera) with the goal of writing a new and improved HTML
+specification, based on existing browser behaviour instead of unrealistic
+and backwards-incompatible specifications.</p>
+<p>For example, in HTML4 <tt class="docutils literal"><span class="pre">&lt;title/Hello/</span></tt> theoretically parses exactly the
+same as <tt class="docutils literal"><span class="pre">&lt;title&gt;Hello&lt;/title&gt;</span></tt>. However, since people were using
+XHTML-like tags along the lines of <tt class="docutils literal"><span class="pre">&lt;link</span> <span class="pre">/&gt;</span></tt>, browser vendors implemented
+the XHTML syntax over the syntax defined by the specification.</p>
+<p>In 2007, the specification was adopted as the basis of a new HTML
+specification under the umbrella of the W3C, known as HTML5. Currently,
+it appears that XHTML is losing traction, as the XHTML 2 working group has
+been disbanded and HTML5 is being implemented by all major browser vendors.</p>
+</div>
+<div class="section" id="html-versus-xhtml">
+<h2>HTML versus XHTML<a class="headerlink" href="#html-versus-xhtml" title="Permalink to this headline">¶</a></h2>
+<p>The following table gives you a quick overview of features available in
+HTML 4.01, XHTML 1.1 and HTML5. (XHTML 1.0 is not included, as it was
+superseded by XHTML 1.1 and the barely-used XHTML5.)</p>
+<table border="1" class="docutils">
+<colgroup>
+<col width="58%" />
+<col width="14%" />
+<col width="14%" />
+<col width="14%" />
+</colgroup>
+<thead valign="bottom">
+<tr class="row-odd"><th class="head">&nbsp;</th>
+<th class="head">HTML4.01</th>
+<th class="head">XHTML1.1</th>
+<th class="head">HTML5</th>
+</tr>
+</thead>
+<tbody valign="top">
+<tr class="row-even"><td><tt class="docutils literal"><span class="pre">&lt;tag/value/</span></tt> == <tt class="docutils literal"><span class="pre">&lt;tag&gt;value&lt;/tag&gt;</span></tt></td>
+<td><img alt="Yes" src="_images/yes.png" /> <a class="footnote-reference" href="#id4" id="id1">[1]</a></td>
+<td><img alt="No" src="_images/no.png" /></td>
+<td><img alt="No" src="_images/no.png" /></td>
+</tr>
+<tr class="row-odd"><td><tt class="docutils literal"><span class="pre">&lt;br/&gt;</span></tt> supported</td>
+<td><img alt="No" src="_images/no.png" /></td>
+<td><img alt="Yes" src="_images/yes.png" /></td>
+<td><img alt="Yes" src="_images/yes.png" /> <a class="footnote-reference" href="#id5" id="id2">[2]</a></td>
+</tr>
+<tr class="row-even"><td><tt class="docutils literal"><span class="pre">&lt;script/&gt;</span></tt> supported</td>
+<td><img alt="No" src="_images/no.png" /></td>
+<td><img alt="Yes" src="_images/yes.png" /></td>
+<td><img alt="No" src="_images/no.png" /></td>
+</tr>
+<tr class="row-odd"><td>should be served as <cite>text/html</cite></td>
+<td><img alt="Yes" src="_images/yes.png" /></td>
+<td><img alt="No" src="_images/no.png" /> <a class="footnote-reference" href="#id6" id="id3">[3]</a></td>
+<td><img alt="Yes" src="_images/yes.png" /></td>
+</tr>
+<tr class="row-even"><td>should be served as
+<cite>application/xhtml+xml</cite></td>
+<td><img alt="No" src="_images/no.png" /></td>
+<td><img alt="Yes" src="_images/yes.png" /></td>
+<td><img alt="No" src="_images/no.png" /></td>
+</tr>
+<tr class="row-odd"><td>strict error handling</td>
+<td><img alt="No" src="_images/no.png" /></td>
+<td><img alt="Yes" src="_images/yes.png" /></td>
+<td><img alt="No" src="_images/no.png" /></td>
+</tr>
+<tr class="row-even"><td>inline SVG</td>
+<td><img alt="No" src="_images/no.png" /></td>
+<td><img alt="Yes" src="_images/yes.png" /></td>
+<td><img alt="Yes" src="_images/yes.png" /></td>
+</tr>
+<tr class="row-odd"><td>inline MathML</td>
+<td><img alt="No" src="_images/no.png" /></td>
+<td><img alt="Yes" src="_images/yes.png" /></td>
+<td><img alt="Yes" src="_images/yes.png" /></td>
+</tr>
+<tr class="row-even"><td><tt class="docutils literal"><span class="pre">&lt;video&gt;</span></tt> tag</td>
+<td><img alt="No" src="_images/no.png" /></td>
+<td><img alt="No" src="_images/no.png" /></td>
+<td><img alt="Yes" src="_images/yes.png" /></td>
+</tr>
+<tr class="row-odd"><td><tt class="docutils literal"><span class="pre">&lt;audio&gt;</span></tt> tag</td>
+<td><img alt="No" src="_images/no.png" /></td>
+<td><img alt="No" src="_images/no.png" /></td>
+<td><img alt="Yes" src="_images/yes.png" /></td>
+</tr>
+<tr class="row-even"><td>New semantic tags like <tt class="docutils literal"><span class="pre">&lt;article&gt;</span></tt></td>
+<td><img alt="No" src="_images/no.png" /></td>
+<td><img alt="No" src="_images/no.png" /></td>
+<td><img alt="Yes" src="_images/yes.png" /></td>
+</tr>
+</tbody>
+</table>
+<table class="docutils footnote" frame="void" id="id4" rules="none">
+<colgroup><col class="label" /><col /></colgroup>
+<tbody valign="top">
+<tr><td class="label"><a class="fn-backref" href="#id1">[1]</a></td><td>This is an obscure feature inherited from SGML. It is usually not
+supported by browsers, for reasons detailed above.</td></tr>
+</tbody>
+</table>
+<table class="docutils footnote" frame="void" id="id5" rules="none">
+<colgroup><col class="label" /><col /></colgroup>
+<tbody valign="top">
+<tr><td class="label"><a class="fn-backref" href="#id2">[2]</a></td><td>This is for compatibility with server code that generates XHTML for
+tags such as <tt class="docutils literal"><span class="pre">&lt;br&gt;</span></tt>. It should not be used in new code.</td></tr>
+</tbody>
+</table>
+<table class="docutils footnote" frame="void" id="id6" rules="none">
+<colgroup><col class="label" /><col /></colgroup>
+<tbody valign="top">
+<tr><td class="label"><a class="fn-backref" href="#id3">[3]</a></td><td>XHTML 1.0 is the last XHTML standard that allows to be served
+as <cite>text/html</cite> for backwards compatibility reasons.</td></tr>
+</tbody>
+</table>
+</div>
+<div class="section" id="what-does-strict-mean">
+<h2>What does &#8220;strict&#8221; mean?<a class="headerlink" href="#what-does-strict-mean" title="Permalink to this headline">¶</a></h2>
+<p>HTML5 has strictly defined parsing rules, but it also specifies exactly
+how a browser should react to parsing errors - unlike XHTML, which simply
+states parsing should abort. Some people are confused by apparently
+invalid syntax that still generates the expected results (for example,
+missing end tags or unquoted attribute values).</p>
+<p>Some of these work because of the lenient error handling most browsers use
+when they encounter a markup error, others are actually specified. The
+following constructs are optional in HTML5 by standard, but have to be
+supported by browsers:</p>
+<ul class="simple">
+<li>Wrapping the document in an <tt class="docutils literal"><span class="pre">&lt;html&gt;</span></tt> tag</li>
+<li>Wrapping header elements in <tt class="docutils literal"><span class="pre">&lt;head&gt;</span></tt> or the body elements in
+<tt class="docutils literal"><span class="pre">&lt;body&gt;</span></tt></li>
+<li>Closing the <tt class="docutils literal"><span class="pre">&lt;p&gt;</span></tt>, <tt class="docutils literal"><span class="pre">&lt;li&gt;</span></tt>, <tt class="docutils literal"><span class="pre">&lt;dt&gt;</span></tt>, <tt class="docutils literal"><span class="pre">&lt;dd&gt;</span></tt>, <tt class="docutils literal"><span class="pre">&lt;tr&gt;</span></tt>,
+<tt class="docutils literal"><span class="pre">&lt;td&gt;</span></tt>, <tt class="docutils literal"><span class="pre">&lt;th&gt;</span></tt>, <tt class="docutils literal"><span class="pre">&lt;tbody&gt;</span></tt>, <tt class="docutils literal"><span class="pre">&lt;thead&gt;</span></tt>, or <tt class="docutils literal"><span class="pre">&lt;tfoot&gt;</span></tt> tags.</li>
+<li>Quoting attributes, so long as they contain no whitespace or
+special characters (like <tt class="docutils literal"><span class="pre">&lt;</span></tt>, <tt class="docutils literal"><span class="pre">&gt;</span></tt>, <tt class="docutils literal"><span class="pre">'</span></tt>, or <tt class="docutils literal"><span class="pre">&quot;</span></tt>).</li>
+<li>Requiring boolean attributes to have a value.</li>
+</ul>
+<p>This means the following page in HTML5 is perfectly valid:</p>
+<div class="highlight-html"><div class="highlight"><pre><span class="cp">&lt;!doctype html&gt;</span>
+<span class="nt">&lt;title&gt;</span>Hello HTML5<span class="nt">&lt;/title&gt;</span>
+<span class="nt">&lt;div</span> <span class="na">class=</span><span class="s">header</span><span class="nt">&gt;</span>
+ <span class="nt">&lt;h1&gt;</span>Hello HTML5<span class="nt">&lt;/h1&gt;</span>
+ <span class="nt">&lt;p</span> <span class="na">class=</span><span class="s">tagline</span><span class="nt">&gt;</span>HTML5 is awesome
+<span class="nt">&lt;/div&gt;</span>
+<span class="nt">&lt;ul</span> <span class="na">class=</span><span class="s">nav</span><span class="nt">&gt;</span>
+ <span class="nt">&lt;li&gt;&lt;a</span> <span class="na">href=</span><span class="s">/index</span><span class="nt">&gt;</span>Index<span class="nt">&lt;/a&gt;</span>
+ <span class="nt">&lt;li&gt;&lt;a</span> <span class="na">href=</span><span class="s">/downloads</span><span class="nt">&gt;</span>Downloads<span class="nt">&lt;/a&gt;</span>
+ <span class="nt">&lt;li&gt;&lt;a</span> <span class="na">href=</span><span class="s">/about</span><span class="nt">&gt;</span>About<span class="nt">&lt;/a&gt;</span>
+<span class="nt">&lt;/ul&gt;</span>
+<span class="nt">&lt;div</span> <span class="na">class=</span><span class="s">body</span><span class="nt">&gt;</span>
+ <span class="nt">&lt;h2&gt;</span>HTML5 is probably the future<span class="nt">&lt;/h2&gt;</span>
+ <span class="nt">&lt;p&gt;</span>
+ There might be some other things around but in terms of
+ browser vendor support, HTML5 is hard to beat.
+ <span class="nt">&lt;dl&gt;</span>
+ <span class="nt">&lt;dt&gt;</span>Key 1
+ <span class="nt">&lt;dd&gt;</span>Value 1
+ <span class="nt">&lt;dt&gt;</span>Key 2
+ <span class="nt">&lt;dd&gt;</span>Value 2
+ <span class="nt">&lt;/dl&gt;</span>
+<span class="nt">&lt;/div&gt;</span>
+</pre></div>
+</div>
+</div>
+<div class="section" id="new-technologies-in-html5">
+<h2>New technologies in HTML5<a class="headerlink" href="#new-technologies-in-html5" title="Permalink to this headline">¶</a></h2>
+<p>HTML5 adds many new features that make Web applications easier to write
+and to use.</p>
+<ul class="simple">
+<li>The <tt class="docutils literal"><span class="pre">&lt;audio&gt;</span></tt> and <tt class="docutils literal"><span class="pre">&lt;video&gt;</span></tt> tags provide a way to embed audio and
+video without complicated add-ons like QuickTime or Flash.</li>
+<li>Semantic elements like <tt class="docutils literal"><span class="pre">&lt;article&gt;</span></tt>, <tt class="docutils literal"><span class="pre">&lt;header&gt;</span></tt>, <tt class="docutils literal"><span class="pre">&lt;nav&gt;</span></tt>, and
+<tt class="docutils literal"><span class="pre">&lt;time&gt;</span></tt> that make content easier to understand.</li>
+<li>The <tt class="docutils literal"><span class="pre">&lt;canvas&gt;</span></tt> tag, which supports a powerful drawing API, reducing
+the need for server-generated images to present data graphically.</li>
+<li>New form control types like <tt class="docutils literal"><span class="pre">&lt;input</span> <span class="pre">type=&quot;date&quot;&gt;</span></tt> that allow user
+agents to make entering and validating values easier.</li>
+<li>Advanced JavaScript APIs like Web Storage, Web Workers, Web Sockets,
+geolocation, and offline applications.</li>
+</ul>
+<p>Many other features have been added, as well. A good guide to new features
+in HTML5 is Mark Pilgrim&#8217;s soon-to-be-published book, <a class="reference external" href="http://www.diveintohtml5.org/">Dive Into HTML5</a>.
+Not all of them are supported in browsers yet, however, so use caution.</p>
+</div>
+<div class="section" id="what-should-be-used">
+<h2>What should be used?<a class="headerlink" href="#what-should-be-used" title="Permalink to this headline">¶</a></h2>
+<p>Currently, the answer is HTML5. There are very few reasons to use XHTML
+considering the latest developments in Web browsers. To summarize the
+reasons given above:</p>
+<ul class="simple">
+<li>Internet Explorer (which, sadly, currently leads in market share)
+has poor support for XHTML.</li>
+<li>Many JavaScript libraries also do not support XHTML, due to the more
+complicated namespacing API it requires.</li>
+<li>HTML5 adds several new features, including semantic tags and the
+long-awaited <tt class="docutils literal"><span class="pre">&lt;audio&gt;</span></tt> and <tt class="docutils literal"><span class="pre">&lt;video&gt;</span></tt> tags.</li>
+<li>It has the support of most browser vendors behind it.</li>
+<li>It is much easier to write, and more compact.</li>
+</ul>
+<p>For most applications, it is undoubtedly better to use HTML5 than XHTML.</p>
+</div>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="index.html">
+ <img class="logo" src="_static/flask.png" alt="Logo"/>
+</a></p>
+ <h3><a href="index.html">Table Of Contents</a></h3>
+ <ul>
+<li><a class="reference internal" href="#">HTML/XHTML FAQ</a><ul>
+<li><a class="reference internal" href="#history-of-xhtml">History of XHTML</a></li>
+<li><a class="reference internal" href="#history-of-html5">History of HTML5</a></li>
+<li><a class="reference internal" href="#html-versus-xhtml">HTML versus XHTML</a></li>
+<li><a class="reference internal" href="#what-does-strict-mean">What does &#8220;strict&#8221; mean?</a></li>
+<li><a class="reference internal" href="#new-technologies-in-html5">New technologies in HTML5</a></li>
+<li><a class="reference internal" href="#what-should-be-used">What should be used?</a></li>
+</ul>
+</li>
+</ul>
+<h3>Related Topics</h3>
+<ul>
+ <li><a href="index.html">Documentation overview</a><ul>
+ <li>Previous: <a href="design.html" title="previous chapter">Design Decisions in Flask</a></li>
+ <li>Next: <a href="security.html" title="next chapter">Security Considerations</a></li>
+ </ul></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="_sources/htmlfaq.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/index.html b/app/static/doc/flask-docs/index.html
new file mode 100644
index 0000000..dd464f1
--- /dev/null
+++ b/app/static/doc/flask-docs/index.html
@@ -0,0 +1,426 @@
+
+<!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>Welcome to Flask &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="#" />
+ <link rel="next" title="Foreword" href="foreword.html" />
+
+
+ <link rel="apple-touch-icon" href="_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <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="foreword.html" title="Foreword"
+ accesskey="N">next</a> |</li>
+ <li><a href="#">Flask 0.8 documentation</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="welcome-to-flask">
+<h1>Welcome to Flask<a class="headerlink" href="#welcome-to-flask" title="Permalink to this headline">¶</a></h1>
+<img alt="Flask: web development, one drop at a time" class="floatingflask" src="_images/logo-full2.png" />
+<p>Welcome to Flask&#8217;s documentation. This documentation is divided into
+different parts. I recommend that you get started with
+<a class="reference internal" href="installation.html#installation"><em>Installation</em></a> and then head over to the <a class="reference internal" href="quickstart.html#quickstart"><em>Quickstart</em></a>.
+Besides the quickstart there is also a more detailed <a class="reference internal" href="tutorial/index.html#tutorial"><em>Tutorial</em></a> that
+shows how to create a complete (albeit small) application with Flask. If
+you&#8217;d rather dive into the internals of Flask, check out
+the <a class="reference internal" href="api.html#api"><em>API</em></a> documentation. Common patterns are described in the
+<a class="reference internal" href="patterns/index.html#patterns"><em>Patterns for Flask</em></a> section.</p>
+<p>Flask depends on two external libraries: the <a class="reference external" href="http://jinja.pocoo.org/2/">Jinja2</a> template
+engine and the <a class="reference external" href="http://werkzeug.pocoo.org/">Werkzeug</a> WSGI toolkit. These libraries are not documented
+here. If you want to dive into their documentation check out the
+following links:</p>
+<ul class="simple">
+<li><a class="reference external" href="http://jinja.pocoo.org/2/documentation/">Jinja2 Documentation</a></li>
+<li><a class="reference external" href="http://werkzeug.pocoo.org/documentation/">Werkzeug Documentation</a></li>
+</ul>
+<div class="section" id="user-s-guide">
+<h2>User&#8217;s Guide<a class="headerlink" href="#user-s-guide" title="Permalink to this headline">¶</a></h2>
+<p>This part of the documentation, which is mostly prose, begins with some
+background information about Flask, then focuses on step-by-step
+instructions for web development with Flask.</p>
+<div class="toctree-wrapper compound">
+<ul>
+<li class="toctree-l1"><a class="reference internal" href="foreword.html">Foreword</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="foreword.html#what-does-micro-mean">What does &#8220;micro&#8221; mean?</a></li>
+<li class="toctree-l2"><a class="reference internal" href="foreword.html#web-development-is-dangerous">Web Development is Dangerous</a></li>
+<li class="toctree-l2"><a class="reference internal" href="foreword.html#the-status-of-python-3">The Status of Python 3</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="installation.html">Installation</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="installation.html#virtualenv">virtualenv</a></li>
+<li class="toctree-l2"><a class="reference internal" href="installation.html#system-wide-installation">System Wide Installation</a></li>
+<li class="toctree-l2"><a class="reference internal" href="installation.html#living-on-the-edge">Living on the Edge</a></li>
+<li class="toctree-l2"><a class="reference internal" href="installation.html#easy-install-on-windows"><cite>easy_install</cite> on Windows</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="quickstart.html">Quickstart</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="quickstart.html#a-minimal-application">A Minimal Application</a></li>
+<li class="toctree-l2"><a class="reference internal" href="quickstart.html#debug-mode">Debug Mode</a></li>
+<li class="toctree-l2"><a class="reference internal" href="quickstart.html#routing">Routing</a></li>
+<li class="toctree-l2"><a class="reference internal" href="quickstart.html#static-files">Static Files</a></li>
+<li class="toctree-l2"><a class="reference internal" href="quickstart.html#rendering-templates">Rendering Templates</a></li>
+<li class="toctree-l2"><a class="reference internal" href="quickstart.html#accessing-request-data">Accessing Request Data</a></li>
+<li class="toctree-l2"><a class="reference internal" href="quickstart.html#redirects-and-errors">Redirects and Errors</a></li>
+<li class="toctree-l2"><a class="reference internal" href="quickstart.html#about-responses">About Responses</a></li>
+<li class="toctree-l2"><a class="reference internal" href="quickstart.html#sessions">Sessions</a></li>
+<li class="toctree-l2"><a class="reference internal" href="quickstart.html#message-flashing">Message Flashing</a></li>
+<li class="toctree-l2"><a class="reference internal" href="quickstart.html#logging">Logging</a></li>
+<li class="toctree-l2"><a class="reference internal" href="quickstart.html#hooking-in-wsgi-middlewares">Hooking in WSGI Middlewares</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="tutorial/index.html">Tutorial</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="tutorial/introduction.html">Introducing Flaskr</a></li>
+<li class="toctree-l2"><a class="reference internal" href="tutorial/folders.html">Step 0: Creating The Folders</a></li>
+<li class="toctree-l2"><a class="reference internal" href="tutorial/schema.html">Step 1: Database Schema</a></li>
+<li class="toctree-l2"><a class="reference internal" href="tutorial/setup.html">Step 2: Application Setup Code</a></li>
+<li class="toctree-l2"><a class="reference internal" href="tutorial/dbinit.html">Step 3: Creating The Database</a></li>
+<li class="toctree-l2"><a class="reference internal" href="tutorial/dbcon.html">Step 4: Request Database Connections</a></li>
+<li class="toctree-l2"><a class="reference internal" href="tutorial/views.html">Step 5: The View Functions</a></li>
+<li class="toctree-l2"><a class="reference internal" href="tutorial/templates.html">Step 6: The Templates</a></li>
+<li class="toctree-l2"><a class="reference internal" href="tutorial/css.html">Step 7: Adding Style</a></li>
+<li class="toctree-l2"><a class="reference internal" href="tutorial/testing.html">Bonus: Testing the Application</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="templating.html">Templates</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="templating.html#jinja-setup">Jinja Setup</a></li>
+<li class="toctree-l2"><a class="reference internal" href="templating.html#standard-context">Standard Context</a></li>
+<li class="toctree-l2"><a class="reference internal" href="templating.html#standard-filters">Standard Filters</a></li>
+<li class="toctree-l2"><a class="reference internal" href="templating.html#controlling-autoescaping">Controlling Autoescaping</a></li>
+<li class="toctree-l2"><a class="reference internal" href="templating.html#registering-filters">Registering Filters</a></li>
+<li class="toctree-l2"><a class="reference internal" href="templating.html#context-processors">Context Processors</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="testing.html">Testing Flask Applications</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="testing.html#the-application">The Application</a></li>
+<li class="toctree-l2"><a class="reference internal" href="testing.html#the-testing-skeleton">The Testing Skeleton</a></li>
+<li class="toctree-l2"><a class="reference internal" href="testing.html#the-first-test">The First Test</a></li>
+<li class="toctree-l2"><a class="reference internal" href="testing.html#logging-in-and-out">Logging In and Out</a></li>
+<li class="toctree-l2"><a class="reference internal" href="testing.html#test-adding-messages">Test Adding Messages</a></li>
+<li class="toctree-l2"><a class="reference internal" href="testing.html#other-testing-tricks">Other Testing Tricks</a></li>
+<li class="toctree-l2"><a class="reference internal" href="testing.html#keeping-the-context-around">Keeping the Context Around</a></li>
+<li class="toctree-l2"><a class="reference internal" href="testing.html#accessing-and-modifying-sessions">Accessing and Modifying Sessions</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="errorhandling.html">Handling Application Errors</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="errorhandling.html#error-mails">Error Mails</a></li>
+<li class="toctree-l2"><a class="reference internal" href="errorhandling.html#logging-to-a-file">Logging to a File</a></li>
+<li class="toctree-l2"><a class="reference internal" href="errorhandling.html#controlling-the-log-format">Controlling the Log Format</a></li>
+<li class="toctree-l2"><a class="reference internal" href="errorhandling.html#other-libraries">Other Libraries</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="config.html">Configuration Handling</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="config.html#configuration-basics">Configuration Basics</a></li>
+<li class="toctree-l2"><a class="reference internal" href="config.html#builtin-configuration-values">Builtin Configuration Values</a></li>
+<li class="toctree-l2"><a class="reference internal" href="config.html#configuring-from-files">Configuring from Files</a></li>
+<li class="toctree-l2"><a class="reference internal" href="config.html#configuration-best-practices">Configuration Best Practices</a></li>
+<li class="toctree-l2"><a class="reference internal" href="config.html#development-production">Development / Production</a></li>
+<li class="toctree-l2"><a class="reference internal" href="config.html#instance-folders">Instance Folders</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="signals.html">Signals</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="signals.html#subscribing-to-signals">Subscribing to Signals</a></li>
+<li class="toctree-l2"><a class="reference internal" href="signals.html#creating-signals">Creating Signals</a></li>
+<li class="toctree-l2"><a class="reference internal" href="signals.html#sending-signals">Sending Signals</a></li>
+<li class="toctree-l2"><a class="reference internal" href="signals.html#decorator-based-signal-subscriptions">Decorator Based Signal Subscriptions</a></li>
+<li class="toctree-l2"><a class="reference internal" href="signals.html#core-signals">Core Signals</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="views.html">Pluggable Views</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="views.html#basic-principle">Basic Principle</a></li>
+<li class="toctree-l2"><a class="reference internal" href="views.html#method-hints">Method Hints</a></li>
+<li class="toctree-l2"><a class="reference internal" href="views.html#method-based-dispatching">Method Based Dispatching</a></li>
+<li class="toctree-l2"><a class="reference internal" href="views.html#decorating-views">Decorating Views</a></li>
+<li class="toctree-l2"><a class="reference internal" href="views.html#method-views-for-apis">Method Views for APIs</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="reqcontext.html">The Request Context</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="reqcontext.html#diving-into-context-locals">Diving into Context Locals</a></li>
+<li class="toctree-l2"><a class="reference internal" href="reqcontext.html#how-the-context-works">How the Context Works</a></li>
+<li class="toctree-l2"><a class="reference internal" href="reqcontext.html#callbacks-and-errors">Callbacks and Errors</a></li>
+<li class="toctree-l2"><a class="reference internal" href="reqcontext.html#teardown-callbacks">Teardown Callbacks</a></li>
+<li class="toctree-l2"><a class="reference internal" href="reqcontext.html#notes-on-proxies">Notes On Proxies</a></li>
+<li class="toctree-l2"><a class="reference internal" href="reqcontext.html#context-preservation-on-error">Context Preservation on Error</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="blueprints.html">Modular Applications with Blueprints</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="blueprints.html#why-blueprints">Why Blueprints?</a></li>
+<li class="toctree-l2"><a class="reference internal" href="blueprints.html#the-concept-of-blueprints">The Concept of Blueprints</a></li>
+<li class="toctree-l2"><a class="reference internal" href="blueprints.html#my-first-blueprint">My First Blueprint</a></li>
+<li class="toctree-l2"><a class="reference internal" href="blueprints.html#registering-blueprints">Registering Blueprints</a></li>
+<li class="toctree-l2"><a class="reference internal" href="blueprints.html#blueprint-resources">Blueprint Resources</a></li>
+<li class="toctree-l2"><a class="reference internal" href="blueprints.html#building-urls">Building URLs</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="extensions.html">Flask Extensions</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="extensions.html#finding-extensions">Finding Extensions</a></li>
+<li class="toctree-l2"><a class="reference internal" href="extensions.html#using-extensions">Using Extensions</a></li>
+<li class="toctree-l2"><a class="reference internal" href="extensions.html#flask-before-0-8">Flask Before 0.8</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="shell.html">Working with the Shell</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="shell.html#creating-a-request-context">Creating a Request Context</a></li>
+<li class="toctree-l2"><a class="reference internal" href="shell.html#firing-before-after-request">Firing Before/After Request</a></li>
+<li class="toctree-l2"><a class="reference internal" href="shell.html#further-improving-the-shell-experience">Further Improving the Shell Experience</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="patterns/index.html">Patterns for Flask</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="patterns/packages.html">Larger Applications</a></li>
+<li class="toctree-l2"><a class="reference internal" href="patterns/appfactories.html">Application Factories</a></li>
+<li class="toctree-l2"><a class="reference internal" href="patterns/appdispatch.html">Application Dispatching</a></li>
+<li class="toctree-l2"><a class="reference internal" href="patterns/urlprocessors.html">Using URL Processors</a></li>
+<li class="toctree-l2"><a class="reference internal" href="patterns/distribute.html">Deploying with Distribute</a></li>
+<li class="toctree-l2"><a class="reference internal" href="patterns/fabric.html">Deploying with Fabric</a></li>
+<li class="toctree-l2"><a class="reference internal" href="patterns/sqlite3.html">Using SQLite 3 with Flask</a></li>
+<li class="toctree-l2"><a class="reference internal" href="patterns/sqlalchemy.html">SQLAlchemy in Flask</a></li>
+<li class="toctree-l2"><a class="reference internal" href="patterns/fileuploads.html">Uploading Files</a></li>
+<li class="toctree-l2"><a class="reference internal" href="patterns/caching.html">Caching</a></li>
+<li class="toctree-l2"><a class="reference internal" href="patterns/viewdecorators.html">View Decorators</a></li>
+<li class="toctree-l2"><a class="reference internal" href="patterns/wtforms.html">Form Validation with WTForms</a></li>
+<li class="toctree-l2"><a class="reference internal" href="patterns/templateinheritance.html">Template Inheritance</a></li>
+<li class="toctree-l2"><a class="reference internal" href="patterns/flashing.html">Message Flashing</a></li>
+<li class="toctree-l2"><a class="reference internal" href="patterns/jquery.html">AJAX with jQuery</a></li>
+<li class="toctree-l2"><a class="reference internal" href="patterns/errorpages.html">Custom Error Pages</a></li>
+<li class="toctree-l2"><a class="reference internal" href="patterns/lazyloading.html">Lazily Loading Views</a></li>
+<li class="toctree-l2"><a class="reference internal" href="patterns/mongokit.html">MongoKit in Flask</a></li>
+<li class="toctree-l2"><a class="reference internal" href="patterns/favicon.html">Adding a favicon</a></li>
+<li class="toctree-l2"><a class="reference internal" href="patterns/streaming.html">Streaming Contents</a></li>
+<li class="toctree-l2"><a class="reference internal" href="patterns/deferredcallbacks.html">Deferred Request Callbacks</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="deploying/index.html">Deployment Options</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="deploying/mod_wsgi.html">mod_wsgi (Apache)</a></li>
+<li class="toctree-l2"><a class="reference internal" href="deploying/cgi.html">CGI</a></li>
+<li class="toctree-l2"><a class="reference internal" href="deploying/fastcgi.html">FastCGI</a></li>
+<li class="toctree-l2"><a class="reference internal" href="deploying/uwsgi.html">uWSGI</a></li>
+<li class="toctree-l2"><a class="reference internal" href="deploying/others.html">Other Servers</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="becomingbig.html">Becoming Big</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="becomingbig.html#why-consider-forking">Why consider Forking?</a></li>
+<li class="toctree-l2"><a class="reference internal" href="becomingbig.html#scaling-like-a-pro">Scaling like a Pro</a></li>
+<li class="toctree-l2"><a class="reference internal" href="becomingbig.html#dialogue-with-the-community">Dialogue with the Community</a></li>
+</ul>
+</li>
+</ul>
+</div>
+</div>
+<div class="section" id="api-reference">
+<h2>API Reference<a class="headerlink" href="#api-reference" title="Permalink to this headline">¶</a></h2>
+<p>If you are looking for information on a specific function, class or
+method, this part of the documentation is for you.</p>
+<div class="toctree-wrapper compound">
+<ul>
+<li class="toctree-l1"><a class="reference internal" href="api.html">API</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="api.html#application-object">Application Object</a></li>
+<li class="toctree-l2"><a class="reference internal" href="api.html#blueprint-objects">Blueprint Objects</a></li>
+<li class="toctree-l2"><a class="reference internal" href="api.html#incoming-request-data">Incoming Request Data</a></li>
+<li class="toctree-l2"><a class="reference internal" href="api.html#response-objects">Response Objects</a></li>
+<li class="toctree-l2"><a class="reference internal" href="api.html#sessions">Sessions</a></li>
+<li class="toctree-l2"><a class="reference internal" href="api.html#session-interface">Session Interface</a></li>
+<li class="toctree-l2"><a class="reference internal" href="api.html#test-client">Test Client</a></li>
+<li class="toctree-l2"><a class="reference internal" href="api.html#application-globals">Application Globals</a></li>
+<li class="toctree-l2"><a class="reference internal" href="api.html#useful-functions-and-classes">Useful Functions and Classes</a></li>
+<li class="toctree-l2"><a class="reference internal" href="api.html#message-flashing">Message Flashing</a></li>
+<li class="toctree-l2"><a class="reference internal" href="api.html#returning-json">Returning JSON</a></li>
+<li class="toctree-l2"><a class="reference internal" href="api.html#template-rendering">Template Rendering</a></li>
+<li class="toctree-l2"><a class="reference internal" href="api.html#configuration">Configuration</a></li>
+<li class="toctree-l2"><a class="reference internal" href="api.html#extensions">Extensions</a></li>
+<li class="toctree-l2"><a class="reference internal" href="api.html#useful-internals">Useful Internals</a></li>
+<li class="toctree-l2"><a class="reference internal" href="api.html#signals">Signals</a></li>
+<li class="toctree-l2"><a class="reference internal" href="api.html#class-based-views">Class Based Views</a></li>
+<li class="toctree-l2"><a class="reference internal" href="api.html#url-route-registrations">URL Route Registrations</a></li>
+<li class="toctree-l2"><a class="reference internal" href="api.html#view-function-options">View Function Options</a></li>
+</ul>
+</li>
+</ul>
+</div>
+</div>
+<div class="section" id="additional-notes">
+<h2>Additional Notes<a class="headerlink" href="#additional-notes" title="Permalink to this headline">¶</a></h2>
+<p>Design notes, legal information and changelog are here for the interested.</p>
+<div class="toctree-wrapper compound">
+<ul>
+<li class="toctree-l1"><a class="reference internal" href="design.html">Design Decisions in Flask</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="design.html#the-explicit-application-object">The Explicit Application Object</a></li>
+<li class="toctree-l2"><a class="reference internal" href="design.html#the-routing-system">The Routing System</a></li>
+<li class="toctree-l2"><a class="reference internal" href="design.html#one-template-engine">One Template Engine</a></li>
+<li class="toctree-l2"><a class="reference internal" href="design.html#micro-with-dependencies">Micro with Dependencies</a></li>
+<li class="toctree-l2"><a class="reference internal" href="design.html#thread-locals">Thread Locals</a></li>
+<li class="toctree-l2"><a class="reference internal" href="design.html#what-flask-is-what-flask-is-not">What Flask is, What Flask is Not</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="htmlfaq.html">HTML/XHTML FAQ</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="htmlfaq.html#history-of-xhtml">History of XHTML</a></li>
+<li class="toctree-l2"><a class="reference internal" href="htmlfaq.html#history-of-html5">History of HTML5</a></li>
+<li class="toctree-l2"><a class="reference internal" href="htmlfaq.html#html-versus-xhtml">HTML versus XHTML</a></li>
+<li class="toctree-l2"><a class="reference internal" href="htmlfaq.html#what-does-strict-mean">What does &#8220;strict&#8221; mean?</a></li>
+<li class="toctree-l2"><a class="reference internal" href="htmlfaq.html#new-technologies-in-html5">New technologies in HTML5</a></li>
+<li class="toctree-l2"><a class="reference internal" href="htmlfaq.html#what-should-be-used">What should be used?</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="security.html">Security Considerations</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="security.html#cross-site-scripting-xss">Cross-Site Scripting (XSS)</a></li>
+<li class="toctree-l2"><a class="reference internal" href="security.html#cross-site-request-forgery-csrf">Cross-Site Request Forgery (CSRF)</a></li>
+<li class="toctree-l2"><a class="reference internal" href="security.html#json-security">JSON Security</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="unicode.html">Unicode in Flask</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="unicode.html#automatic-conversion">Automatic Conversion</a></li>
+<li class="toctree-l2"><a class="reference internal" href="unicode.html#the-golden-rule">The Golden Rule</a></li>
+<li class="toctree-l2"><a class="reference internal" href="unicode.html#encoding-and-decoding-yourself">Encoding and Decoding Yourself</a></li>
+<li class="toctree-l2"><a class="reference internal" href="unicode.html#configuring-editors">Configuring Editors</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="extensiondev.html">Flask Extension Development</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="extensiondev.html#anatomy-of-an-extension">Anatomy of an Extension</a></li>
+<li class="toctree-l2"><a class="reference internal" href="extensiondev.html#hello-flaskext">&#8220;Hello Flaskext!&#8221;</a></li>
+<li class="toctree-l2"><a class="reference internal" href="extensiondev.html#initializing-extensions">Initializing Extensions</a></li>
+<li class="toctree-l2"><a class="reference internal" href="extensiondev.html#the-extension-code">The Extension Code</a></li>
+<li class="toctree-l2"><a class="reference internal" href="extensiondev.html#adding-an-init-app-function">Adding an <cite>init_app</cite> Function</a></li>
+<li class="toctree-l2"><a class="reference internal" href="extensiondev.html#end-of-request-behavior">End-Of-Request Behavior</a></li>
+<li class="toctree-l2"><a class="reference internal" href="extensiondev.html#learn-from-others">Learn from Others</a></li>
+<li class="toctree-l2"><a class="reference internal" href="extensiondev.html#approved-extensions">Approved Extensions</a></li>
+<li class="toctree-l2"><a class="reference internal" href="extensiondev.html#extension-import-transition">Extension Import Transition</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="styleguide.html">Pocoo Styleguide</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="styleguide.html#general-layout">General Layout</a></li>
+<li class="toctree-l2"><a class="reference internal" href="styleguide.html#expressions-and-statements">Expressions and Statements</a></li>
+<li class="toctree-l2"><a class="reference internal" href="styleguide.html#naming-conventions">Naming Conventions</a></li>
+<li class="toctree-l2"><a class="reference internal" href="styleguide.html#docstrings">Docstrings</a></li>
+<li class="toctree-l2"><a class="reference internal" href="styleguide.html#comments">Comments</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="upgrading.html">Upgrading to Newer Releases</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="upgrading.html#version-0-8">Version 0.8</a></li>
+<li class="toctree-l2"><a class="reference internal" href="upgrading.html#version-0-7">Version 0.7</a></li>
+<li class="toctree-l2"><a class="reference internal" href="upgrading.html#version-0-6">Version 0.6</a></li>
+<li class="toctree-l2"><a class="reference internal" href="upgrading.html#version-0-5">Version 0.5</a></li>
+<li class="toctree-l2"><a class="reference internal" href="upgrading.html#version-0-4">Version 0.4</a></li>
+<li class="toctree-l2"><a class="reference internal" href="upgrading.html#version-0-3">Version 0.3</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="changelog.html">Flask Changelog</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-0-9">Version 0.9</a></li>
+<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-0-8">Version 0.8</a></li>
+<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-0-7-3">Version 0.7.3</a></li>
+<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-0-7-2">Version 0.7.2</a></li>
+<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-0-7-1">Version 0.7.1</a></li>
+<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-0-7">Version 0.7</a></li>
+<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-0-6-1">Version 0.6.1</a></li>
+<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-0-6">Version 0.6</a></li>
+<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-0-5-2">Version 0.5.2</a></li>
+<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-0-5-1">Version 0.5.1</a></li>
+<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-0-5">Version 0.5</a></li>
+<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-0-4">Version 0.4</a></li>
+<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-0-3-1">Version 0.3.1</a></li>
+<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-0-3">Version 0.3</a></li>
+<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-0-2">Version 0.2</a></li>
+<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-0-1">Version 0.1</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="license.html">License</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="license.html#authors">Authors</a></li>
+<li class="toctree-l2"><a class="reference internal" href="license.html#general-license-definitions">General License Definitions</a></li>
+<li class="toctree-l2"><a class="reference internal" href="license.html#flask-license">Flask License</a></li>
+<li class="toctree-l2"><a class="reference internal" href="license.html#flask-artwork-license">Flask Artwork License</a></li>
+</ul>
+</li>
+</ul>
+</div>
+</div>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><h3>About Flask</h3>
+<p>
+ Flask is a micro webdevelopment framework for Python. You are currently
+ looking at the documentation of the development version. Things are
+ not stable yet, but if you have some feedback,
+ <a href="mailto:armin.ronacher@active-4.com">let me know</a>.
+</p>
+<h3>Other Formats</h3>
+<p>
+ You can download the documentation in other formats as well:
+</p>
+<ul>
+ <li><a href="http://flask.pocoo.org/docs/flask-docs.pdf">as PDF</a>
+ <li><a href="http://flask.pocoo.org/docs/flask-docs.zip">as zipped HTML</a>
+</ul>
+<h3>Useful Links</h3>
+<ul>
+ <li><a href="http://flask.pocoo.org/">The Flask Website</a></li>
+ <li><a href="http://pypi.python.org/pypi/Flask">Flask @ PyPI</a></li>
+ <li><a href="http://github.com/mitsuhiko/flask">Flask @ github</a></li>
+ <li><a href="http://github.com/mitsuhiko/flask/issues">Issue Tracker</a></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="_sources/index.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/installation.html b/app/static/doc/flask-docs/installation.html
new file mode 100644
index 0000000..bdb5661
--- /dev/null
+++ b/app/static/doc/flask-docs/installation.html
@@ -0,0 +1,249 @@
+
+<!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>Installation &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="index.html" />
+ <link rel="next" title="Quickstart" href="quickstart.html" />
+ <link rel="prev" title="Foreword" href="foreword.html" />
+
+
+ <link rel="apple-touch-icon" href="_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <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="quickstart.html" title="Quickstart"
+ accesskey="N">next</a> |</li>
+ <li class="right" >
+ <a href="foreword.html" title="Foreword"
+ accesskey="P">previous</a> |</li>
+ <li><a href="index.html">Flask 0.8 documentation</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="installation">
+<span id="id1"></span><h1>Installation<a class="headerlink" href="#installation" title="Permalink to this headline">¶</a></h1>
+<p>Flask depends on two external libraries, <a class="reference external" href="http://werkzeug.pocoo.org/">Werkzeug</a> and <a class="reference external" href="http://jinja.pocoo.org/2/">Jinja2</a>.
+Werkzeug is a toolkit for WSGI, the standard Python interface between web
+applications and a variety of servers for both development and deployment.
+Jinja2 renders templates.</p>
+<p>So how do you get all that on your computer quickly? There are many ways
+which this section will explain, but the most kick-ass method is
+virtualenv, so let&#8217;s look at that first.</p>
+<p>Either way, you will need Python 2.5 or higher to get started, so be sure
+to have an up to date Python 2.x installation. At the time of writing,
+the WSGI specification is not yet finalized for Python 3, so Flask cannot
+support the 3.x series of Python.</p>
+<div class="section" id="virtualenv">
+<span id="id2"></span><h2>virtualenv<a class="headerlink" href="#virtualenv" title="Permalink to this headline">¶</a></h2>
+<p>Virtualenv is probably what you want to use during development, and in
+production too if you have shell access there.</p>
+<p>What problem does virtualenv solve? If you like Python as I do,
+chances are you want to use it for other projects besides Flask-based
+web applications. But the more projects you have, the more likely it is
+that you will be working with different versions of Python itself, or at
+least different versions of Python libraries. Let&#8217;s face it; quite often
+libraries break backwards compatibility, and it&#8217;s unlikely that any serious
+application will have zero dependencies. So what do you do if two or more
+of your projects have conflicting dependencies?</p>
+<p>Virtualenv to the rescue! It basically enables multiple side-by-side
+installations of Python, one for each project. It doesn&#8217;t actually
+install separate copies of Python, but it does provide a clever way
+to keep different project environments isolated.</p>
+<p>So let&#8217;s see how virtualenv works!</p>
+<p>If you are on Mac OS X or Linux, chances are that one of the following two
+commands will work for you:</p>
+<div class="highlight-python"><pre>$ sudo easy_install virtualenv</pre>
+</div>
+<p>or even better:</p>
+<div class="highlight-python"><pre>$ sudo pip install virtualenv</pre>
+</div>
+<p>One of these will probably install virtualenv on your system. Maybe it&#8217;s
+even in your package manager. If you use Ubuntu, try:</p>
+<div class="highlight-python"><pre>$ sudo apt-get install python-virtualenv</pre>
+</div>
+<p>If you are on Windows and don&#8217;t have the <cite>easy_install</cite> command, you must
+install it first. Check the <a class="reference internal" href="#windows-easy-install"><em>easy_install on Windows</em></a> section for more
+information about how to do that. Once you have it installed, run the
+same commands as above, but without the <cite>sudo</cite> prefix.</p>
+<p>Once you have virtualenv installed, just fire up a shell and create
+your own environment. I usually create a project folder and an <cite>env</cite>
+folder within:</p>
+<div class="highlight-python"><pre>$ mkdir myproject
+$ cd myproject
+$ virtualenv env
+New python executable in env/bin/python
+Installing setuptools............done.</pre>
+</div>
+<p>Now, whenever you want to work on a project, you only have to activate
+the corresponding environment. On OS X and Linux, do the following:</p>
+<div class="highlight-python"><pre>$ . env/bin/activate</pre>
+</div>
+<p>(Note the space between the dot and the script name. The dot means that
+this script should run in the context of the current shell. If this command
+does not work in your shell, try replacing the dot with <tt class="docutils literal"><span class="pre">source</span></tt>)</p>
+<p>If you are a Windows user, the following command is for you:</p>
+<div class="highlight-python"><pre>$ env\scripts\activate</pre>
+</div>
+<p>Either way, you should now be using your virtualenv (see how the prompt of
+your shell has changed to show the virtualenv).</p>
+<p>Now you can just enter the following command to get Flask activated in
+your virtualenv:</p>
+<div class="highlight-python"><pre>$ easy_install Flask</pre>
+</div>
+<p>A few seconds later you are good to go.</p>
+</div>
+<div class="section" id="system-wide-installation">
+<h2>System Wide Installation<a class="headerlink" href="#system-wide-installation" title="Permalink to this headline">¶</a></h2>
+<p>This is possible as well, but I do not recommend it. Just run
+<cite>easy_install</cite> with root rights:</p>
+<div class="highlight-python"><pre>$ sudo easy_install Flask</pre>
+</div>
+<p>(Run it in an Admin shell on Windows systems and without <cite>sudo</cite>).</p>
+</div>
+<div class="section" id="living-on-the-edge">
+<h2>Living on the Edge<a class="headerlink" href="#living-on-the-edge" title="Permalink to this headline">¶</a></h2>
+<p>If you want to work with the latest version of Flask, there are two ways: you
+can either let <cite>easy_install</cite> pull in the development version, or tell it
+to operate on a git checkout. Either way, virtualenv is recommended.</p>
+<p>Get the git checkout in a new virtualenv and run in development mode:</p>
+<div class="highlight-python"><pre>$ git clone http://github.com/mitsuhiko/flask.git
+Initialized empty Git repository in ~/dev/flask/.git/
+$ cd flask
+$ virtualenv env
+$ . env/bin/activate
+New python executable in env/bin/python
+Installing setuptools............done.
+$ python setup.py develop
+...
+Finished processing dependencies for Flask</pre>
+</div>
+<p>This will pull in the dependencies and activate the git head as the current
+version inside the virtualenv. Then you just have to <tt class="docutils literal"><span class="pre">git</span> <span class="pre">pull</span> <span class="pre">origin</span></tt>
+to get the latest version.</p>
+<p>To just get the development version without git, do this instead:</p>
+<div class="highlight-python"><pre>$ mkdir flask
+$ cd flask
+$ virtualenv env
+$ . env/bin/activate
+New python executable in env/bin/python
+Installing setuptools............done.
+$ easy_install Flask==dev
+...
+Finished processing dependencies for Flask==dev</pre>
+</div>
+</div>
+<div class="section" id="easy-install-on-windows">
+<span id="windows-easy-install"></span><h2><cite>easy_install</cite> on Windows<a class="headerlink" href="#easy-install-on-windows" title="Permalink to this headline">¶</a></h2>
+<p>On Windows, installation of <cite>easy_install</cite> is a little bit trickier because
+slightly different rules apply on Windows than on Unix-like systems, but
+it&#8217;s not difficult. The easiest way to do it is to download the
+<a class="reference external" href="http://peak.telecommunity.com/dist/ez_setup.py">ez_setup.py</a> file and run it. The easiest way to run the file is to
+open your downloads folder and double-click on the file.</p>
+<p>Next, add the <cite>easy_install</cite> command and other Python scripts to the
+command search path, by adding your Python installation&#8217;s Scripts folder
+to the <cite>PATH</cite> environment variable. To do that, right-click on the
+&#8220;Computer&#8221; icon on the Desktop or in the Start menu, and choose
+&#8220;Properties&#8221;. Then, on Windows Vista and Windows 7 click on &#8220;Advanced System
+settings&#8221;; on Windows XP, click on the &#8220;Advanced&#8221; tab instead. Then click
+on the &#8220;Environment variables&#8221; button and double click on the &#8220;Path&#8221;
+variable in the &#8220;System variables&#8221; section. There append the path of your
+Python interpreter&#8217;s Scripts folder; make sure you delimit it from
+existing values with a semicolon. Assuming you are using Python 2.6 on
+the default path, add the following value:</p>
+<div class="highlight-python"><pre>;C:\Python26\Scripts</pre>
+</div>
+<p>Then you are done. To check that it worked, open the Command Prompt and
+execute <tt class="docutils literal"><span class="pre">easy_install</span></tt>. If you have User Account Control enabled on
+Windows Vista or Windows 7, it should prompt you for admin privileges.</p>
+</div>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="index.html">
+ <img class="logo" src="_static/flask.png" alt="Logo"/>
+</a></p>
+ <h3><a href="index.html">Table Of Contents</a></h3>
+ <ul>
+<li><a class="reference internal" href="#">Installation</a><ul>
+<li><a class="reference internal" href="#virtualenv">virtualenv</a></li>
+<li><a class="reference internal" href="#system-wide-installation">System Wide Installation</a></li>
+<li><a class="reference internal" href="#living-on-the-edge">Living on the Edge</a></li>
+<li><a class="reference internal" href="#easy-install-on-windows"><cite>easy_install</cite> on Windows</a></li>
+</ul>
+</li>
+</ul>
+<h3>Related Topics</h3>
+<ul>
+ <li><a href="index.html">Documentation overview</a><ul>
+ <li>Previous: <a href="foreword.html" title="previous chapter">Foreword</a></li>
+ <li>Next: <a href="quickstart.html" title="next chapter">Quickstart</a></li>
+ </ul></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="_sources/installation.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/latexindex.html b/app/static/doc/flask-docs/latexindex.html
new file mode 100644
index 0000000..c604ff1
--- /dev/null
+++ b/app/static/doc/flask-docs/latexindex.html
@@ -0,0 +1,406 @@
+
+<!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>Flask Documentation &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="index.html" />
+
+
+ <link rel="apple-touch-icon" href="_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <h3>Navigation</h3>
+ <ul>
+ <li class="right" style="margin-right: 10px">
+ <a href="genindex.html" title="General Index"
+ accesskey="I">index</a></li>
+ <li><a href="index.html">Flask 0.8 documentation</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="flask-documentation">
+<h1>Flask Documentation<a class="headerlink" href="#flask-documentation" title="Permalink to this headline">¶</a></h1>
+<div class="section" id="user-s-guide">
+<h2>User&#8217;s Guide<a class="headerlink" href="#user-s-guide" title="Permalink to this headline">¶</a></h2>
+<p>This part of the documentation, which is mostly prose, begins with some
+background information about Flask, then focuses on step-by-step
+instructions for web development with Flask.</p>
+<div class="toctree-wrapper compound">
+<ul>
+<li class="toctree-l1"><a class="reference internal" href="foreword.html">Foreword</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="foreword.html#what-does-micro-mean">What does &#8220;micro&#8221; mean?</a></li>
+<li class="toctree-l2"><a class="reference internal" href="foreword.html#web-development-is-dangerous">Web Development is Dangerous</a></li>
+<li class="toctree-l2"><a class="reference internal" href="foreword.html#the-status-of-python-3">The Status of Python 3</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="installation.html">Installation</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="installation.html#virtualenv">virtualenv</a></li>
+<li class="toctree-l2"><a class="reference internal" href="installation.html#system-wide-installation">System Wide Installation</a></li>
+<li class="toctree-l2"><a class="reference internal" href="installation.html#living-on-the-edge">Living on the Edge</a></li>
+<li class="toctree-l2"><a class="reference internal" href="installation.html#easy-install-on-windows"><cite>easy_install</cite> on Windows</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="quickstart.html">Quickstart</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="quickstart.html#a-minimal-application">A Minimal Application</a></li>
+<li class="toctree-l2"><a class="reference internal" href="quickstart.html#debug-mode">Debug Mode</a></li>
+<li class="toctree-l2"><a class="reference internal" href="quickstart.html#routing">Routing</a></li>
+<li class="toctree-l2"><a class="reference internal" href="quickstart.html#static-files">Static Files</a></li>
+<li class="toctree-l2"><a class="reference internal" href="quickstart.html#rendering-templates">Rendering Templates</a></li>
+<li class="toctree-l2"><a class="reference internal" href="quickstart.html#accessing-request-data">Accessing Request Data</a></li>
+<li class="toctree-l2"><a class="reference internal" href="quickstart.html#redirects-and-errors">Redirects and Errors</a></li>
+<li class="toctree-l2"><a class="reference internal" href="quickstart.html#about-responses">About Responses</a></li>
+<li class="toctree-l2"><a class="reference internal" href="quickstart.html#sessions">Sessions</a></li>
+<li class="toctree-l2"><a class="reference internal" href="quickstart.html#message-flashing">Message Flashing</a></li>
+<li class="toctree-l2"><a class="reference internal" href="quickstart.html#logging">Logging</a></li>
+<li class="toctree-l2"><a class="reference internal" href="quickstart.html#hooking-in-wsgi-middlewares">Hooking in WSGI Middlewares</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="tutorial/index.html">Tutorial</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="tutorial/introduction.html">Introducing Flaskr</a></li>
+<li class="toctree-l2"><a class="reference internal" href="tutorial/folders.html">Step 0: Creating The Folders</a></li>
+<li class="toctree-l2"><a class="reference internal" href="tutorial/schema.html">Step 1: Database Schema</a></li>
+<li class="toctree-l2"><a class="reference internal" href="tutorial/setup.html">Step 2: Application Setup Code</a></li>
+<li class="toctree-l2"><a class="reference internal" href="tutorial/dbinit.html">Step 3: Creating The Database</a></li>
+<li class="toctree-l2"><a class="reference internal" href="tutorial/dbcon.html">Step 4: Request Database Connections</a></li>
+<li class="toctree-l2"><a class="reference internal" href="tutorial/views.html">Step 5: The View Functions</a></li>
+<li class="toctree-l2"><a class="reference internal" href="tutorial/templates.html">Step 6: The Templates</a></li>
+<li class="toctree-l2"><a class="reference internal" href="tutorial/css.html">Step 7: Adding Style</a></li>
+<li class="toctree-l2"><a class="reference internal" href="tutorial/testing.html">Bonus: Testing the Application</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="templating.html">Templates</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="templating.html#jinja-setup">Jinja Setup</a></li>
+<li class="toctree-l2"><a class="reference internal" href="templating.html#standard-context">Standard Context</a></li>
+<li class="toctree-l2"><a class="reference internal" href="templating.html#standard-filters">Standard Filters</a></li>
+<li class="toctree-l2"><a class="reference internal" href="templating.html#controlling-autoescaping">Controlling Autoescaping</a></li>
+<li class="toctree-l2"><a class="reference internal" href="templating.html#registering-filters">Registering Filters</a></li>
+<li class="toctree-l2"><a class="reference internal" href="templating.html#context-processors">Context Processors</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="testing.html">Testing Flask Applications</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="testing.html#the-application">The Application</a></li>
+<li class="toctree-l2"><a class="reference internal" href="testing.html#the-testing-skeleton">The Testing Skeleton</a></li>
+<li class="toctree-l2"><a class="reference internal" href="testing.html#the-first-test">The First Test</a></li>
+<li class="toctree-l2"><a class="reference internal" href="testing.html#logging-in-and-out">Logging In and Out</a></li>
+<li class="toctree-l2"><a class="reference internal" href="testing.html#test-adding-messages">Test Adding Messages</a></li>
+<li class="toctree-l2"><a class="reference internal" href="testing.html#other-testing-tricks">Other Testing Tricks</a></li>
+<li class="toctree-l2"><a class="reference internal" href="testing.html#keeping-the-context-around">Keeping the Context Around</a></li>
+<li class="toctree-l2"><a class="reference internal" href="testing.html#accessing-and-modifying-sessions">Accessing and Modifying Sessions</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="errorhandling.html">Handling Application Errors</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="errorhandling.html#error-mails">Error Mails</a></li>
+<li class="toctree-l2"><a class="reference internal" href="errorhandling.html#logging-to-a-file">Logging to a File</a></li>
+<li class="toctree-l2"><a class="reference internal" href="errorhandling.html#controlling-the-log-format">Controlling the Log Format</a></li>
+<li class="toctree-l2"><a class="reference internal" href="errorhandling.html#other-libraries">Other Libraries</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="config.html">Configuration Handling</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="config.html#configuration-basics">Configuration Basics</a></li>
+<li class="toctree-l2"><a class="reference internal" href="config.html#builtin-configuration-values">Builtin Configuration Values</a></li>
+<li class="toctree-l2"><a class="reference internal" href="config.html#configuring-from-files">Configuring from Files</a></li>
+<li class="toctree-l2"><a class="reference internal" href="config.html#configuration-best-practices">Configuration Best Practices</a></li>
+<li class="toctree-l2"><a class="reference internal" href="config.html#development-production">Development / Production</a></li>
+<li class="toctree-l2"><a class="reference internal" href="config.html#instance-folders">Instance Folders</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="signals.html">Signals</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="signals.html#subscribing-to-signals">Subscribing to Signals</a></li>
+<li class="toctree-l2"><a class="reference internal" href="signals.html#creating-signals">Creating Signals</a></li>
+<li class="toctree-l2"><a class="reference internal" href="signals.html#sending-signals">Sending Signals</a></li>
+<li class="toctree-l2"><a class="reference internal" href="signals.html#decorator-based-signal-subscriptions">Decorator Based Signal Subscriptions</a></li>
+<li class="toctree-l2"><a class="reference internal" href="signals.html#core-signals">Core Signals</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="views.html">Pluggable Views</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="views.html#basic-principle">Basic Principle</a></li>
+<li class="toctree-l2"><a class="reference internal" href="views.html#method-hints">Method Hints</a></li>
+<li class="toctree-l2"><a class="reference internal" href="views.html#method-based-dispatching">Method Based Dispatching</a></li>
+<li class="toctree-l2"><a class="reference internal" href="views.html#decorating-views">Decorating Views</a></li>
+<li class="toctree-l2"><a class="reference internal" href="views.html#method-views-for-apis">Method Views for APIs</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="reqcontext.html">The Request Context</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="reqcontext.html#diving-into-context-locals">Diving into Context Locals</a></li>
+<li class="toctree-l2"><a class="reference internal" href="reqcontext.html#how-the-context-works">How the Context Works</a></li>
+<li class="toctree-l2"><a class="reference internal" href="reqcontext.html#callbacks-and-errors">Callbacks and Errors</a></li>
+<li class="toctree-l2"><a class="reference internal" href="reqcontext.html#teardown-callbacks">Teardown Callbacks</a></li>
+<li class="toctree-l2"><a class="reference internal" href="reqcontext.html#notes-on-proxies">Notes On Proxies</a></li>
+<li class="toctree-l2"><a class="reference internal" href="reqcontext.html#context-preservation-on-error">Context Preservation on Error</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="blueprints.html">Modular Applications with Blueprints</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="blueprints.html#why-blueprints">Why Blueprints?</a></li>
+<li class="toctree-l2"><a class="reference internal" href="blueprints.html#the-concept-of-blueprints">The Concept of Blueprints</a></li>
+<li class="toctree-l2"><a class="reference internal" href="blueprints.html#my-first-blueprint">My First Blueprint</a></li>
+<li class="toctree-l2"><a class="reference internal" href="blueprints.html#registering-blueprints">Registering Blueprints</a></li>
+<li class="toctree-l2"><a class="reference internal" href="blueprints.html#blueprint-resources">Blueprint Resources</a></li>
+<li class="toctree-l2"><a class="reference internal" href="blueprints.html#building-urls">Building URLs</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="extensions.html">Flask Extensions</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="extensions.html#finding-extensions">Finding Extensions</a></li>
+<li class="toctree-l2"><a class="reference internal" href="extensions.html#using-extensions">Using Extensions</a></li>
+<li class="toctree-l2"><a class="reference internal" href="extensions.html#flask-before-0-8">Flask Before 0.8</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="shell.html">Working with the Shell</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="shell.html#creating-a-request-context">Creating a Request Context</a></li>
+<li class="toctree-l2"><a class="reference internal" href="shell.html#firing-before-after-request">Firing Before/After Request</a></li>
+<li class="toctree-l2"><a class="reference internal" href="shell.html#further-improving-the-shell-experience">Further Improving the Shell Experience</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="patterns/index.html">Patterns for Flask</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="patterns/packages.html">Larger Applications</a></li>
+<li class="toctree-l2"><a class="reference internal" href="patterns/appfactories.html">Application Factories</a></li>
+<li class="toctree-l2"><a class="reference internal" href="patterns/appdispatch.html">Application Dispatching</a></li>
+<li class="toctree-l2"><a class="reference internal" href="patterns/urlprocessors.html">Using URL Processors</a></li>
+<li class="toctree-l2"><a class="reference internal" href="patterns/distribute.html">Deploying with Distribute</a></li>
+<li class="toctree-l2"><a class="reference internal" href="patterns/fabric.html">Deploying with Fabric</a></li>
+<li class="toctree-l2"><a class="reference internal" href="patterns/sqlite3.html">Using SQLite 3 with Flask</a></li>
+<li class="toctree-l2"><a class="reference internal" href="patterns/sqlalchemy.html">SQLAlchemy in Flask</a></li>
+<li class="toctree-l2"><a class="reference internal" href="patterns/fileuploads.html">Uploading Files</a></li>
+<li class="toctree-l2"><a class="reference internal" href="patterns/caching.html">Caching</a></li>
+<li class="toctree-l2"><a class="reference internal" href="patterns/viewdecorators.html">View Decorators</a></li>
+<li class="toctree-l2"><a class="reference internal" href="patterns/wtforms.html">Form Validation with WTForms</a></li>
+<li class="toctree-l2"><a class="reference internal" href="patterns/templateinheritance.html">Template Inheritance</a></li>
+<li class="toctree-l2"><a class="reference internal" href="patterns/flashing.html">Message Flashing</a></li>
+<li class="toctree-l2"><a class="reference internal" href="patterns/jquery.html">AJAX with jQuery</a></li>
+<li class="toctree-l2"><a class="reference internal" href="patterns/errorpages.html">Custom Error Pages</a></li>
+<li class="toctree-l2"><a class="reference internal" href="patterns/lazyloading.html">Lazily Loading Views</a></li>
+<li class="toctree-l2"><a class="reference internal" href="patterns/mongokit.html">MongoKit in Flask</a></li>
+<li class="toctree-l2"><a class="reference internal" href="patterns/favicon.html">Adding a favicon</a></li>
+<li class="toctree-l2"><a class="reference internal" href="patterns/streaming.html">Streaming Contents</a></li>
+<li class="toctree-l2"><a class="reference internal" href="patterns/deferredcallbacks.html">Deferred Request Callbacks</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="deploying/index.html">Deployment Options</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="deploying/mod_wsgi.html">mod_wsgi (Apache)</a></li>
+<li class="toctree-l2"><a class="reference internal" href="deploying/cgi.html">CGI</a></li>
+<li class="toctree-l2"><a class="reference internal" href="deploying/fastcgi.html">FastCGI</a></li>
+<li class="toctree-l2"><a class="reference internal" href="deploying/uwsgi.html">uWSGI</a></li>
+<li class="toctree-l2"><a class="reference internal" href="deploying/others.html">Other Servers</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="becomingbig.html">Becoming Big</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="becomingbig.html#why-consider-forking">Why consider Forking?</a></li>
+<li class="toctree-l2"><a class="reference internal" href="becomingbig.html#scaling-like-a-pro">Scaling like a Pro</a></li>
+<li class="toctree-l2"><a class="reference internal" href="becomingbig.html#dialogue-with-the-community">Dialogue with the Community</a></li>
+</ul>
+</li>
+</ul>
+</div>
+</div>
+<div class="section" id="api-reference">
+<h2>API Reference<a class="headerlink" href="#api-reference" title="Permalink to this headline">¶</a></h2>
+<p>If you are looking for information on a specific function, class or
+method, this part of the documentation is for you.</p>
+<div class="toctree-wrapper compound">
+<ul>
+<li class="toctree-l1"><a class="reference internal" href="api.html">API</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="api.html#application-object">Application Object</a></li>
+<li class="toctree-l2"><a class="reference internal" href="api.html#blueprint-objects">Blueprint Objects</a></li>
+<li class="toctree-l2"><a class="reference internal" href="api.html#incoming-request-data">Incoming Request Data</a></li>
+<li class="toctree-l2"><a class="reference internal" href="api.html#response-objects">Response Objects</a></li>
+<li class="toctree-l2"><a class="reference internal" href="api.html#sessions">Sessions</a></li>
+<li class="toctree-l2"><a class="reference internal" href="api.html#session-interface">Session Interface</a></li>
+<li class="toctree-l2"><a class="reference internal" href="api.html#test-client">Test Client</a></li>
+<li class="toctree-l2"><a class="reference internal" href="api.html#application-globals">Application Globals</a></li>
+<li class="toctree-l2"><a class="reference internal" href="api.html#useful-functions-and-classes">Useful Functions and Classes</a></li>
+<li class="toctree-l2"><a class="reference internal" href="api.html#message-flashing">Message Flashing</a></li>
+<li class="toctree-l2"><a class="reference internal" href="api.html#returning-json">Returning JSON</a></li>
+<li class="toctree-l2"><a class="reference internal" href="api.html#template-rendering">Template Rendering</a></li>
+<li class="toctree-l2"><a class="reference internal" href="api.html#configuration">Configuration</a></li>
+<li class="toctree-l2"><a class="reference internal" href="api.html#extensions">Extensions</a></li>
+<li class="toctree-l2"><a class="reference internal" href="api.html#useful-internals">Useful Internals</a></li>
+<li class="toctree-l2"><a class="reference internal" href="api.html#signals">Signals</a></li>
+<li class="toctree-l2"><a class="reference internal" href="api.html#class-based-views">Class Based Views</a></li>
+<li class="toctree-l2"><a class="reference internal" href="api.html#url-route-registrations">URL Route Registrations</a></li>
+<li class="toctree-l2"><a class="reference internal" href="api.html#view-function-options">View Function Options</a></li>
+</ul>
+</li>
+</ul>
+</div>
+</div>
+<div class="section" id="additional-notes">
+<h2>Additional Notes<a class="headerlink" href="#additional-notes" title="Permalink to this headline">¶</a></h2>
+<p>Design notes, legal information and changelog are here for the interested.</p>
+<div class="toctree-wrapper compound">
+<ul>
+<li class="toctree-l1"><a class="reference internal" href="design.html">Design Decisions in Flask</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="design.html#the-explicit-application-object">The Explicit Application Object</a></li>
+<li class="toctree-l2"><a class="reference internal" href="design.html#the-routing-system">The Routing System</a></li>
+<li class="toctree-l2"><a class="reference internal" href="design.html#one-template-engine">One Template Engine</a></li>
+<li class="toctree-l2"><a class="reference internal" href="design.html#micro-with-dependencies">Micro with Dependencies</a></li>
+<li class="toctree-l2"><a class="reference internal" href="design.html#thread-locals">Thread Locals</a></li>
+<li class="toctree-l2"><a class="reference internal" href="design.html#what-flask-is-what-flask-is-not">What Flask is, What Flask is Not</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="htmlfaq.html">HTML/XHTML FAQ</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="htmlfaq.html#history-of-xhtml">History of XHTML</a></li>
+<li class="toctree-l2"><a class="reference internal" href="htmlfaq.html#history-of-html5">History of HTML5</a></li>
+<li class="toctree-l2"><a class="reference internal" href="htmlfaq.html#html-versus-xhtml">HTML versus XHTML</a></li>
+<li class="toctree-l2"><a class="reference internal" href="htmlfaq.html#what-does-strict-mean">What does &#8220;strict&#8221; mean?</a></li>
+<li class="toctree-l2"><a class="reference internal" href="htmlfaq.html#new-technologies-in-html5">New technologies in HTML5</a></li>
+<li class="toctree-l2"><a class="reference internal" href="htmlfaq.html#what-should-be-used">What should be used?</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="security.html">Security Considerations</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="security.html#cross-site-scripting-xss">Cross-Site Scripting (XSS)</a></li>
+<li class="toctree-l2"><a class="reference internal" href="security.html#cross-site-request-forgery-csrf">Cross-Site Request Forgery (CSRF)</a></li>
+<li class="toctree-l2"><a class="reference internal" href="security.html#json-security">JSON Security</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="unicode.html">Unicode in Flask</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="unicode.html#automatic-conversion">Automatic Conversion</a></li>
+<li class="toctree-l2"><a class="reference internal" href="unicode.html#the-golden-rule">The Golden Rule</a></li>
+<li class="toctree-l2"><a class="reference internal" href="unicode.html#encoding-and-decoding-yourself">Encoding and Decoding Yourself</a></li>
+<li class="toctree-l2"><a class="reference internal" href="unicode.html#configuring-editors">Configuring Editors</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="extensiondev.html">Flask Extension Development</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="extensiondev.html#anatomy-of-an-extension">Anatomy of an Extension</a></li>
+<li class="toctree-l2"><a class="reference internal" href="extensiondev.html#hello-flaskext">&#8220;Hello Flaskext!&#8221;</a></li>
+<li class="toctree-l2"><a class="reference internal" href="extensiondev.html#initializing-extensions">Initializing Extensions</a></li>
+<li class="toctree-l2"><a class="reference internal" href="extensiondev.html#the-extension-code">The Extension Code</a></li>
+<li class="toctree-l2"><a class="reference internal" href="extensiondev.html#adding-an-init-app-function">Adding an <cite>init_app</cite> Function</a></li>
+<li class="toctree-l2"><a class="reference internal" href="extensiondev.html#end-of-request-behavior">End-Of-Request Behavior</a></li>
+<li class="toctree-l2"><a class="reference internal" href="extensiondev.html#learn-from-others">Learn from Others</a></li>
+<li class="toctree-l2"><a class="reference internal" href="extensiondev.html#approved-extensions">Approved Extensions</a></li>
+<li class="toctree-l2"><a class="reference internal" href="extensiondev.html#extension-import-transition">Extension Import Transition</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="styleguide.html">Pocoo Styleguide</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="styleguide.html#general-layout">General Layout</a></li>
+<li class="toctree-l2"><a class="reference internal" href="styleguide.html#expressions-and-statements">Expressions and Statements</a></li>
+<li class="toctree-l2"><a class="reference internal" href="styleguide.html#naming-conventions">Naming Conventions</a></li>
+<li class="toctree-l2"><a class="reference internal" href="styleguide.html#docstrings">Docstrings</a></li>
+<li class="toctree-l2"><a class="reference internal" href="styleguide.html#comments">Comments</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="upgrading.html">Upgrading to Newer Releases</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="upgrading.html#version-0-8">Version 0.8</a></li>
+<li class="toctree-l2"><a class="reference internal" href="upgrading.html#version-0-7">Version 0.7</a></li>
+<li class="toctree-l2"><a class="reference internal" href="upgrading.html#version-0-6">Version 0.6</a></li>
+<li class="toctree-l2"><a class="reference internal" href="upgrading.html#version-0-5">Version 0.5</a></li>
+<li class="toctree-l2"><a class="reference internal" href="upgrading.html#version-0-4">Version 0.4</a></li>
+<li class="toctree-l2"><a class="reference internal" href="upgrading.html#version-0-3">Version 0.3</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="changelog.html">Flask Changelog</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-0-9">Version 0.9</a></li>
+<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-0-8">Version 0.8</a></li>
+<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-0-7-3">Version 0.7.3</a></li>
+<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-0-7-2">Version 0.7.2</a></li>
+<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-0-7-1">Version 0.7.1</a></li>
+<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-0-7">Version 0.7</a></li>
+<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-0-6-1">Version 0.6.1</a></li>
+<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-0-6">Version 0.6</a></li>
+<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-0-5-2">Version 0.5.2</a></li>
+<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-0-5-1">Version 0.5.1</a></li>
+<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-0-5">Version 0.5</a></li>
+<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-0-4">Version 0.4</a></li>
+<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-0-3-1">Version 0.3.1</a></li>
+<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-0-3">Version 0.3</a></li>
+<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-0-2">Version 0.2</a></li>
+<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-0-1">Version 0.1</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="license.html">License</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="license.html#authors">Authors</a></li>
+<li class="toctree-l2"><a class="reference internal" href="license.html#general-license-definitions">General License Definitions</a></li>
+<li class="toctree-l2"><a class="reference internal" href="license.html#flask-license">Flask License</a></li>
+<li class="toctree-l2"><a class="reference internal" href="license.html#flask-artwork-license">Flask Artwork License</a></li>
+</ul>
+</li>
+</ul>
+</div>
+</div>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="index.html">
+ <img class="logo" src="_static/flask.png" alt="Logo"/>
+</a></p>
+ <h3><a href="index.html">Table Of Contents</a></h3>
+ <ul>
+<li><a class="reference internal" href="#">Flask Documentation</a><ul>
+<li><a class="reference internal" href="#user-s-guide">User&#8217;s Guide</a><ul>
+</ul>
+</li>
+<li><a class="reference internal" href="#api-reference">API Reference</a><ul>
+</ul>
+</li>
+<li><a class="reference internal" href="#additional-notes">Additional Notes</a><ul>
+</ul>
+</li>
+</ul>
+</li>
+</ul>
+<h3>Related Topics</h3>
+<ul>
+ <li><a href="index.html">Documentation overview</a><ul>
+ </ul></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="_sources/latexindex.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/license.html b/app/static/doc/flask-docs/license.html
new file mode 100644
index 0000000..7f00395
--- /dev/null
+++ b/app/static/doc/flask-docs/license.html
@@ -0,0 +1,220 @@
+
+<!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>License &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="index.html" />
+ <link rel="prev" title="Flask Changelog" href="changelog.html" />
+
+
+ <link rel="apple-touch-icon" href="_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <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="changelog.html" title="Flask Changelog"
+ accesskey="P">previous</a> |</li>
+ <li><a href="index.html">Flask 0.8 documentation</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="license">
+<h1>License<a class="headerlink" href="#license" title="Permalink to this headline">¶</a></h1>
+<p>Flask is licensed under a three clause BSD License. It basically means:
+do whatever you want with it as long as the copyright in Flask sticks
+around, the conditions are not modified and the disclaimer is present.
+Furthermore you must not use the names of the authors to promote derivatives
+of the software without written consent.</p>
+<p>The full license text can be found below (<a class="reference internal" href="#flask-license"><em>Flask License</em></a>). For the
+documentation and artwork different licenses apply.</p>
+<div class="section" id="authors">
+<span id="id1"></span><h2>Authors<a class="headerlink" href="#authors" title="Permalink to this headline">¶</a></h2>
+<p>Flask is written and maintained by Armin Ronacher and
+various contributors:</p>
+<div class="section" id="development-lead">
+<h3>Development Lead<a class="headerlink" href="#development-lead" title="Permalink to this headline">¶</a></h3>
+<ul class="simple">
+<li>Armin Ronacher &lt;<a class="reference external" href="mailto:armin&#46;ronacher&#37;&#52;&#48;active-4&#46;com">armin<span>&#46;</span>ronacher<span>&#64;</span>active-4<span>&#46;</span>com</a>&gt;</li>
+</ul>
+</div>
+<div class="section" id="patches-and-suggestions">
+<h3>Patches and Suggestions<a class="headerlink" href="#patches-and-suggestions" title="Permalink to this headline">¶</a></h3>
+<ul class="simple">
+<li>Adam Zapletal</li>
+<li>Ali Afshar</li>
+<li>Chris Edgemon</li>
+<li>Chris Grindstaff</li>
+<li>Christopher Grebs</li>
+<li>Florent Xicluna</li>
+<li>Georg Brandl</li>
+<li>Justin Quick</li>
+<li>Kenneth Reitz</li>
+<li>Marian Sigler</li>
+<li>Matt Campell</li>
+<li>Matthew Frazier</li>
+<li>Michael van Tellingen</li>
+<li>Ron DuPlain</li>
+<li>Sebastien Estienne</li>
+<li>Simon Sapin</li>
+<li>Stephane Wirtel</li>
+<li>Thomas Schranz</li>
+<li>Zhao Xiaohong</li>
+</ul>
+</div>
+</div>
+<div class="section" id="general-license-definitions">
+<h2>General License Definitions<a class="headerlink" href="#general-license-definitions" title="Permalink to this headline">¶</a></h2>
+<p>The following section contains the full license texts for Flask and the
+documentation.</p>
+<ul class="simple">
+<li>&#8220;AUTHORS&#8221; hereby refers to all the authors listed in the
+<a class="reference internal" href="#authors"><em>Authors</em></a> section.</li>
+<li>The &#8220;<a class="reference internal" href="#flask-license"><em>Flask License</em></a>&#8221; applies to all the sourcecode shipped as
+part of Flask (Flask itself as well as the examples and the unittests)
+as well as documentation.</li>
+<li>The &#8220;<a class="reference internal" href="#artwork-license"><em>Flask Artwork License</em></a>&#8221; applies to the project&#8217;s Horn-Logo.</li>
+</ul>
+</div>
+<div class="section" id="flask-license">
+<span id="id2"></span><h2>Flask License<a class="headerlink" href="#flask-license" title="Permalink to this headline">¶</a></h2>
+<p>Copyright (c) 2010 by Armin Ronacher and contributors. See AUTHORS
+for more details.</p>
+<p>Some rights reserved.</p>
+<p>Redistribution and use in source and binary forms of the software as well
+as documentation, with or without modification, are permitted provided
+that the following conditions are met:</p>
+<ul class="simple">
+<li>Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.</li>
+<li>Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the following
+disclaimer in the documentation and/or other materials provided
+with the distribution.</li>
+<li>The names of the contributors may not be used to endorse or
+promote products derived from this software without specific
+prior written permission.</li>
+</ul>
+<p>THIS SOFTWARE AND DOCUMENTATION IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+CONTRIBUTORS &#8220;AS IS&#8221; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
+NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE AND DOCUMENTATION, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGE.</p>
+</div>
+<div class="section" id="flask-artwork-license">
+<span id="artwork-license"></span><h2>Flask Artwork License<a class="headerlink" href="#flask-artwork-license" title="Permalink to this headline">¶</a></h2>
+<p>Copyright (c) 2010 by Armin Ronacher.</p>
+<p>Some rights reserved.</p>
+<p>This logo or a modified version may be used by anyone to refer to the
+Flask project, but does not indicate endorsement by the project.</p>
+<p>Redistribution and use in source (the SVG file) and binary forms (rendered
+PNG files etc.) of the image, with or without modification, are permitted
+provided that the following conditions are met:</p>
+<ul class="simple">
+<li>Redistributions of source code must retain the above copyright
+notice and this list of conditions.</li>
+<li>The names of the contributors to the Flask software (see AUTHORS) may
+not be used to endorse or promote products derived from this software
+without specific prior written permission.</li>
+</ul>
+<p>Note: we would appreciate that you make the image a link to
+<a class="reference external" href="http://flask.pocoo.org/">http://flask.pocoo.org/</a> if you use it on a web page.</p>
+</div>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="index.html">
+ <img class="logo" src="_static/flask.png" alt="Logo"/>
+</a></p>
+ <h3><a href="index.html">Table Of Contents</a></h3>
+ <ul>
+<li><a class="reference internal" href="#">License</a><ul>
+<li><a class="reference internal" href="#authors">Authors</a><ul>
+<li><a class="reference internal" href="#development-lead">Development Lead</a></li>
+<li><a class="reference internal" href="#patches-and-suggestions">Patches and Suggestions</a></li>
+</ul>
+</li>
+<li><a class="reference internal" href="#general-license-definitions">General License Definitions</a></li>
+<li><a class="reference internal" href="#flask-license">Flask License</a></li>
+<li><a class="reference internal" href="#flask-artwork-license">Flask Artwork License</a></li>
+</ul>
+</li>
+</ul>
+<h3>Related Topics</h3>
+<ul>
+ <li><a href="index.html">Documentation overview</a><ul>
+ <li>Previous: <a href="changelog.html" title="previous chapter">Flask Changelog</a></li>
+ </ul></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="_sources/license.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/objects.inv b/app/static/doc/flask-docs/objects.inv
new file mode 100644
index 0000000..4f903cd
--- /dev/null
+++ b/app/static/doc/flask-docs/objects.inv
Binary files differ
diff --git a/app/static/doc/flask-docs/patterns/appdispatch.html b/app/static/doc/flask-docs/patterns/appdispatch.html
new file mode 100644
index 0000000..de88a7b
--- /dev/null
+++ b/app/static/doc/flask-docs/patterns/appdispatch.html
@@ -0,0 +1,273 @@
+
+<!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>Application Dispatching &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="../index.html" />
+ <link rel="up" title="Patterns for Flask" href="index.html" />
+ <link rel="next" title="Using URL Processors" href="urlprocessors.html" />
+ <link rel="prev" title="Application Factories" href="appfactories.html" />
+
+
+ <link rel="apple-touch-icon" href="../_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="../_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <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="urlprocessors.html" title="Using URL Processors"
+ accesskey="N">next</a> |</li>
+ <li class="right" >
+ <a href="appfactories.html" title="Application Factories"
+ accesskey="P">previous</a> |</li>
+ <li><a href="../index.html">Flask 0.8 documentation</a> &raquo;</li>
+ <li><a href="index.html" accesskey="U">Patterns for Flask</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="application-dispatching">
+<span id="app-dispatch"></span><h1>Application Dispatching<a class="headerlink" href="#application-dispatching" title="Permalink to this headline">¶</a></h1>
+<p>Application dispatching is the process of combining multiple Flask
+applications on the WSGI level. You can not only combine Flask
+applications into something larger but any WSGI application. This would
+even allow you to run a Django and a Flask application in the same
+interpreter side by side if you want. The usefulness of this depends on
+how the applications work internally.</p>
+<p>The fundamental difference from the <a class="reference internal" href="packages.html#larger-applications"><em>module approach</em></a> is that in this case you are running the same or
+different Flask applications that are entirely isolated from each other.
+They run different configurations and are dispatched on the WSGI level.</p>
+<div class="section" id="working-with-this-document">
+<h2>Working with this Document<a class="headerlink" href="#working-with-this-document" title="Permalink to this headline">¶</a></h2>
+<p>Each of the techniques and examples below results in an <tt class="docutils literal"><span class="pre">application</span></tt> object
+that can be run with any WSGI server. For production, see <a class="reference internal" href="../deploying/index.html#deployment"><em>Deployment Options</em></a>.
+For development, Werkzeug provides a builtin server for development available
+at <a class="reference external" href="http://werkzeug.pocoo.org/docs/serving/#werkzeug.serving.run_simple" title="(in Werkzeug v0.7)"><tt class="xref py py-func docutils literal"><span class="pre">werkzeug.serving.run_simple()</span></tt></a>:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">werkzeug.serving</span> <span class="kn">import</span> <span class="n">run_simple</span>
+<span class="n">run_simple</span><span class="p">(</span><span class="s">&#39;localhost&#39;</span><span class="p">,</span> <span class="mi">5000</span><span class="p">,</span> <span class="n">application</span><span class="p">,</span> <span class="n">use_reloader</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>Note that <a class="reference external" href="http://werkzeug.pocoo.org/docs/serving/#werkzeug.serving.run_simple" title="(in Werkzeug v0.7)"><tt class="xref py py-func docutils literal"><span class="pre">run_simple</span></tt></a> is not intended for
+use in production. Use a <a class="reference internal" href="../deploying/index.html#deployment"><em>full-blown WSGI server</em></a>.</p>
+</div>
+<div class="section" id="combining-applications">
+<h2>Combining Applications<a class="headerlink" href="#combining-applications" title="Permalink to this headline">¶</a></h2>
+<p>If you have entirely separated applications and you want them to work next
+to each other in the same Python interpreter process you can take
+advantage of the <a class="reference external" href="http://werkzeug.pocoo.org/docs/middlewares/#werkzeug.wsgi.DispatcherMiddleware" title="(in Werkzeug v0.7)"><tt class="xref py py-class docutils literal"><span class="pre">werkzeug.wsgi.DispatcherMiddleware</span></tt></a>. The idea
+here is that each Flask application is a valid WSGI application and they
+are combined by the dispatcher middleware into a larger one that
+dispatched based on prefix.</p>
+<p>For example you could have your main application run on <cite>/</cite> and your
+backend interface on <cite>/backend</cite>:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">werkzeug.wsgi</span> <span class="kn">import</span> <span class="n">DispatcherMiddleware</span>
+<span class="kn">from</span> <span class="nn">frontend_app</span> <span class="kn">import</span> <span class="n">application</span> <span class="k">as</span> <span class="n">frontend</span>
+<span class="kn">from</span> <span class="nn">backend_app</span> <span class="kn">import</span> <span class="n">application</span> <span class="k">as</span> <span class="n">backend</span>
+
+<span class="n">application</span> <span class="o">=</span> <span class="n">DispatcherMiddleware</span><span class="p">(</span><span class="n">frontend</span><span class="p">,</span> <span class="p">{</span>
+ <span class="s">&#39;/backend&#39;</span><span class="p">:</span> <span class="n">backend</span>
+<span class="p">})</span>
+</pre></div>
+</div>
+</div>
+<div class="section" id="dispatch-by-subdomain">
+<h2>Dispatch by Subdomain<a class="headerlink" href="#dispatch-by-subdomain" title="Permalink to this headline">¶</a></h2>
+<p>Sometimes you might want to use multiple instances of the same application
+with different configurations. Assuming the application is created inside
+a function and you can call that function to instanciate it, that is
+really easy to implement. In order to develop your application to support
+creating new instances in functions have a look at the
+<a class="reference internal" href="appfactories.html#app-factories"><em>Application Factories</em></a> pattern.</p>
+<p>A very common example would be creating applications per subdomain. For
+instance you configure your webserver to dispatch all requests for all
+subdomains to your application and you then use the subdomain information
+to create user-specific instances. Once you have your server set up to
+listen on all subdomains you can use a very simple WSGI application to do
+the dynamic application creation.</p>
+<p>The perfect level for abstraction in that regard is the WSGI layer. You
+write your own WSGI application that looks at the request that comes and
+and delegates it to your Flask application. If that application does not
+exist yet, it is dynamically created and remembered:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">threading</span> <span class="kn">import</span> <span class="n">Lock</span>
+
+<span class="k">class</span> <span class="nc">SubdomainDispatcher</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
+
+ <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">domain</span><span class="p">,</span> <span class="n">create_app</span><span class="p">):</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">domain</span> <span class="o">=</span> <span class="n">domain</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">create_app</span> <span class="o">=</span> <span class="n">create_app</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">lock</span> <span class="o">=</span> <span class="n">Lock</span><span class="p">()</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">instances</span> <span class="o">=</span> <span class="p">{}</span>
+
+ <span class="k">def</span> <span class="nf">get_application</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">host</span><span class="p">):</span>
+ <span class="n">host</span> <span class="o">=</span> <span class="n">host</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;:&#39;</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span>
+ <span class="k">assert</span> <span class="n">host</span><span class="o">.</span><span class="n">endswith</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">domain</span><span class="p">),</span> <span class="s">&#39;Configuration error&#39;</span>
+ <span class="n">subdomain</span> <span class="o">=</span> <span class="n">host</span><span class="p">[:</span><span class="o">-</span><span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">domain</span><span class="p">)]</span><span class="o">.</span><span class="n">rstrip</span><span class="p">(</span><span class="s">&#39;.&#39;</span><span class="p">)</span>
+ <span class="k">with</span> <span class="bp">self</span><span class="o">.</span><span class="n">lock</span><span class="p">:</span>
+ <span class="n">app</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">instances</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">subdomain</span><span class="p">)</span>
+ <span class="k">if</span> <span class="n">app</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+ <span class="n">app</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">create_app</span><span class="p">(</span><span class="n">subdomain</span><span class="p">)</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">instances</span><span class="p">[</span><span class="n">subdomain</span><span class="p">]</span> <span class="o">=</span> <span class="n">app</span>
+ <span class="k">return</span> <span class="n">app</span>
+
+ <span class="k">def</span> <span class="nf">__call__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">environ</span><span class="p">,</span> <span class="n">start_response</span><span class="p">):</span>
+ <span class="n">app</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_application</span><span class="p">(</span><span class="n">environ</span><span class="p">[</span><span class="s">&#39;HTTP_HOST&#39;</span><span class="p">])</span>
+ <span class="k">return</span> <span class="n">app</span><span class="p">(</span><span class="n">environ</span><span class="p">,</span> <span class="n">start_response</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>This dispatcher can then be used like this:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">myapplication</span> <span class="kn">import</span> <span class="n">create_app</span><span class="p">,</span> <span class="n">get_user_for_subdomain</span>
+<span class="kn">from</span> <span class="nn">werkzeug.exceptions</span> <span class="kn">import</span> <span class="n">NotFound</span>
+
+<span class="k">def</span> <span class="nf">make_app</span><span class="p">(</span><span class="n">subdomain</span><span class="p">):</span>
+ <span class="n">user</span> <span class="o">=</span> <span class="n">get_user_for_subdomain</span><span class="p">(</span><span class="n">subdomain</span><span class="p">)</span>
+ <span class="k">if</span> <span class="n">user</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+ <span class="c"># if there is no user for that subdomain we still have</span>
+ <span class="c"># to return a WSGI application that handles that request.</span>
+ <span class="c"># We can then just return the NotFound() exception as</span>
+ <span class="c"># application which will render a default 404 page.</span>
+ <span class="c"># You might also redirect the user to the main page then</span>
+ <span class="k">return</span> <span class="n">NotFound</span><span class="p">()</span>
+
+ <span class="c"># otherwise create the application for the specific user</span>
+ <span class="k">return</span> <span class="n">create_app</span><span class="p">(</span><span class="n">user</span><span class="p">)</span>
+
+<span class="n">application</span> <span class="o">=</span> <span class="n">SubdomainDispatcher</span><span class="p">(</span><span class="s">&#39;example.com&#39;</span><span class="p">,</span> <span class="n">make_app</span><span class="p">)</span>
+</pre></div>
+</div>
+</div>
+<div class="section" id="dispatch-by-path">
+<h2>Dispatch by Path<a class="headerlink" href="#dispatch-by-path" title="Permalink to this headline">¶</a></h2>
+<p>Dispatching by a path on the URL is very similar. Instead of looking at
+the <cite>Host</cite> header to figure out the subdomain one simply looks at the
+request path up to the first slash:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">threading</span> <span class="kn">import</span> <span class="n">Lock</span>
+<span class="kn">from</span> <span class="nn">werkzeug.wsgi</span> <span class="kn">import</span> <span class="n">pop_path_info</span><span class="p">,</span> <span class="n">peek_path_info</span>
+
+<span class="k">class</span> <span class="nc">PathDispatcher</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
+
+ <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">default_app</span><span class="p">,</span> <span class="n">create_app</span><span class="p">):</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">default_app</span> <span class="o">=</span> <span class="n">default_app</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">create_app</span> <span class="o">=</span> <span class="n">create_app</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">lock</span> <span class="o">=</span> <span class="n">Lock</span><span class="p">()</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">instances</span> <span class="o">=</span> <span class="p">{}</span>
+
+ <span class="k">def</span> <span class="nf">get_application</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">prefix</span><span class="p">):</span>
+ <span class="k">with</span> <span class="bp">self</span><span class="o">.</span><span class="n">lock</span><span class="p">:</span>
+ <span class="n">app</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">instances</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">prefix</span><span class="p">)</span>
+ <span class="k">if</span> <span class="n">app</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+ <span class="n">app</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">create_app</span><span class="p">(</span><span class="n">prefix</span><span class="p">)</span>
+ <span class="k">if</span> <span class="n">app</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">instances</span><span class="p">[</span><span class="n">prefix</span><span class="p">]</span> <span class="o">=</span> <span class="n">app</span>
+ <span class="k">return</span> <span class="n">app</span>
+
+ <span class="k">def</span> <span class="nf">__call__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">environ</span><span class="p">,</span> <span class="n">start_response</span><span class="p">):</span>
+ <span class="n">app</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_application</span><span class="p">(</span><span class="n">peek_path_info</span><span class="p">(</span><span class="n">environ</span><span class="p">))</span>
+ <span class="k">if</span> <span class="n">app</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+ <span class="n">pop_path_info</span><span class="p">(</span><span class="n">environ</span><span class="p">)</span>
+ <span class="k">else</span><span class="p">:</span>
+ <span class="n">app</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">default_app</span>
+ <span class="k">return</span> <span class="n">app</span><span class="p">(</span><span class="n">environ</span><span class="p">,</span> <span class="n">start_response</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>The big difference between this and the subdomain one is that this one
+falls back to another application if the creator function returns <cite>None</cite>:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">myapplication</span> <span class="kn">import</span> <span class="n">create_app</span><span class="p">,</span> <span class="n">default_app</span><span class="p">,</span> <span class="n">get_user_for_prefix</span>
+
+<span class="k">def</span> <span class="nf">make_app</span><span class="p">(</span><span class="n">prefix</span><span class="p">):</span>
+ <span class="n">user</span> <span class="o">=</span> <span class="n">get_user_for_prefix</span><span class="p">(</span><span class="n">prefix</span><span class="p">)</span>
+ <span class="k">if</span> <span class="n">user</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+ <span class="k">return</span> <span class="n">create_app</span><span class="p">(</span><span class="n">user</span><span class="p">)</span>
+
+<span class="n">application</span> <span class="o">=</span> <span class="n">PathDispatcher</span><span class="p">(</span><span class="n">default_app</span><span class="p">,</span> <span class="n">make_app</span><span class="p">)</span>
+</pre></div>
+</div>
+</div>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="../index.html">
+ <img class="logo" src="../_static/flask.png" alt="Logo"/>
+</a></p>
+ <h3><a href="../index.html">Table Of Contents</a></h3>
+ <ul>
+<li><a class="reference internal" href="#">Application Dispatching</a><ul>
+<li><a class="reference internal" href="#working-with-this-document">Working with this Document</a></li>
+<li><a class="reference internal" href="#combining-applications">Combining Applications</a></li>
+<li><a class="reference internal" href="#dispatch-by-subdomain">Dispatch by Subdomain</a></li>
+<li><a class="reference internal" href="#dispatch-by-path">Dispatch by Path</a></li>
+</ul>
+</li>
+</ul>
+<h3>Related Topics</h3>
+<ul>
+ <li><a href="../index.html">Documentation overview</a><ul>
+ <li><a href="index.html">Patterns for Flask</a><ul>
+ <li>Previous: <a href="appfactories.html" title="previous chapter">Application Factories</a></li>
+ <li>Next: <a href="urlprocessors.html" title="next chapter">Using URL Processors</a></li>
+ </ul></li>
+ </ul></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="../_sources/patterns/appdispatch.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/patterns/appfactories.html b/app/static/doc/flask-docs/patterns/appfactories.html
new file mode 100644
index 0000000..ccd26e0
--- /dev/null
+++ b/app/static/doc/flask-docs/patterns/appfactories.html
@@ -0,0 +1,186 @@
+
+<!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>Application Factories &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="../index.html" />
+ <link rel="up" title="Patterns for Flask" href="index.html" />
+ <link rel="next" title="Application Dispatching" href="appdispatch.html" />
+ <link rel="prev" title="Larger Applications" href="packages.html" />
+
+
+ <link rel="apple-touch-icon" href="../_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="../_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <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="appdispatch.html" title="Application Dispatching"
+ accesskey="N">next</a> |</li>
+ <li class="right" >
+ <a href="packages.html" title="Larger Applications"
+ accesskey="P">previous</a> |</li>
+ <li><a href="../index.html">Flask 0.8 documentation</a> &raquo;</li>
+ <li><a href="index.html" accesskey="U">Patterns for Flask</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="application-factories">
+<span id="app-factories"></span><h1>Application Factories<a class="headerlink" href="#application-factories" title="Permalink to this headline">¶</a></h1>
+<p>If you are already using packages and blueprints for your application
+(<a class="reference internal" href="../blueprints.html#blueprints"><em>Modular Applications with Blueprints</em></a>) there are a couple of really nice ways to further improve
+the experience. A common pattern is creating the application object when
+the blueprint is imported. But if you move the creation of this object,
+into a function, you can then create multiple instances of this and later.</p>
+<p>So why would you want to do this?</p>
+<ol class="arabic simple">
+<li>Testing. You can have instances of the application with different
+settings to test every case.</li>
+<li>Multiple instances. Imagine you want to run different versions of the
+same application. Of course you could have multiple instances with
+different configs set up in your webserver, but if you use factories,
+you can have multiple instances of the same application running in the
+same application process which can be handy.</li>
+</ol>
+<p>So how would you then actually implement that?</p>
+<div class="section" id="basic-factories">
+<h2>Basic Factories<a class="headerlink" href="#basic-factories" title="Permalink to this headline">¶</a></h2>
+<p>The idea is to set up the application in a function. Like this:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">def</span> <span class="nf">create_app</span><span class="p">(</span><span class="n">config_filename</span><span class="p">):</span>
+ <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">app</span><span class="o">.</span><span class="n">config</span><span class="o">.</span><span class="n">from_pyfile</span><span class="p">(</span><span class="n">config_filename</span><span class="p">)</span>
+
+ <span class="kn">from</span> <span class="nn">yourapplication.views.admin</span> <span class="kn">import</span> <span class="n">admin</span>
+ <span class="kn">from</span> <span class="nn">yourapplication.views.frontend</span> <span class="kn">import</span> <span class="n">frontend</span>
+ <span class="n">app</span><span class="o">.</span><span class="n">register_blueprint</span><span class="p">(</span><span class="n">admin</span><span class="p">)</span>
+ <span class="n">app</span><span class="o">.</span><span class="n">register_blueprint</span><span class="p">(</span><span class="n">frontend</span><span class="p">)</span>
+
+ <span class="k">return</span> <span class="n">app</span>
+</pre></div>
+</div>
+<p>The downside is that you cannot use the application object in the blueprints
+at import time. You can however use it from within a request. How do you
+get access to the application with the config? Use
+<a class="reference internal" href="../api.html#flask.current_app" title="flask.current_app"><tt class="xref py py-data docutils literal"><span class="pre">current_app</span></tt></a>:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">current_app</span><span class="p">,</span> <span class="n">Blueprint</span><span class="p">,</span> <span class="n">render_template</span>
+<span class="n">admin</span> <span class="o">=</span> <span class="n">Blueprint</span><span class="p">(</span><span class="s">&#39;admin&#39;</span><span class="p">,</span> <span class="n">__name__</span><span class="p">,</span> <span class="n">url_prefix</span><span class="o">=</span><span class="s">&#39;/admin&#39;</span><span class="p">)</span>
+
+<span class="nd">@admin.route</span><span class="p">(</span><span class="s">&#39;/&#39;</span><span class="p">)</span>
+<span class="k">def</span> <span class="nf">index</span><span class="p">():</span>
+ <span class="k">return</span> <span class="n">render_template</span><span class="p">(</span><span class="n">current_app</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s">&#39;INDEX_TEMPLATE&#39;</span><span class="p">])</span>
+</pre></div>
+</div>
+<p>Here we look up the name of a template in the config.</p>
+</div>
+<div class="section" id="using-applications">
+<h2>Using Applications<a class="headerlink" href="#using-applications" title="Permalink to this headline">¶</a></h2>
+<p>So to use such an application you then have to create the application
+first. Here an example <cite>run.py</cite> file that runs such an application:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">yourapplication</span> <span class="kn">import</span> <span class="n">create_app</span>
+<span class="n">app</span> <span class="o">=</span> <span class="n">create_app</span><span class="p">(</span><span class="s">&#39;/path/to/config.cfg&#39;</span><span class="p">)</span>
+<span class="n">app</span><span class="o">.</span><span class="n">run</span><span class="p">()</span>
+</pre></div>
+</div>
+</div>
+<div class="section" id="factory-improvements">
+<h2>Factory Improvements<a class="headerlink" href="#factory-improvements" title="Permalink to this headline">¶</a></h2>
+<p>The factory function from above is not very clever so far, you can improve
+it. The following changes are straightforward and possible:</p>
+<ol class="arabic simple">
+<li>make it possible to pass in configuration values for unittests so that
+you don&#8217;t have to create config files on the filesystem</li>
+<li>call a function from a blueprint when the application is setting up so
+that you have a place to modify attributes of the application (like
+hooking in before / after request handlers etc.)</li>
+<li>Add in WSGI middlewares when the application is creating if necessary.</li>
+</ol>
+</div>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="../index.html">
+ <img class="logo" src="../_static/flask.png" alt="Logo"/>
+</a></p>
+ <h3><a href="../index.html">Table Of Contents</a></h3>
+ <ul>
+<li><a class="reference internal" href="#">Application Factories</a><ul>
+<li><a class="reference internal" href="#basic-factories">Basic Factories</a></li>
+<li><a class="reference internal" href="#using-applications">Using Applications</a></li>
+<li><a class="reference internal" href="#factory-improvements">Factory Improvements</a></li>
+</ul>
+</li>
+</ul>
+<h3>Related Topics</h3>
+<ul>
+ <li><a href="../index.html">Documentation overview</a><ul>
+ <li><a href="index.html">Patterns for Flask</a><ul>
+ <li>Previous: <a href="packages.html" title="previous chapter">Larger Applications</a></li>
+ <li>Next: <a href="appdispatch.html" title="next chapter">Application Dispatching</a></li>
+ </ul></li>
+ </ul></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="../_sources/patterns/appfactories.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/patterns/caching.html b/app/static/doc/flask-docs/patterns/caching.html
new file mode 100644
index 0000000..ed0d3c1
--- /dev/null
+++ b/app/static/doc/flask-docs/patterns/caching.html
@@ -0,0 +1,178 @@
+
+<!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>Caching &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="../index.html" />
+ <link rel="up" title="Patterns for Flask" href="index.html" />
+ <link rel="next" title="View Decorators" href="viewdecorators.html" />
+ <link rel="prev" title="Uploading Files" href="fileuploads.html" />
+
+
+ <link rel="apple-touch-icon" href="../_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="../_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <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="viewdecorators.html" title="View Decorators"
+ accesskey="N">next</a> |</li>
+ <li class="right" >
+ <a href="fileuploads.html" title="Uploading Files"
+ accesskey="P">previous</a> |</li>
+ <li><a href="../index.html">Flask 0.8 documentation</a> &raquo;</li>
+ <li><a href="index.html" accesskey="U">Patterns for Flask</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="caching">
+<span id="caching-pattern"></span><h1>Caching<a class="headerlink" href="#caching" title="Permalink to this headline">¶</a></h1>
+<p>When your application runs slow, throw some caches in. Well, at least
+it&#8217;s the easiest way to speed up things. What does a cache do? Say you
+have a function that takes some time to complete but the results would
+still be good enough if they were 5 minutes old. So then the idea is that
+you actually put the result of that calculation into a cache for some
+time.</p>
+<p>Flask itself does not provide caching for you, but Werkzeug, one of the
+libraries it is based on, has some very basic cache support. It supports
+multiple cache backends, normally you want to use a memcached server.</p>
+<div class="section" id="setting-up-a-cache">
+<h2>Setting up a Cache<a class="headerlink" href="#setting-up-a-cache" title="Permalink to this headline">¶</a></h2>
+<p>You create a cache object once and keep it around, similar to how
+<a class="reference internal" href="../api.html#flask.Flask" title="flask.Flask"><tt class="xref py py-class docutils literal"><span class="pre">Flask</span></tt></a> objects are created. If you are using the
+development server you can create a
+<a class="reference external" href="http://werkzeug.pocoo.org/docs/contrib/cache/#werkzeug.contrib.cache.SimpleCache" title="(in Werkzeug v0.7)"><tt class="xref py py-class docutils literal"><span class="pre">SimpleCache</span></tt></a> object, that one is a simple
+cache that keeps the item stored in the memory of the Python interpreter:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">werkzeug.contrib.cache</span> <span class="kn">import</span> <span class="n">SimpleCache</span>
+<span class="n">cache</span> <span class="o">=</span> <span class="n">SimpleCache</span><span class="p">()</span>
+</pre></div>
+</div>
+<p>If you want to use memcached, make sure to have one of the memcache modules
+supported (you get them from <a class="reference external" href="http://pypi.python.org/">PyPI</a>) and a
+memcached server running somewhere. This is how you connect to such an
+memcached server then:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">werkzeug.contrib.cache</span> <span class="kn">import</span> <span class="n">MemcachedCache</span>
+<span class="n">cache</span> <span class="o">=</span> <span class="n">MemcachedCache</span><span class="p">([</span><span class="s">&#39;127.0.0.1:11211&#39;</span><span class="p">])</span>
+</pre></div>
+</div>
+<p>If you are using App Engine, you can connect to the App Engine memcache
+server easily:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">werkzeug.contrib.cache</span> <span class="kn">import</span> <span class="n">GAEMemcachedCache</span>
+<span class="n">cache</span> <span class="o">=</span> <span class="n">GAEMemcachedCache</span><span class="p">()</span>
+</pre></div>
+</div>
+</div>
+<div class="section" id="using-a-cache">
+<h2>Using a Cache<a class="headerlink" href="#using-a-cache" title="Permalink to this headline">¶</a></h2>
+<p>Now how can one use such a cache? There are two very important
+operations: <a class="reference external" href="http://werkzeug.pocoo.org/docs/contrib/cache/#werkzeug.contrib.cache.BaseCache.get" title="(in Werkzeug v0.7)"><tt class="xref py py-meth docutils literal"><span class="pre">get()</span></tt></a> and
+<a class="reference external" href="http://werkzeug.pocoo.org/docs/contrib/cache/#werkzeug.contrib.cache.BaseCache.set" title="(in Werkzeug v0.7)"><tt class="xref py py-meth docutils literal"><span class="pre">set()</span></tt></a>. This is how to use them:</p>
+<p>To get an item from the cache call
+<a class="reference external" href="http://werkzeug.pocoo.org/docs/contrib/cache/#werkzeug.contrib.cache.BaseCache.get" title="(in Werkzeug v0.7)"><tt class="xref py py-meth docutils literal"><span class="pre">get()</span></tt></a> with a string as key name.
+If something is in the cache, it is returned. Otherwise that function
+will return <cite>None</cite>:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="n">rv</span> <span class="o">=</span> <span class="n">cache</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;my-item&#39;</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>To add items to the cache, use the <a class="reference external" href="http://werkzeug.pocoo.org/docs/contrib/cache/#werkzeug.contrib.cache.BaseCache.set" title="(in Werkzeug v0.7)"><tt class="xref py py-meth docutils literal"><span class="pre">set()</span></tt></a>
+method instead. The first argument is the key and the second the value
+that should be set. Also a timeout can be provided after which the cache
+will automatically remove item.</p>
+<p>Here a full example how this looks like normally:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">def</span> <span class="nf">get_my_item</span><span class="p">():</span>
+ <span class="n">rv</span> <span class="o">=</span> <span class="n">cache</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;my-item&#39;</span><span class="p">)</span>
+ <span class="k">if</span> <span class="n">rv</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+ <span class="n">rv</span> <span class="o">=</span> <span class="n">calculate_value</span><span class="p">()</span>
+ <span class="n">cache</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s">&#39;my-item&#39;</span><span class="p">,</span> <span class="n">rv</span><span class="p">,</span> <span class="n">timeout</span><span class="o">=</span><span class="mi">5</span> <span class="o">*</span> <span class="mi">60</span><span class="p">)</span>
+ <span class="k">return</span> <span class="n">rv</span>
+</pre></div>
+</div>
+</div>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="../index.html">
+ <img class="logo" src="../_static/flask.png" alt="Logo"/>
+</a></p>
+ <h3><a href="../index.html">Table Of Contents</a></h3>
+ <ul>
+<li><a class="reference internal" href="#">Caching</a><ul>
+<li><a class="reference internal" href="#setting-up-a-cache">Setting up a Cache</a></li>
+<li><a class="reference internal" href="#using-a-cache">Using a Cache</a></li>
+</ul>
+</li>
+</ul>
+<h3>Related Topics</h3>
+<ul>
+ <li><a href="../index.html">Documentation overview</a><ul>
+ <li><a href="index.html">Patterns for Flask</a><ul>
+ <li>Previous: <a href="fileuploads.html" title="previous chapter">Uploading Files</a></li>
+ <li>Next: <a href="viewdecorators.html" title="next chapter">View Decorators</a></li>
+ </ul></li>
+ </ul></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="../_sources/patterns/caching.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/patterns/deferredcallbacks.html b/app/static/doc/flask-docs/patterns/deferredcallbacks.html
new file mode 100644
index 0000000..32b6b79
--- /dev/null
+++ b/app/static/doc/flask-docs/patterns/deferredcallbacks.html
@@ -0,0 +1,180 @@
+
+<!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>Deferred Request Callbacks &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="../index.html" />
+ <link rel="up" title="Patterns for Flask" href="index.html" />
+ <link rel="next" title="Deployment Options" href="../deploying/index.html" />
+ <link rel="prev" title="Streaming Contents" href="streaming.html" />
+
+
+ <link rel="apple-touch-icon" href="../_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="../_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <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="../deploying/index.html" title="Deployment Options"
+ accesskey="N">next</a> |</li>
+ <li class="right" >
+ <a href="streaming.html" title="Streaming Contents"
+ accesskey="P">previous</a> |</li>
+ <li><a href="../index.html">Flask 0.8 documentation</a> &raquo;</li>
+ <li><a href="index.html" accesskey="U">Patterns for Flask</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="deferred-request-callbacks">
+<span id="deferred-callbacks"></span><h1>Deferred Request Callbacks<a class="headerlink" href="#deferred-request-callbacks" title="Permalink to this headline">¶</a></h1>
+<p>One of the design principles of Flask is that response objects are created
+and passed down a chain of potential callbacks that can modify them or
+replace them. When the request handling starts, there is no response
+object yet. It is created as necessary either by a view function or by
+some other component in the system.</p>
+<p>But what happens if you want to modify the response at a point where the
+response does not exist yet? A common example for that would be a
+before-request function that wants to set a cookie on the response object.</p>
+<p>One way is to avoid the situation. Very often that is possible. For
+instance you can try to move that logic into an after-request callback
+instead. Sometimes however moving that code there is just not a very
+pleasant experience or makes code look very awkward.</p>
+<p>As an alternative possibility you can attach a bunch of callback functions
+to the <a class="reference internal" href="../api.html#flask.g" title="flask.g"><tt class="xref py py-data docutils literal"><span class="pre">g</span></tt></a> object and call then at the end of the request.
+This way you can defer code execution from anywhere in the application.</p>
+<div class="section" id="the-decorator">
+<h2>The Decorator<a class="headerlink" href="#the-decorator" title="Permalink to this headline">¶</a></h2>
+<p>The following decorator is the key. It registers a function on a list on
+the <a class="reference internal" href="../api.html#flask.g" title="flask.g"><tt class="xref py py-data docutils literal"><span class="pre">g</span></tt></a> object:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">g</span>
+
+<span class="k">def</span> <span class="nf">after_this_request</span><span class="p">(</span><span class="n">f</span><span class="p">):</span>
+ <span class="k">if</span> <span class="ow">not</span> <span class="nb">hasattr</span><span class="p">(</span><span class="n">g</span><span class="p">,</span> <span class="s">&#39;after_request_callbacks&#39;</span><span class="p">):</span>
+ <span class="n">g</span><span class="o">.</span><span class="n">after_request_callbacks</span> <span class="o">=</span> <span class="p">[]</span>
+ <span class="n">g</span><span class="o">.</span><span class="n">after_request_callbacks</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">f</span><span class="p">)</span>
+ <span class="k">return</span> <span class="n">f</span>
+</pre></div>
+</div>
+</div>
+<div class="section" id="calling-the-deferred">
+<h2>Calling the Deferred<a class="headerlink" href="#calling-the-deferred" title="Permalink to this headline">¶</a></h2>
+<p>Now you can use the <cite>after_this_request</cite> decorator to mark a function to
+be called at the end of the request. But we still need to call them. For
+this the following function needs to be registered as
+<a class="reference internal" href="../api.html#flask.Flask.after_request" title="flask.Flask.after_request"><tt class="xref py py-meth docutils literal"><span class="pre">after_request()</span></tt></a> callback:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="nd">@app.after_request</span>
+<span class="k">def</span> <span class="nf">call_after_request_callbacks</span><span class="p">(</span><span class="n">response</span><span class="p">):</span>
+ <span class="k">for</span> <span class="n">callback</span> <span class="ow">in</span> <span class="nb">getattr</span><span class="p">(</span><span class="n">g</span><span class="p">,</span> <span class="s">&#39;after_request_callbacks&#39;</span><span class="p">,</span> <span class="p">()):</span>
+ <span class="n">response</span> <span class="o">=</span> <span class="n">callback</span><span class="p">(</span><span class="n">response</span><span class="p">)</span>
+ <span class="k">return</span> <span class="n">response</span>
+</pre></div>
+</div>
+</div>
+<div class="section" id="a-practical-example">
+<h2>A Practical Example<a class="headerlink" href="#a-practical-example" title="Permalink to this headline">¶</a></h2>
+<p>Now we can easily at any point in time register a function to be called at
+the end of this particular request. For example you can remember the
+current language of the user in a cookie in the before-request function:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">request</span>
+
+<span class="nd">@app.before_request</span>
+<span class="k">def</span> <span class="nf">detect_user_language</span><span class="p">():</span>
+ <span class="n">language</span> <span class="o">=</span> <span class="n">request</span><span class="o">.</span><span class="n">cookies</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;user_lang&#39;</span><span class="p">)</span>
+ <span class="k">if</span> <span class="n">language</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+ <span class="n">language</span> <span class="o">=</span> <span class="n">guess_language_from_request</span><span class="p">()</span>
+ <span class="nd">@after_this_request</span>
+ <span class="k">def</span> <span class="nf">remember_language</span><span class="p">(</span><span class="n">response</span><span class="p">):</span>
+ <span class="n">response</span><span class="o">.</span><span class="n">set_cookie</span><span class="p">(</span><span class="s">&#39;user_lang&#39;</span><span class="p">,</span> <span class="n">language</span><span class="p">)</span>
+ <span class="n">g</span><span class="o">.</span><span class="n">language</span> <span class="o">=</span> <span class="n">language</span>
+</pre></div>
+</div>
+</div>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="../index.html">
+ <img class="logo" src="../_static/flask.png" alt="Logo"/>
+</a></p>
+ <h3><a href="../index.html">Table Of Contents</a></h3>
+ <ul>
+<li><a class="reference internal" href="#">Deferred Request Callbacks</a><ul>
+<li><a class="reference internal" href="#the-decorator">The Decorator</a></li>
+<li><a class="reference internal" href="#calling-the-deferred">Calling the Deferred</a></li>
+<li><a class="reference internal" href="#a-practical-example">A Practical Example</a></li>
+</ul>
+</li>
+</ul>
+<h3>Related Topics</h3>
+<ul>
+ <li><a href="../index.html">Documentation overview</a><ul>
+ <li><a href="index.html">Patterns for Flask</a><ul>
+ <li>Previous: <a href="streaming.html" title="previous chapter">Streaming Contents</a></li>
+ <li>Next: <a href="../deploying/index.html" title="next chapter">Deployment Options</a></li>
+ </ul></li>
+ </ul></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="../_sources/patterns/deferredcallbacks.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/patterns/distribute.html b/app/static/doc/flask-docs/patterns/distribute.html
new file mode 100644
index 0000000..8987a18
--- /dev/null
+++ b/app/static/doc/flask-docs/patterns/distribute.html
@@ -0,0 +1,254 @@
+
+<!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>Deploying with Distribute &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="../index.html" />
+ <link rel="up" title="Patterns for Flask" href="index.html" />
+ <link rel="next" title="Deploying with Fabric" href="fabric.html" />
+ <link rel="prev" title="Using URL Processors" href="urlprocessors.html" />
+
+
+ <link rel="apple-touch-icon" href="../_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="../_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <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="fabric.html" title="Deploying with Fabric"
+ accesskey="N">next</a> |</li>
+ <li class="right" >
+ <a href="urlprocessors.html" title="Using URL Processors"
+ accesskey="P">previous</a> |</li>
+ <li><a href="../index.html">Flask 0.8 documentation</a> &raquo;</li>
+ <li><a href="index.html" accesskey="U">Patterns for Flask</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="deploying-with-distribute">
+<span id="distribute-deployment"></span><h1>Deploying with Distribute<a class="headerlink" href="#deploying-with-distribute" title="Permalink to this headline">¶</a></h1>
+<p><a class="reference external" href="http://pypi.python.org/pypi/distribute">distribute</a>, formerly setuptools, is an extension library that is
+commonly used to (like the name says) distribute Python libraries and
+extensions. It extends distutils, a basic module installation system
+shipped with Python to also support various more complex constructs that
+make larger applications easier to distribute:</p>
+<ul class="simple">
+<li><strong>support for dependencies</strong>: a library or application can declare a
+list of other libraries it depends on which will be installed
+automatically for you.</li>
+<li><strong>package registry</strong>: setuptools registers your package with your
+Python installation. This makes it possible to query information
+provided by one package from another package. The best known feature of
+this system is the entry point support which allows one package to
+declare an &#8220;entry point&#8221; another package can hook into to extend the
+other package.</li>
+<li><strong>installation manager</strong>: <cite>easy_install</cite>, which comes with distribute
+can install other libraries for you. You can also use <a class="reference external" href="http://pypi.python.org/pypi/pip">pip</a> which
+sooner or later will replace <cite>easy_install</cite> which does more than just
+installing packages for you.</li>
+</ul>
+<p>Flask itself, and all the libraries you can find on the cheeseshop
+are distributed with either distribute, the older setuptools or distutils.</p>
+<p>In this case we assume your application is called
+<cite>yourapplication.py</cite> and you are not using a module, but a <a class="reference internal" href="packages.html#larger-applications"><em>package</em></a>. Distributing resources with standard modules is
+not supported by <a class="reference external" href="http://pypi.python.org/pypi/distribute">distribute</a> so we will not bother with it. If you have
+not yet converted your application into a package, head over to the
+<a class="reference internal" href="packages.html#larger-applications"><em>Larger Applications</em></a> pattern to see how this can be done.</p>
+<p>A working deployment with distribute is the first step into more complex
+and more automated deployment scenarios. If you want to fully automate
+the process, also read the <a class="reference internal" href="fabric.html#fabric-deployment"><em>Deploying with Fabric</em></a> chapter.</p>
+<div class="section" id="basic-setup-script">
+<h2>Basic Setup Script<a class="headerlink" href="#basic-setup-script" title="Permalink to this headline">¶</a></h2>
+<p>Because you have Flask running, you either have setuptools or distribute
+available on your system anyways. If you do not, fear not, there is a
+script to install it for you: <a class="reference external" href="http://python-distribute.org/distribute_setup.py">distribute_setup.py</a>. Just download and
+run with your Python interpreter.</p>
+<p>Standard disclaimer applies: <a class="reference internal" href="../installation.html#virtualenv"><em>you better use a virtualenv</em></a>.</p>
+<p>Your setup code always goes into a file named <cite>setup.py</cite> next to your
+application. The name of the file is only convention, but because
+everybody will look for a file with that name, you better not change it.</p>
+<p>Yes, even if you are using <cite>distribute</cite>, you are importing from a package
+called <cite>setuptools</cite>. <cite>distribute</cite> is fully backwards compatible with
+<cite>setuptools</cite>, so it also uses the same import name.</p>
+<p>A basic <cite>setup.py</cite> file for a Flask application looks like this:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">setuptools</span> <span class="kn">import</span> <span class="n">setup</span>
+
+<span class="n">setup</span><span class="p">(</span>
+ <span class="n">name</span><span class="o">=</span><span class="s">&#39;Your Application&#39;</span><span class="p">,</span>
+ <span class="n">version</span><span class="o">=</span><span class="s">&#39;1.0&#39;</span><span class="p">,</span>
+ <span class="n">long_description</span><span class="o">=</span><span class="n">__doc__</span><span class="p">,</span>
+ <span class="n">packages</span><span class="o">=</span><span class="p">[</span><span class="s">&#39;yourapplication&#39;</span><span class="p">],</span>
+ <span class="n">include_package_data</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span>
+ <span class="n">zip_safe</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span>
+ <span class="n">install_requires</span><span class="o">=</span><span class="p">[</span><span class="s">&#39;Flask&#39;</span><span class="p">]</span>
+<span class="p">)</span>
+</pre></div>
+</div>
+<p>Please keep in mind that you have to list subpackages explicitly. If you
+want distribute to lookup the packages for you automatically, you can use
+the <cite>find_packages</cite> function:</p>
+<div class="highlight-python"><pre>from setuptools import setup, find_packages
+
+setup(
+ ...
+ packages=find_packages()
+)</pre>
+</div>
+<p>Most parameters to the <cite>setup</cite> function should be self explanatory,
+<cite>include_package_data</cite> and <cite>zip_safe</cite> might not be.
+<cite>include_package_data</cite> tells distribute to look for a <cite>MANIFEST.in</cite> file
+and install all the entries that match as package data. We will use this
+to distribute the static files and templates along with the Python module
+(see <a class="reference internal" href="#distributing-resources"><em>Distributing Resources</em></a>). The <cite>zip_safe</cite> flag can be used to
+force or prevent zip Archive creation. In general you probably don&#8217;t want
+your packages to be installed as zip files because some tools do not
+support them and they make debugging a lot harder.</p>
+</div>
+<div class="section" id="distributing-resources">
+<span id="id1"></span><h2>Distributing Resources<a class="headerlink" href="#distributing-resources" title="Permalink to this headline">¶</a></h2>
+<p>If you try to install the package you just created, you will notice that
+folders like <cite>static</cite> or <cite>templates</cite> are not installed for you. The
+reason for this is that distribute does not know which files to add for
+you. What you should do, is to create a <cite>MANIFEST.in</cite> file next to your
+<cite>setup.py</cite> file. This file lists all the files that should be added to
+your tarball:</p>
+<div class="highlight-python"><pre>recursive-include yourapplication/templates *
+recursive-include yourapplication/static *</pre>
+</div>
+<p>Don&#8217;t forget that even if you enlist them in your <cite>MANIFEST.in</cite> file, they
+won&#8217;t be installed for you unless you set the <cite>include_package_data</cite>
+parameter of the <cite>setup</cite> function to <cite>True</cite>!</p>
+</div>
+<div class="section" id="declaring-dependencies">
+<h2>Declaring Dependencies<a class="headerlink" href="#declaring-dependencies" title="Permalink to this headline">¶</a></h2>
+<p>Dependencies are declared in the <cite>install_requires</cite> parameter as list.
+Each item in that list is the name of a package that should be pulled from
+PyPI on installation. By default it will always use the most recent
+version, but you can also provide minimum and maximum version
+requirements. Here some examples:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="n">install_requires</span><span class="o">=</span><span class="p">[</span>
+ <span class="s">&#39;Flask&gt;=0.2&#39;</span><span class="p">,</span>
+ <span class="s">&#39;SQLAlchemy&gt;=0.6&#39;</span><span class="p">,</span>
+ <span class="s">&#39;BrokenPackage&gt;=0.7,&lt;=1.0&#39;</span>
+<span class="p">]</span>
+</pre></div>
+</div>
+<p>I mentioned earlier that dependencies are pulled from PyPI. What if you
+want to depend on a package that cannot be found on PyPI and won&#8217;t be
+because it is an internal package you don&#8217;t want to share with anyone?
+Just still do as if there was a PyPI entry for it and provide a list of
+alternative locations where distribute should look for tarballs:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="n">dependency_links</span><span class="o">=</span><span class="p">[</span><span class="s">&#39;http://example.com/yourfiles&#39;</span><span class="p">]</span>
+</pre></div>
+</div>
+<p>Make sure that page has a directory listing and the links on the page are
+pointing to the actual tarballs with their correct filenames as this is
+how distribute will find the files. If you have an internal company
+server that contains the packages, provide the URL to that server there.</p>
+</div>
+<div class="section" id="installing-developing">
+<h2>Installing / Developing<a class="headerlink" href="#installing-developing" title="Permalink to this headline">¶</a></h2>
+<p>To install your application (ideally into a virtualenv) just run the
+<cite>setup.py</cite> script with the <cite>install</cite> parameter. It will install your
+application into the virtualenv&#8217;s site-packages folder and also download
+and install all dependencies:</p>
+<div class="highlight-python"><pre>$ python setup.py install</pre>
+</div>
+<p>If you are developing on the package and also want the requirements to be
+installed, you can use the <cite>develop</cite> command instead:</p>
+<div class="highlight-python"><pre>$ python setup.py develop</pre>
+</div>
+<p>This has the advantage of just installing a link to the site-packages
+folder instead of copying the data over. You can then continue to work on
+the code without having to run <cite>install</cite> again after each change.</p>
+</div>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="../index.html">
+ <img class="logo" src="../_static/flask.png" alt="Logo"/>
+</a></p>
+ <h3><a href="../index.html">Table Of Contents</a></h3>
+ <ul>
+<li><a class="reference internal" href="#">Deploying with Distribute</a><ul>
+<li><a class="reference internal" href="#basic-setup-script">Basic Setup Script</a></li>
+<li><a class="reference internal" href="#distributing-resources">Distributing Resources</a></li>
+<li><a class="reference internal" href="#declaring-dependencies">Declaring Dependencies</a></li>
+<li><a class="reference internal" href="#installing-developing">Installing / Developing</a></li>
+</ul>
+</li>
+</ul>
+<h3>Related Topics</h3>
+<ul>
+ <li><a href="../index.html">Documentation overview</a><ul>
+ <li><a href="index.html">Patterns for Flask</a><ul>
+ <li>Previous: <a href="urlprocessors.html" title="previous chapter">Using URL Processors</a></li>
+ <li>Next: <a href="fabric.html" title="next chapter">Deploying with Fabric</a></li>
+ </ul></li>
+ </ul></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="../_sources/patterns/distribute.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/patterns/errorpages.html b/app/static/doc/flask-docs/patterns/errorpages.html
new file mode 100644
index 0000000..820e271
--- /dev/null
+++ b/app/static/doc/flask-docs/patterns/errorpages.html
@@ -0,0 +1,182 @@
+
+<!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>Custom Error Pages &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="../index.html" />
+ <link rel="up" title="Patterns for Flask" href="index.html" />
+ <link rel="next" title="Lazily Loading Views" href="lazyloading.html" />
+ <link rel="prev" title="AJAX with jQuery" href="jquery.html" />
+
+
+ <link rel="apple-touch-icon" href="../_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="../_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <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="lazyloading.html" title="Lazily Loading Views"
+ accesskey="N">next</a> |</li>
+ <li class="right" >
+ <a href="jquery.html" title="AJAX with jQuery"
+ accesskey="P">previous</a> |</li>
+ <li><a href="../index.html">Flask 0.8 documentation</a> &raquo;</li>
+ <li><a href="index.html" accesskey="U">Patterns for Flask</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="custom-error-pages">
+<h1>Custom Error Pages<a class="headerlink" href="#custom-error-pages" title="Permalink to this headline">¶</a></h1>
+<p>Flask comes with a handy <a class="reference internal" href="../api.html#flask.abort" title="flask.abort"><tt class="xref py py-func docutils literal"><span class="pre">abort()</span></tt></a> function that aborts a
+request with an HTTP error code early. It will also provide a plain black
+and white error page for you with a basic description, but nothing fancy.</p>
+<p>Depending on the error code it is less or more likely for the user to
+actually see such an error.</p>
+<div class="section" id="common-error-codes">
+<h2>Common Error Codes<a class="headerlink" href="#common-error-codes" title="Permalink to this headline">¶</a></h2>
+<p>The following error codes are some that are often displayed to the user,
+even if the application behaves correctly:</p>
+<dl class="docutils">
+<dt><em>404 Not Found</em></dt>
+<dd>The good old &#8220;chap, you made a mistake typing that URL&#8221; message. So
+common that even novices to the internet know that 404 means: damn,
+the thing I was looking for is not there. It&#8217;s a very good idea to
+make sure there is actually something useful on a 404 page, at least a
+link back to the index.</dd>
+<dt><em>403 Forbidden</em></dt>
+<dd>If you have some kind of access control on your website, you will have
+to send a 403 code for disallowed resources. So make sure the user
+is not lost when they try to access a forbidden resource.</dd>
+<dt><em>410 Gone</em></dt>
+<dd>Did you know that there the &#8220;404 Not Found&#8221; has a brother named &#8220;410
+Gone&#8221;? Few people actually implement that, but the idea is that
+resources that previously existed and got deleted answer with 410
+instead of 404. If you are not deleting documents permanently from
+the database but just mark them as deleted, do the user a favour and
+use the 410 code instead and display a message that what they were
+looking for was deleted for all eternity.</dd>
+<dt><em>500 Internal Server Error</em></dt>
+<dd>Usually happens on programming errors or if the server is overloaded.
+A terrible good idea to have a nice page there, because your
+application <em>will</em> fail sooner or later (see also:
+<a class="reference internal" href="../errorhandling.html#application-errors"><em>Handling Application Errors</em></a>).</dd>
+</dl>
+</div>
+<div class="section" id="error-handlers">
+<h2>Error Handlers<a class="headerlink" href="#error-handlers" title="Permalink to this headline">¶</a></h2>
+<p>An error handler is a function, just like a view function, but it is
+called when an error happens and is passed that error. The error is most
+likely a <a class="reference external" href="http://werkzeug.pocoo.org/docs/exceptions/#werkzeug.exceptions.HTTPException" title="(in Werkzeug v0.7)"><tt class="xref py py-exc docutils literal"><span class="pre">HTTPException</span></tt></a>, but in one case it
+can be a different error: a handler for internal server errors will be
+passed other exception instances as well if they are uncaught.</p>
+<p>An error handler is registered with the <a class="reference internal" href="../api.html#flask.Flask.errorhandler" title="flask.Flask.errorhandler"><tt class="xref py py-meth docutils literal"><span class="pre">errorhandler()</span></tt></a>
+decorator and the error code of the exception. Keep in mind that Flask
+will <em>not</em> set the error code for you, so make sure to also provide the
+HTTP status code when returning a response.</p>
+<p>Here an example implementation for a &#8220;404 Page Not Found&#8221; exception:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">render_template</span>
+
+<span class="nd">@app.errorhandler</span><span class="p">(</span><span class="mi">404</span><span class="p">)</span>
+<span class="k">def</span> <span class="nf">page_not_found</span><span class="p">(</span><span class="n">e</span><span class="p">):</span>
+ <span class="k">return</span> <span class="n">render_template</span><span class="p">(</span><span class="s">&#39;404.html&#39;</span><span class="p">),</span> <span class="mi">404</span>
+</pre></div>
+</div>
+<p>An example template might be this:</p>
+<div class="highlight-html+jinja"><div class="highlight"><pre><span class="cp">{%</span> <span class="k">extends</span> <span class="s2">&quot;layout.html&quot;</span> <span class="cp">%}</span>
+<span class="cp">{%</span> <span class="k">block</span> <span class="nv">title</span> <span class="cp">%}</span>Page Not Found<span class="cp">{%</span> <span class="k">endblock</span> <span class="cp">%}</span>
+<span class="cp">{%</span> <span class="k">block</span> <span class="nv">body</span> <span class="cp">%}</span>
+ <span class="nt">&lt;h1&gt;</span>Page Not Found<span class="nt">&lt;/h1&gt;</span>
+ <span class="nt">&lt;p&gt;</span>What you were looking for is just not there.
+ <span class="nt">&lt;p&gt;&lt;a</span> <span class="na">href=</span><span class="s">&quot;</span><span class="cp">{{</span> <span class="nv">url_for</span><span class="o">(</span><span class="s1">&#39;index&#39;</span><span class="o">)</span> <span class="cp">}}</span><span class="s">&quot;</span><span class="nt">&gt;</span>go somewhere nice<span class="nt">&lt;/a&gt;</span>
+<span class="cp">{%</span> <span class="k">endblock</span> <span class="cp">%}</span>
+</pre></div>
+</div>
+</div>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="../index.html">
+ <img class="logo" src="../_static/flask.png" alt="Logo"/>
+</a></p>
+ <h3><a href="../index.html">Table Of Contents</a></h3>
+ <ul>
+<li><a class="reference internal" href="#">Custom Error Pages</a><ul>
+<li><a class="reference internal" href="#common-error-codes">Common Error Codes</a></li>
+<li><a class="reference internal" href="#error-handlers">Error Handlers</a></li>
+</ul>
+</li>
+</ul>
+<h3>Related Topics</h3>
+<ul>
+ <li><a href="../index.html">Documentation overview</a><ul>
+ <li><a href="index.html">Patterns for Flask</a><ul>
+ <li>Previous: <a href="jquery.html" title="previous chapter">AJAX with jQuery</a></li>
+ <li>Next: <a href="lazyloading.html" title="next chapter">Lazily Loading Views</a></li>
+ </ul></li>
+ </ul></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="../_sources/patterns/errorpages.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/patterns/fabric.html b/app/static/doc/flask-docs/patterns/fabric.html
new file mode 100644
index 0000000..9949480
--- /dev/null
+++ b/app/static/doc/flask-docs/patterns/fabric.html
@@ -0,0 +1,298 @@
+
+<!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>Deploying with Fabric &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="../index.html" />
+ <link rel="up" title="Patterns for Flask" href="index.html" />
+ <link rel="next" title="Using SQLite 3 with Flask" href="sqlite3.html" />
+ <link rel="prev" title="Deploying with Distribute" href="distribute.html" />
+
+
+ <link rel="apple-touch-icon" href="../_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="../_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <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="sqlite3.html" title="Using SQLite 3 with Flask"
+ accesskey="N">next</a> |</li>
+ <li class="right" >
+ <a href="distribute.html" title="Deploying with Distribute"
+ accesskey="P">previous</a> |</li>
+ <li><a href="../index.html">Flask 0.8 documentation</a> &raquo;</li>
+ <li><a href="index.html" accesskey="U">Patterns for Flask</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="deploying-with-fabric">
+<span id="fabric-deployment"></span><h1>Deploying with Fabric<a class="headerlink" href="#deploying-with-fabric" title="Permalink to this headline">¶</a></h1>
+<p><a class="reference external" href="http://fabfile.org/">Fabric</a> is a tool for Python similar to Makefiles but with the ability
+to execute commands on a remote server. In combination with a properly
+set up Python package (<a class="reference internal" href="packages.html#larger-applications"><em>Larger Applications</em></a>) and a good concept for
+configurations (<a class="reference internal" href="../config.html#config"><em>Configuration Handling</em></a>) it is very easy to deploy Flask
+applications to external servers.</p>
+<p>Before we get started, here a quick checklist of things we have to ensure
+upfront:</p>
+<ul class="simple">
+<li>Fabric 1.0 has to be installed locally. This tutorial assumes the
+latest version of Fabric.</li>
+<li>The application already has to be a package and requires a working
+<cite>setup.py</cite> file (<a class="reference internal" href="distribute.html#distribute-deployment"><em>Deploying with Distribute</em></a>).</li>
+<li>In the following example we are using <cite>mod_wsgi</cite> for the remote
+servers. You can of course use your own favourite server there, but
+for this example we chose Apache + <cite>mod_wsgi</cite> because it&#8217;s very easy
+to setup and has a simple way to reload applications without root
+access.</li>
+</ul>
+<div class="section" id="creating-the-first-fabfile">
+<h2>Creating the first Fabfile<a class="headerlink" href="#creating-the-first-fabfile" title="Permalink to this headline">¶</a></h2>
+<p>A fabfile is what controls what Fabric executes. It is named <cite>fabfile.py</cite>
+and executed by the <cite>fab</cite> command. All the functions defined in that file
+will show up as <cite>fab</cite> subcommands. They are executed on one or more
+hosts. These hosts can be defined either in the fabfile or on the command
+line. In this case we will add them to the fabfile.</p>
+<p>This is a basic first example that has the ability to upload the current
+sourcecode to the server and install it into a pre-existing
+virtual environment:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">fabric.api</span> <span class="kn">import</span> <span class="o">*</span>
+
+<span class="c"># the user to use for the remote commands</span>
+<span class="n">env</span><span class="o">.</span><span class="n">user</span> <span class="o">=</span> <span class="s">&#39;appuser&#39;</span>
+<span class="c"># the servers where the commands are executed</span>
+<span class="n">env</span><span class="o">.</span><span class="n">hosts</span> <span class="o">=</span> <span class="p">[</span><span class="s">&#39;server1.example.com&#39;</span><span class="p">,</span> <span class="s">&#39;server2.example.com&#39;</span><span class="p">]</span>
+
+<span class="k">def</span> <span class="nf">pack</span><span class="p">():</span>
+ <span class="c"># create a new source distribution as tarball</span>
+ <span class="n">local</span><span class="p">(</span><span class="s">&#39;python setup.py sdist --formats=gztar&#39;</span><span class="p">,</span> <span class="n">capture</span><span class="o">=</span><span class="bp">False</span><span class="p">)</span>
+
+<span class="k">def</span> <span class="nf">deploy</span><span class="p">():</span>
+ <span class="c"># figure out the release name and version</span>
+ <span class="n">dist</span> <span class="o">=</span> <span class="n">local</span><span class="p">(</span><span class="s">&#39;python setup.py --fullname&#39;</span><span class="p">,</span> <span class="n">capture</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
+ <span class="c"># upload the source tarball to the temporary folder on the server</span>
+ <span class="n">put</span><span class="p">(</span><span class="s">&#39;dist/</span><span class="si">%s</span><span class="s">.tar.gz&#39;</span> <span class="o">%</span> <span class="n">dist</span><span class="p">,</span> <span class="s">&#39;/tmp/yourapplication.tar.gz&#39;</span><span class="p">)</span>
+ <span class="c"># create a place where we can unzip the tarball, then enter</span>
+ <span class="c"># that directory and unzip it</span>
+ <span class="n">run</span><span class="p">(</span><span class="s">&#39;mkdir /tmp/yourapplication&#39;</span><span class="p">)</span>
+ <span class="k">with</span> <span class="n">cd</span><span class="p">(</span><span class="s">&#39;/tmp/yourapplication&#39;</span><span class="p">):</span>
+ <span class="n">run</span><span class="p">(</span><span class="s">&#39;tar xzf /tmp/yourapplication.tar.gz&#39;</span><span class="p">)</span>
+ <span class="c"># now setup the package with our virtual environment&#39;s</span>
+ <span class="c"># python interpreter</span>
+ <span class="n">run</span><span class="p">(</span><span class="s">&#39;/var/www/yourapplication/env/bin/python setup.py install&#39;</span><span class="p">)</span>
+ <span class="c"># now that all is set up, delete the folder again</span>
+ <span class="n">run</span><span class="p">(</span><span class="s">&#39;rm -rf /tmp/yourapplication /tmp/yourapplication.tar.gz&#39;</span><span class="p">)</span>
+ <span class="c"># and finally touch the .wsgi file so that mod_wsgi triggers</span>
+ <span class="c"># a reload of the application</span>
+ <span class="n">run</span><span class="p">(</span><span class="s">&#39;touch /var/www/yourapplication.wsgi&#39;</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>The example above is well documented and should be straightforward. Here
+a recap of the most common commands fabric provides:</p>
+<ul class="simple">
+<li><cite>run</cite> - executes a command on a remote server</li>
+<li><cite>local</cite> - executes a command on the local machine</li>
+<li><cite>put</cite> - uploads a file to the remote server</li>
+<li><cite>cd</cite> - changes the directory on the serverside. This has to be used
+in combination with the <cite>with</cite> statement.</li>
+</ul>
+</div>
+<div class="section" id="running-fabfiles">
+<h2>Running Fabfiles<a class="headerlink" href="#running-fabfiles" title="Permalink to this headline">¶</a></h2>
+<p>Now how do you execute that fabfile? You use the <cite>fab</cite> command. To
+deploy the current version of the code on the remote server you would use
+this command:</p>
+<div class="highlight-python"><pre>$ fab pack deploy</pre>
+</div>
+<p>However this requires that our server already has the
+<tt class="docutils literal"><span class="pre">/var/www/yourapplication</span></tt> folder created and
+<tt class="docutils literal"><span class="pre">/var/www/yourapplication/env</span></tt> to be a virtual environment. Furthermore
+are we not creating the configuration or <cite>.wsgi</cite> file on the server. So
+how do we bootstrap a new server into our infrastructure?</p>
+<p>This now depends on the number of servers we want to set up. If we just
+have one application server (which the majority of applications will
+have), creating a command in the fabfile for this is overkill. But
+obviously you can do that. In that case you would probably call it
+<cite>setup</cite> or <cite>bootstrap</cite> and then pass the servername explicitly on the
+command line:</p>
+<div class="highlight-python"><pre>$ fab -H newserver.example.com bootstrap</pre>
+</div>
+<p>To setup a new server you would roughly do these steps:</p>
+<ol class="arabic">
+<li><p class="first">Create the directory structure in <tt class="docutils literal"><span class="pre">/var/www</span></tt>:</p>
+<div class="highlight-python"><pre>$ mkdir /var/www/yourapplication
+$ cd /var/www/yourapplication
+$ virtualenv --distribute env</pre>
+</div>
+</li>
+<li><p class="first">Upload a new <cite>application.wsgi</cite> file to the server and the
+configuration file for the application (eg: <cite>application.cfg</cite>)</p>
+</li>
+<li><p class="first">Create a new Apache config for <cite>yourapplication</cite> and activate it.
+Make sure to activate watching for changes of the <cite>.wsgi</cite> file so
+that we can automatically reload the application by touching it.
+(See <a class="reference internal" href="../deploying/mod_wsgi.html#mod-wsgi-deployment"><em>mod_wsgi (Apache)</em></a> for more information)</p>
+</li>
+</ol>
+<p>So now the question is, where do the <cite>application.wsgi</cite> and
+<cite>application.cfg</cite> files come from?</p>
+</div>
+<div class="section" id="the-wsgi-file">
+<h2>The WSGI File<a class="headerlink" href="#the-wsgi-file" title="Permalink to this headline">¶</a></h2>
+<p>The WSGI file has to import the application and also to set an environment
+variable so that the application knows where to look for the config. This
+is a short example that does exactly that:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">os</span>
+<span class="n">os</span><span class="o">.</span><span class="n">environ</span><span class="p">[</span><span class="s">&#39;YOURAPPLICATION_CONFIG&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&#39;/var/www/yourapplication/application.cfg&#39;</span>
+<span class="kn">from</span> <span class="nn">yourapplication</span> <span class="kn">import</span> <span class="n">app</span>
+</pre></div>
+</div>
+<p>The application itself then has to initialize itself like this to look for
+the config at that environment variable:</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">app</span><span class="o">.</span><span class="n">config</span><span class="o">.</span><span class="n">from_object</span><span class="p">(</span><span class="s">&#39;yourapplication.default_config&#39;</span><span class="p">)</span>
+<span class="n">app</span><span class="o">.</span><span class="n">config</span><span class="o">.</span><span class="n">from_envvar</span><span class="p">(</span><span class="s">&#39;YOURAPPLICATION_CONFIG&#39;</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>This approach is explained in detail in the <a class="reference internal" href="../config.html#config"><em>Configuration Handling</em></a> section of the
+documentation.</p>
+</div>
+<div class="section" id="the-configuration-file">
+<h2>The Configuration File<a class="headerlink" href="#the-configuration-file" title="Permalink to this headline">¶</a></h2>
+<p>Now as mentioned above, the application will find the correct
+configuration file by looking up the <cite>YOURAPPLICATION_CONFIG</cite> environment
+variable. So we have to put the configuration in a place where the
+application will able to find it. Configuration files have the unfriendly
+quality of being different on all computers, so you do not version them
+usually.</p>
+<p>A popular approach is to store configuration files for different servers
+in a separate version control repository and check them out on all
+servers. Then symlink the file that is active for the server into the
+location where it&#8217;s expected (eg: <tt class="docutils literal"><span class="pre">/var/www/yourapplication</span></tt>).</p>
+<p>Either way, in our case here we only expect one or two servers and we can
+upload them ahead of time by hand.</p>
+</div>
+<div class="section" id="first-deployment">
+<h2>First Deployment<a class="headerlink" href="#first-deployment" title="Permalink to this headline">¶</a></h2>
+<p>Now we can do our first deployment. We have set up the servers so that
+they have their virtual environments and activated apache configs. Now we
+can pack up the application and deploy it:</p>
+<div class="highlight-python"><pre>$ fab pack deploy</pre>
+</div>
+<p>Fabric will now connect to all servers and run the commands as written
+down in the fabfile. First it will execute pack so that we have our
+tarball ready and then it will execute deploy and upload the source code
+to all servers and install it there. Thanks to the <cite>setup.py</cite> file we
+will automatically pull in the required libraries into our virtual
+environment.</p>
+</div>
+<div class="section" id="next-steps">
+<h2>Next Steps<a class="headerlink" href="#next-steps" title="Permalink to this headline">¶</a></h2>
+<p>From that point onwards there is so much that can be done to make
+deployment actually fun:</p>
+<ul class="simple">
+<li>Create a <cite>bootstrap</cite> command that initializes new servers. It could
+initialize a new virtual environment, setup apache appropriately etc.</li>
+<li>Put configuration files into a separate version control repository
+and symlink the active configs into place.</li>
+<li>You could also put your application code into a repository and check
+out the latest version on the server and then install. That way you
+can also easily go back to older versions.</li>
+<li>hook in testing functionality so that you can deploy to an external
+server and run the testsuite.</li>
+</ul>
+<p>Working with Fabric is fun and you will notice that it&#8217;s quite magical to
+type <tt class="docutils literal"><span class="pre">fab</span> <span class="pre">deploy</span></tt> and see your application being deployed automatically
+to one or more remote servers.</p>
+</div>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="../index.html">
+ <img class="logo" src="../_static/flask.png" alt="Logo"/>
+</a></p>
+ <h3><a href="../index.html">Table Of Contents</a></h3>
+ <ul>
+<li><a class="reference internal" href="#">Deploying with Fabric</a><ul>
+<li><a class="reference internal" href="#creating-the-first-fabfile">Creating the first Fabfile</a></li>
+<li><a class="reference internal" href="#running-fabfiles">Running Fabfiles</a></li>
+<li><a class="reference internal" href="#the-wsgi-file">The WSGI File</a></li>
+<li><a class="reference internal" href="#the-configuration-file">The Configuration File</a></li>
+<li><a class="reference internal" href="#first-deployment">First Deployment</a></li>
+<li><a class="reference internal" href="#next-steps">Next Steps</a></li>
+</ul>
+</li>
+</ul>
+<h3>Related Topics</h3>
+<ul>
+ <li><a href="../index.html">Documentation overview</a><ul>
+ <li><a href="index.html">Patterns for Flask</a><ul>
+ <li>Previous: <a href="distribute.html" title="previous chapter">Deploying with Distribute</a></li>
+ <li>Next: <a href="sqlite3.html" title="next chapter">Using SQLite 3 with Flask</a></li>
+ </ul></li>
+ </ul></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="../_sources/patterns/fabric.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/patterns/favicon.html b/app/static/doc/flask-docs/patterns/favicon.html
new file mode 100644
index 0000000..55c7ba7
--- /dev/null
+++ b/app/static/doc/flask-docs/patterns/favicon.html
@@ -0,0 +1,162 @@
+
+<!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>Adding a favicon &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="../index.html" />
+ <link rel="up" title="Patterns for Flask" href="index.html" />
+ <link rel="next" title="Streaming Contents" href="streaming.html" />
+ <link rel="prev" title="MongoKit in Flask" href="mongokit.html" />
+
+
+ <link rel="apple-touch-icon" href="../_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="../_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <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="streaming.html" title="Streaming Contents"
+ accesskey="N">next</a> |</li>
+ <li class="right" >
+ <a href="mongokit.html" title="MongoKit in Flask"
+ accesskey="P">previous</a> |</li>
+ <li><a href="../index.html">Flask 0.8 documentation</a> &raquo;</li>
+ <li><a href="index.html" accesskey="U">Patterns for Flask</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="adding-a-favicon">
+<h1>Adding a favicon<a class="headerlink" href="#adding-a-favicon" title="Permalink to this headline">¶</a></h1>
+<p>A &#8220;favicon&#8221; is an icon used by browsers for tabs and bookmarks. This helps
+to distinguish your website and to give it a unique brand.</p>
+<p>A common question is how to add a favicon to a flask application. First, of
+course, you need an icon. It should be 16 × 16 pixels and in the ICO file
+format. This is not a requirement but a de-facto standard supported by all
+relevant browsers. Put the icon in your static directory as
+<tt class="file docutils literal"><span class="pre">favicon.ico</span></tt>.</p>
+<p>Now, to get browsers to find your icon, the correct way is to add a link
+tag in your HTML. So, for example:</p>
+<div class="highlight-html+jinja"><div class="highlight"><pre><span class="nt">&lt;link</span> <span class="na">rel=</span><span class="s">&quot;shortcut icon&quot;</span> <span class="na">href=</span><span class="s">&quot;</span><span class="cp">{{</span> <span class="nv">url_for</span><span class="o">(</span><span class="s1">&#39;static&#39;</span><span class="o">,</span> <span class="nv">filename</span><span class="o">=</span><span class="s1">&#39;favicon.ico&#39;</span><span class="o">)</span> <span class="cp">}}</span><span class="s">&quot;</span><span class="nt">&gt;</span>
+</pre></div>
+</div>
+<p>That&#8217;s all you need for most browsers, however some really old ones do not
+support this standard. The old de-facto standard is to serve this file,
+with this name, at the website root. If your application is not mounted at
+the root path of the domain you either need to configure the webserver to
+serve the icon at the root or if you can&#8217;t do that you&#8217;re out of luck. If
+however your application is the root you can simply route a redirect:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="n">app</span><span class="o">.</span><span class="n">add_url_rule</span><span class="p">(</span><span class="s">&#39;/favicon.ico&#39;</span><span class="p">,</span>
+ <span class="n">redirect_to</span><span class="o">=</span><span class="n">url_for</span><span class="p">(</span><span class="s">&#39;static&#39;</span><span class="p">,</span> <span class="n">filename</span><span class="o">=</span><span class="s">&#39;favicon.ico&#39;</span><span class="p">))</span>
+</pre></div>
+</div>
+<p>If you want to save the extra redirect request you can also write a view
+using <a class="reference internal" href="../api.html#flask.send_from_directory" title="flask.send_from_directory"><tt class="xref py py-func docutils literal"><span class="pre">send_from_directory()</span></tt></a>:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">os</span>
+<span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">send_from_directory</span>
+
+<span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/favicon.ico&#39;</span><span class="p">)</span>
+<span class="k">def</span> <span class="nf">favicon</span><span class="p">():</span>
+ <span class="k">return</span> <span class="n">send_from_directory</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">app</span><span class="o">.</span><span class="n">root_path</span><span class="p">,</span> <span class="s">&#39;static&#39;</span><span class="p">),</span>
+ <span class="s">&#39;favicon.ico&#39;</span><span class="p">,</span> <span class="n">mimetype</span><span class="o">=</span><span class="s">&#39;image/vnd.microsoft.icon&#39;</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>We can leave out the explicit mimetype and it will be guessed, but we may
+as well specify it to avoid the extra guessing, as it will always be the
+same.</p>
+<p>The above will serve the icon via your application and if possible it&#8217;s
+better to configure your dedicated web server to serve it; refer to the
+webserver&#8217;s documentation.</p>
+<div class="section" id="see-also">
+<h2>See also<a class="headerlink" href="#see-also" title="Permalink to this headline">¶</a></h2>
+<ul class="simple">
+<li>The <a class="reference external" href="http://en.wikipedia.org/wiki/Favicon">Favicon</a> article on
+Wikipedia</li>
+</ul>
+</div>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="../index.html">
+ <img class="logo" src="../_static/flask.png" alt="Logo"/>
+</a></p>
+ <h3><a href="../index.html">Table Of Contents</a></h3>
+ <ul>
+<li><a class="reference internal" href="#">Adding a favicon</a><ul>
+<li><a class="reference internal" href="#see-also">See also</a></li>
+</ul>
+</li>
+</ul>
+<h3>Related Topics</h3>
+<ul>
+ <li><a href="../index.html">Documentation overview</a><ul>
+ <li><a href="index.html">Patterns for Flask</a><ul>
+ <li>Previous: <a href="mongokit.html" title="previous chapter">MongoKit in Flask</a></li>
+ <li>Next: <a href="streaming.html" title="next chapter">Streaming Contents</a></li>
+ </ul></li>
+ </ul></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="../_sources/patterns/favicon.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/patterns/fileuploads.html b/app/static/doc/flask-docs/patterns/fileuploads.html
new file mode 100644
index 0000000..2941367
--- /dev/null
+++ b/app/static/doc/flask-docs/patterns/fileuploads.html
@@ -0,0 +1,283 @@
+
+<!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>Uploading Files &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="../index.html" />
+ <link rel="up" title="Patterns for Flask" href="index.html" />
+ <link rel="next" title="Caching" href="caching.html" />
+ <link rel="prev" title="SQLAlchemy in Flask" href="sqlalchemy.html" />
+
+
+ <link rel="apple-touch-icon" href="../_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="../_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <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="caching.html" title="Caching"
+ accesskey="N">next</a> |</li>
+ <li class="right" >
+ <a href="sqlalchemy.html" title="SQLAlchemy in Flask"
+ accesskey="P">previous</a> |</li>
+ <li><a href="../index.html">Flask 0.8 documentation</a> &raquo;</li>
+ <li><a href="index.html" accesskey="U">Patterns for Flask</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="uploading-files">
+<span id="id1"></span><h1>Uploading Files<a class="headerlink" href="#uploading-files" title="Permalink to this headline">¶</a></h1>
+<p>Ah yes, the good old problem of file uploads. The basic idea of file
+uploads is actually quite simple. It basically works like this:</p>
+<ol class="arabic simple">
+<li>A <tt class="docutils literal"><span class="pre">&lt;form&gt;</span></tt> tag is marked with <tt class="docutils literal"><span class="pre">enctype=multipart/form-data</span></tt>
+and an <tt class="docutils literal"><span class="pre">&lt;input</span> <span class="pre">type=file&gt;</span></tt> is placed in that form.</li>
+<li>The application accesses the file from the <tt class="xref py py-attr docutils literal"><span class="pre">files</span></tt>
+dictionary on the request object.</li>
+<li>use the <a class="reference external" href="http://werkzeug.pocoo.org/docs/datastructures/#werkzeug.datastructures.FileStorage.save" title="(in Werkzeug v0.7)"><tt class="xref py py-meth docutils literal"><span class="pre">save()</span></tt></a> method of the file to save
+the file permanently somewhere on the filesystem.</li>
+</ol>
+<div class="section" id="a-gentle-introduction">
+<h2>A Gentle Introduction<a class="headerlink" href="#a-gentle-introduction" title="Permalink to this headline">¶</a></h2>
+<p>Let&#8217;s start with a very basic application that uploads a file to a
+specific upload folder and displays a file to the user. Let&#8217;s look at the
+bootstrapping code for our application:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">os</span>
+<span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">Flask</span><span class="p">,</span> <span class="n">request</span><span class="p">,</span> <span class="n">redirect</span><span class="p">,</span> <span class="n">url_for</span>
+<span class="kn">from</span> <span class="nn">werkzeug</span> <span class="kn">import</span> <span class="n">secure_filename</span>
+
+<span class="n">UPLOAD_FOLDER</span> <span class="o">=</span> <span class="s">&#39;/path/to/the/uploads&#39;</span>
+<span class="n">ALLOWED_EXTENSIONS</span> <span class="o">=</span> <span class="nb">set</span><span class="p">([</span><span class="s">&#39;txt&#39;</span><span class="p">,</span> <span class="s">&#39;pdf&#39;</span><span class="p">,</span> <span class="s">&#39;png&#39;</span><span class="p">,</span> <span class="s">&#39;jpg&#39;</span><span class="p">,</span> <span class="s">&#39;jpeg&#39;</span><span class="p">,</span> <span class="s">&#39;gif&#39;</span><span class="p">])</span>
+
+<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">app</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s">&#39;UPLOAD_FOLDER&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">UPLOAD_FOLDER</span>
+</pre></div>
+</div>
+<p>So first we need a couple of imports. Most should be straightforward, the
+<tt class="xref py py-func docutils literal"><span class="pre">werkzeug.secure_filename()</span></tt> is explained a little bit later. The
+<cite>UPLOAD_FOLDER</cite> is where we will store the uploaded files and the
+<cite>ALLOWED_EXTENSIONS</cite> is the set of allowed file extensions. Then we add a
+URL rule by hand to the application. Now usually we&#8217;re not doing that, so
+why here? The reasons is that we want the webserver (or our development
+server) to serve these files for us and so we only need a rule to generate
+the URL to these files.</p>
+<p>Why do we limit the extensions that are allowed? You probably don&#8217;t want
+your users to be able to upload everything there if the server is directly
+sending out the data to the client. That way you can make sure that users
+are not able to upload HTML files that would cause XSS problems (see
+<a class="reference internal" href="../security.html#xss"><em>Cross-Site Scripting (XSS)</em></a>). Also make sure to disallow <cite>.php</cite> files if the server
+executes them, but who has PHP installed on his server, right? :)</p>
+<p>Next the functions that check if an extension is valid and that uploads
+the file and redirects the user to the URL for the uploaded file:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">def</span> <span class="nf">allowed_file</span><span class="p">(</span><span class="n">filename</span><span class="p">):</span>
+ <span class="k">return</span> <span class="s">&#39;.&#39;</span> <span class="ow">in</span> <span class="n">filename</span> <span class="ow">and</span> \
+ <span class="n">filename</span><span class="o">.</span><span class="n">rsplit</span><span class="p">(</span><span class="s">&#39;.&#39;</span><span class="p">,</span> <span class="mi">1</span><span class="p">)[</span><span class="mi">1</span><span class="p">]</span> <span class="ow">in</span> <span class="n">ALLOWED_EXTENSIONS</span>
+
+<span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/&#39;</span><span class="p">,</span> <span class="n">methods</span><span class="o">=</span><span class="p">[</span><span class="s">&#39;GET&#39;</span><span class="p">,</span> <span class="s">&#39;POST&#39;</span><span class="p">])</span>
+<span class="k">def</span> <span class="nf">upload_file</span><span class="p">():</span>
+ <span class="k">if</span> <span class="n">request</span><span class="o">.</span><span class="n">method</span> <span class="o">==</span> <span class="s">&#39;POST&#39;</span><span class="p">:</span>
+ <span class="nb">file</span> <span class="o">=</span> <span class="n">request</span><span class="o">.</span><span class="n">files</span><span class="p">[</span><span class="s">&#39;file&#39;</span><span class="p">]</span>
+ <span class="k">if</span> <span class="nb">file</span> <span class="ow">and</span> <span class="n">allowed_file</span><span class="p">(</span><span class="nb">file</span><span class="o">.</span><span class="n">filename</span><span class="p">):</span>
+ <span class="n">filename</span> <span class="o">=</span> <span class="n">secure_filename</span><span class="p">(</span><span class="nb">file</span><span class="o">.</span><span class="n">filename</span><span class="p">)</span>
+ <span class="nb">file</span><span class="o">.</span><span class="n">save</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">app</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s">&#39;UPLOAD_FOLDER&#39;</span><span class="p">],</span> <span class="n">filename</span><span class="p">))</span>
+ <span class="k">return</span> <span class="n">redirect</span><span class="p">(</span><span class="n">url_for</span><span class="p">(</span><span class="s">&#39;uploaded_file&#39;</span><span class="p">,</span>
+ <span class="n">filename</span><span class="o">=</span><span class="n">filename</span><span class="p">))</span>
+ <span class="k">return</span> <span class="s">&#39;&#39;&#39;</span>
+<span class="s"> &lt;!doctype html&gt;</span>
+<span class="s"> &lt;title&gt;Upload new File&lt;/title&gt;</span>
+<span class="s"> &lt;h1&gt;Upload new File&lt;/h1&gt;</span>
+<span class="s"> &lt;form action=&quot;&quot; method=post enctype=multipart/form-data&gt;</span>
+<span class="s"> &lt;p&gt;&lt;input type=file name=file&gt;</span>
+<span class="s"> &lt;input type=submit value=Upload&gt;</span>
+<span class="s"> &lt;/form&gt;</span>
+<span class="s"> &#39;&#39;&#39;</span>
+</pre></div>
+</div>
+<p>So what does that <a class="reference external" href="http://werkzeug.pocoo.org/docs/utils/#werkzeug.utils.secure_filename" title="(in Werkzeug v0.7)"><tt class="xref py py-func docutils literal"><span class="pre">secure_filename()</span></tt></a> function actually do?
+Now the problem is that there is that principle called &#8220;never trust user
+input&#8221;. This is also true for the filename of an uploaded file. All
+submitted form data can be forged, and filenames can be dangerous. For
+the moment just remember: always use that function to secure a filename
+before storing it directly on the filesystem.</p>
+<div class="admonition-information-for-the-pros admonition ">
+<p class="first admonition-title">Information for the Pros</p>
+<p>So you&#8217;re interested in what that <a class="reference external" href="http://werkzeug.pocoo.org/docs/utils/#werkzeug.utils.secure_filename" title="(in Werkzeug v0.7)"><tt class="xref py py-func docutils literal"><span class="pre">secure_filename()</span></tt></a>
+function does and what the problem is if you&#8217;re not using it? So just
+imagine someone would send the following information as <cite>filename</cite> to
+your application:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="n">filename</span> <span class="o">=</span> <span class="s">&quot;../../../../home/username/.bashrc&quot;</span>
+</pre></div>
+</div>
+<p>Assuming the number of <tt class="docutils literal"><span class="pre">../</span></tt> is correct and you would join this with
+the <cite>UPLOAD_FOLDER</cite> the user might have the ability to modify a file on
+the server&#8217;s filesystem he or she should not modify. This does require some
+knowledge about how the application looks like, but trust me, hackers
+are patient :)</p>
+<p>Now let&#8217;s look how that function works:</p>
+<div class="last highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">secure_filename</span><span class="p">(</span><span class="s">&#39;../../../../home/username/.bashrc&#39;</span><span class="p">)</span>
+<span class="go">&#39;home_username_.bashrc&#39;</span>
+</pre></div>
+</div>
+</div>
+<p>Now one last thing is missing: the serving of the uploaded files. As of
+Flask 0.5 we can use a function that does that for us:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">send_from_directory</span>
+
+<span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/uploads/&lt;filename&gt;&#39;</span><span class="p">)</span>
+<span class="k">def</span> <span class="nf">uploaded_file</span><span class="p">(</span><span class="n">filename</span><span class="p">):</span>
+ <span class="k">return</span> <span class="n">send_from_directory</span><span class="p">(</span><span class="n">app</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s">&#39;UPLOAD_FOLDER&#39;</span><span class="p">],</span>
+ <span class="n">filename</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>Alternatively you can register <cite>uploaded_file</cite> as <cite>build_only</cite> rule and
+use the <a class="reference external" href="http://werkzeug.pocoo.org/docs/middlewares/#werkzeug.wsgi.SharedDataMiddleware" title="(in Werkzeug v0.7)"><tt class="xref py py-class docutils literal"><span class="pre">SharedDataMiddleware</span></tt></a>. This also works with
+older versions of Flask:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">werkzeug</span> <span class="kn">import</span> <span class="n">SharedDataMiddleware</span>
+<span class="n">app</span><span class="o">.</span><span class="n">add_url_rule</span><span class="p">(</span><span class="s">&#39;/uploads/&lt;filename&gt;&#39;</span><span class="p">,</span> <span class="s">&#39;uploaded_file&#39;</span><span class="p">,</span>
+ <span class="n">build_only</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
+<span class="n">app</span><span class="o">.</span><span class="n">wsgi_app</span> <span class="o">=</span> <span class="n">SharedDataMiddleware</span><span class="p">(</span><span class="n">app</span><span class="o">.</span><span class="n">wsgi_app</span><span class="p">,</span> <span class="p">{</span>
+ <span class="s">&#39;/uploads&#39;</span><span class="p">:</span> <span class="n">app</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s">&#39;UPLOAD_FOLDER&#39;</span><span class="p">]</span>
+<span class="p">})</span>
+</pre></div>
+</div>
+<p>If you now run the application everything should work as expected.</p>
+</div>
+<div class="section" id="improving-uploads">
+<h2>Improving Uploads<a class="headerlink" href="#improving-uploads" title="Permalink to this headline">¶</a></h2>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.6.</span></p>
+<p>So how exactly does Flask handle uploads? Well it will store them in the
+webserver&#8217;s memory if the files are reasonable small otherwise in a
+temporary location (as returned by <a class="reference external" href="http://docs.python.org/dev/library/tempfile.html#tempfile.gettempdir" title="(in Python v3.3)"><tt class="xref py py-func docutils literal"><span class="pre">tempfile.gettempdir()</span></tt></a>). But how
+do you specify the maximum file size after which an upload is aborted? By
+default Flask will happily accept file uploads to an unlimited amount of
+memory, but you can limit that by setting the <tt class="docutils literal"><span class="pre">MAX_CONTENT_LENGTH</span></tt>
+config key:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">Flask</span><span class="p">,</span> <span class="n">Request</span>
+
+<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">app</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s">&#39;MAX_CONTENT_LENGTH&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="mi">16</span> <span class="o">*</span> <span class="mi">1024</span> <span class="o">*</span> <span class="mi">1024</span>
+</pre></div>
+</div>
+<p>The code above will limited the maximum allowed payload to 16 megabytes.
+If a larger file is transmitted, Flask will raise an
+<a class="reference external" href="http://werkzeug.pocoo.org/docs/exceptions/#werkzeug.exceptions.RequestEntityTooLarge" title="(in Werkzeug v0.7)"><tt class="xref py py-exc docutils literal"><span class="pre">RequestEntityTooLarge</span></tt></a> exception.</p>
+<p>This feature was added in Flask 0.6 but can be achieved in older versions
+as well by subclassing the request object. For more information on that
+consult the Werkzeug documentation on file handling.</p>
+</div>
+<div class="section" id="upload-progress-bars">
+<h2>Upload Progress Bars<a class="headerlink" href="#upload-progress-bars" title="Permalink to this headline">¶</a></h2>
+<p>A while ago many developers had the idea to read the incoming file in
+small chunks and store the upload progress in the database to be able to
+poll the progress with JavaScript from the client. Long story short: the
+client asks the server every 5 seconds how much it has transmitted
+already. Do you realize the irony? The client is asking for something it
+should already know.</p>
+<p>Now there are better solutions to that work faster and more reliable. The
+web changed a lot lately and you can use HTML5, Java, Silverlight or Flash
+to get a nicer uploading experience on the client side. Look at the
+following libraries for some nice examples how to do that:</p>
+<ul class="simple">
+<li><a class="reference external" href="http://www.plupload.com/">Plupload</a> - HTML5, Java, Flash</li>
+<li><a class="reference external" href="http://www.swfupload.org/">SWFUpload</a> - Flash</li>
+<li><a class="reference external" href="http://jumploader.com/">JumpLoader</a> - Java</li>
+</ul>
+</div>
+<div class="section" id="an-easier-solution">
+<h2>An Easier Solution<a class="headerlink" href="#an-easier-solution" title="Permalink to this headline">¶</a></h2>
+<p>Because the common pattern for file uploads exists almost unchanged in all
+applications dealing with uploads, there is a Flask extension called
+<a class="reference external" href="http://packages.python.org/Flask-Uploads/">Flask-Uploads</a> that implements a full fledged upload mechanism with
+white and blacklisting of extensions and more.</p>
+</div>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="../index.html">
+ <img class="logo" src="../_static/flask.png" alt="Logo"/>
+</a></p>
+ <h3><a href="../index.html">Table Of Contents</a></h3>
+ <ul>
+<li><a class="reference internal" href="#">Uploading Files</a><ul>
+<li><a class="reference internal" href="#a-gentle-introduction">A Gentle Introduction</a></li>
+<li><a class="reference internal" href="#improving-uploads">Improving Uploads</a></li>
+<li><a class="reference internal" href="#upload-progress-bars">Upload Progress Bars</a></li>
+<li><a class="reference internal" href="#an-easier-solution">An Easier Solution</a></li>
+</ul>
+</li>
+</ul>
+<h3>Related Topics</h3>
+<ul>
+ <li><a href="../index.html">Documentation overview</a><ul>
+ <li><a href="index.html">Patterns for Flask</a><ul>
+ <li>Previous: <a href="sqlalchemy.html" title="previous chapter">SQLAlchemy in Flask</a></li>
+ <li>Next: <a href="caching.html" title="next chapter">Caching</a></li>
+ </ul></li>
+ </ul></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="../_sources/patterns/fileuploads.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/patterns/flashing.html b/app/static/doc/flask-docs/patterns/flashing.html
new file mode 100644
index 0000000..b4f53c7
--- /dev/null
+++ b/app/static/doc/flask-docs/patterns/flashing.html
@@ -0,0 +1,221 @@
+
+<!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>Message Flashing &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="../index.html" />
+ <link rel="up" title="Patterns for Flask" href="index.html" />
+ <link rel="next" title="AJAX with jQuery" href="jquery.html" />
+ <link rel="prev" title="Template Inheritance" href="templateinheritance.html" />
+
+
+ <link rel="apple-touch-icon" href="../_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="../_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <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="jquery.html" title="AJAX with jQuery"
+ accesskey="N">next</a> |</li>
+ <li class="right" >
+ <a href="templateinheritance.html" title="Template Inheritance"
+ accesskey="P">previous</a> |</li>
+ <li><a href="../index.html">Flask 0.8 documentation</a> &raquo;</li>
+ <li><a href="index.html" accesskey="U">Patterns for Flask</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="message-flashing">
+<span id="message-flashing-pattern"></span><h1>Message Flashing<a class="headerlink" href="#message-flashing" title="Permalink to this headline">¶</a></h1>
+<p>Good applications and user interfaces are all about feedback. If the user
+does not get enough feedback they will probably end up hating the
+application. Flask provides a really simple way to give feedback to a
+user with the flashing system. The flashing system basically makes it
+possible to record a message at the end of a request and access it next
+request and only next request. This is usually combined with a layout
+template that does this.</p>
+<div class="section" id="simple-flashing">
+<h2>Simple Flashing<a class="headerlink" href="#simple-flashing" title="Permalink to this headline">¶</a></h2>
+<p>So here is a full example:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">flash</span><span class="p">,</span> <span class="n">redirect</span><span class="p">,</span> <span class="n">url_for</span><span class="p">,</span> <span class="n">render_template</span>
+
+<span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/&#39;</span><span class="p">)</span>
+<span class="k">def</span> <span class="nf">index</span><span class="p">():</span>
+ <span class="k">return</span> <span class="n">render_template</span><span class="p">(</span><span class="s">&#39;index.html&#39;</span><span class="p">)</span>
+
+<span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/login&#39;</span><span class="p">,</span> <span class="n">methods</span><span class="o">=</span><span class="p">[</span><span class="s">&#39;GET&#39;</span><span class="p">,</span> <span class="s">&#39;POST&#39;</span><span class="p">])</span>
+<span class="k">def</span> <span class="nf">login</span><span class="p">():</span>
+ <span class="n">error</span> <span class="o">=</span> <span class="bp">None</span>
+ <span class="k">if</span> <span class="n">request</span><span class="o">.</span><span class="n">method</span> <span class="o">==</span> <span class="s">&#39;POST&#39;</span><span class="p">:</span>
+ <span class="k">if</span> <span class="n">request</span><span class="o">.</span><span class="n">form</span><span class="p">[</span><span class="s">&#39;username&#39;</span><span class="p">]</span> <span class="o">!=</span> <span class="s">&#39;admin&#39;</span> <span class="ow">or</span> \
+ <span class="n">request</span><span class="o">.</span><span class="n">form</span><span class="p">[</span><span class="s">&#39;password&#39;</span><span class="p">]</span> <span class="o">!=</span> <span class="s">&#39;secret&#39;</span><span class="p">:</span>
+ <span class="n">error</span> <span class="o">=</span> <span class="s">&#39;Invalid credentials&#39;</span>
+ <span class="k">else</span><span class="p">:</span>
+ <span class="n">flash</span><span class="p">(</span><span class="s">&#39;You were successfully logged in&#39;</span><span class="p">)</span>
+ <span class="k">return</span> <span class="n">redirect</span><span class="p">(</span><span class="n">url_for</span><span class="p">(</span><span class="s">&#39;index&#39;</span><span class="p">))</span>
+ <span class="k">return</span> <span class="n">render_template</span><span class="p">(</span><span class="s">&#39;login.html&#39;</span><span class="p">,</span> <span class="n">error</span><span class="o">=</span><span class="n">error</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>And here the <tt class="docutils literal"><span class="pre">layout.html</span></tt> template which does the magic:</p>
+<div class="highlight-html+jinja"><div class="highlight"><pre><span class="cp">&lt;!doctype html&gt;</span>
+<span class="nt">&lt;title&gt;</span>My Application<span class="nt">&lt;/title&gt;</span>
+<span class="cp">{%</span> <span class="k">with</span> <span class="nv">messages</span> <span class="o">=</span> <span class="nv">get_flashed_messages</span><span class="o">()</span> <span class="cp">%}</span>
+ <span class="cp">{%</span> <span class="k">if</span> <span class="nv">messages</span> <span class="cp">%}</span>
+ <span class="nt">&lt;ul</span> <span class="na">class=</span><span class="s">flashes</span><span class="nt">&gt;</span>
+ <span class="cp">{%</span> <span class="k">for</span> <span class="nv">message</span> <span class="k">in</span> <span class="nv">messages</span> <span class="cp">%}</span>
+ <span class="nt">&lt;li&gt;</span><span class="cp">{{</span> <span class="nv">message</span> <span class="cp">}}</span><span class="nt">&lt;/li&gt;</span>
+ <span class="cp">{%</span> <span class="k">endfor</span> <span class="cp">%}</span>
+ <span class="nt">&lt;/ul&gt;</span>
+ <span class="cp">{%</span> <span class="k">endif</span> <span class="cp">%}</span>
+<span class="cp">{%</span> <span class="k">endwith</span> <span class="cp">%}</span>
+<span class="cp">{%</span> <span class="k">block</span> <span class="nv">body</span> <span class="cp">%}{%</span> <span class="k">endblock</span> <span class="cp">%}</span>
+</pre></div>
+</div>
+<p>And here the index.html template:</p>
+<div class="highlight-html+jinja"><div class="highlight"><pre><span class="cp">{%</span> <span class="k">extends</span> <span class="s2">&quot;layout.html&quot;</span> <span class="cp">%}</span>
+<span class="cp">{%</span> <span class="k">block</span> <span class="nv">body</span> <span class="cp">%}</span>
+ <span class="nt">&lt;h1&gt;</span>Overview<span class="nt">&lt;/h1&gt;</span>
+ <span class="nt">&lt;p&gt;</span>Do you want to <span class="nt">&lt;a</span> <span class="na">href=</span><span class="s">&quot;</span><span class="cp">{{</span> <span class="nv">url_for</span><span class="o">(</span><span class="s1">&#39;login&#39;</span><span class="o">)</span> <span class="cp">}}</span><span class="s">&quot;</span><span class="nt">&gt;</span>log in?<span class="nt">&lt;/a&gt;</span>
+<span class="cp">{%</span> <span class="k">endblock</span> <span class="cp">%}</span>
+</pre></div>
+</div>
+<p>And of course the login template:</p>
+<div class="highlight-html+jinja"><div class="highlight"><pre><span class="cp">{%</span> <span class="k">extends</span> <span class="s2">&quot;layout.html&quot;</span> <span class="cp">%}</span>
+<span class="cp">{%</span> <span class="k">block</span> <span class="nv">body</span> <span class="cp">%}</span>
+ <span class="nt">&lt;h1&gt;</span>Login<span class="nt">&lt;/h1&gt;</span>
+ <span class="cp">{%</span> <span class="k">if</span> <span class="nv">error</span> <span class="cp">%}</span>
+ <span class="nt">&lt;p</span> <span class="na">class=</span><span class="s">error</span><span class="nt">&gt;&lt;strong&gt;</span>Error:<span class="nt">&lt;/strong&gt;</span> <span class="cp">{{</span> <span class="nv">error</span> <span class="cp">}}</span>
+ <span class="cp">{%</span> <span class="k">endif</span> <span class="cp">%}</span>
+ <span class="nt">&lt;form</span> <span class="na">action=</span><span class="s">&quot;&quot;</span> <span class="na">method=</span><span class="s">post</span><span class="nt">&gt;</span>
+ <span class="nt">&lt;dl&gt;</span>
+ <span class="nt">&lt;dt&gt;</span>Username:
+ <span class="nt">&lt;dd&gt;&lt;input</span> <span class="na">type=</span><span class="s">text</span> <span class="na">name=</span><span class="s">username</span> <span class="na">value=</span><span class="s">&quot;</span><span class="cp">{{</span>
+ <span class="nv">request.form.username</span> <span class="cp">}}</span><span class="s">&quot;</span><span class="nt">&gt;</span>
+ <span class="nt">&lt;dt&gt;</span>Password:
+ <span class="nt">&lt;dd&gt;&lt;input</span> <span class="na">type=</span><span class="s">password</span> <span class="na">name=</span><span class="s">password</span><span class="nt">&gt;</span>
+ <span class="nt">&lt;/dl&gt;</span>
+ <span class="nt">&lt;p&gt;&lt;input</span> <span class="na">type=</span><span class="s">submit</span> <span class="na">value=</span><span class="s">Login</span><span class="nt">&gt;</span>
+ <span class="nt">&lt;/form&gt;</span>
+<span class="cp">{%</span> <span class="k">endblock</span> <span class="cp">%}</span>
+</pre></div>
+</div>
+</div>
+<div class="section" id="flashing-with-categories">
+<h2>Flashing With Categories<a class="headerlink" href="#flashing-with-categories" title="Permalink to this headline">¶</a></h2>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.3.</span></p>
+<p>It is also possible to provide categories when flashing a message. The
+default category if nothing is provided is <tt class="docutils literal"><span class="pre">'message'</span></tt>. Alternative
+categories can be used to give the user better feedback. For example
+error messages could be displayed with a red background.</p>
+<p>To flash a message with a different category, just use the second argument
+to the <a class="reference internal" href="../api.html#flask.flash" title="flask.flash"><tt class="xref py py-func docutils literal"><span class="pre">flash()</span></tt></a> function:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="n">flash</span><span class="p">(</span><span class="s">u&#39;Invalid password provided&#39;</span><span class="p">,</span> <span class="s">&#39;error&#39;</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>Inside the template you then have to tell the
+<a class="reference internal" href="../api.html#flask.get_flashed_messages" title="flask.get_flashed_messages"><tt class="xref py py-func docutils literal"><span class="pre">get_flashed_messages()</span></tt></a> function to also return the
+categories. The loop looks slightly different in that situation then:</p>
+<div class="highlight-html+jinja"><div class="highlight"><pre><span class="cp">{%</span> <span class="k">with</span> <span class="nv">messages</span> <span class="o">=</span> <span class="nv">get_flashed_messages</span><span class="o">(</span><span class="nv">with_categories</span><span class="o">=</span><span class="kp">true</span><span class="o">)</span> <span class="cp">%}</span>
+ <span class="cp">{%</span> <span class="k">if</span> <span class="nv">messages</span> <span class="cp">%}</span>
+ <span class="nt">&lt;ul</span> <span class="na">class=</span><span class="s">flashes</span><span class="nt">&gt;</span>
+ <span class="cp">{%</span> <span class="k">for</span> <span class="nv">category</span><span class="o">,</span> <span class="nv">message</span> <span class="k">in</span> <span class="nv">messages</span> <span class="cp">%}</span>
+ <span class="nt">&lt;li</span> <span class="na">class=</span><span class="s">&quot;</span><span class="cp">{{</span> <span class="nv">category</span> <span class="cp">}}</span><span class="s">&quot;</span><span class="nt">&gt;</span><span class="cp">{{</span> <span class="nv">message</span> <span class="cp">}}</span><span class="nt">&lt;/li&gt;</span>
+ <span class="cp">{%</span> <span class="k">endfor</span> <span class="cp">%}</span>
+ <span class="nt">&lt;/ul&gt;</span>
+ <span class="cp">{%</span> <span class="k">endif</span> <span class="cp">%}</span>
+<span class="cp">{%</span> <span class="k">endwith</span> <span class="cp">%}</span>
+</pre></div>
+</div>
+<p>This is just one example of how to render these flashed messages. One
+might also use the category to add a prefix such as
+<tt class="docutils literal"><span class="pre">&lt;strong&gt;Error:&lt;/strong&gt;</span></tt> to the message.</p>
+</div>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="../index.html">
+ <img class="logo" src="../_static/flask.png" alt="Logo"/>
+</a></p>
+ <h3><a href="../index.html">Table Of Contents</a></h3>
+ <ul>
+<li><a class="reference internal" href="#">Message Flashing</a><ul>
+<li><a class="reference internal" href="#simple-flashing">Simple Flashing</a></li>
+<li><a class="reference internal" href="#flashing-with-categories">Flashing With Categories</a></li>
+</ul>
+</li>
+</ul>
+<h3>Related Topics</h3>
+<ul>
+ <li><a href="../index.html">Documentation overview</a><ul>
+ <li><a href="index.html">Patterns for Flask</a><ul>
+ <li>Previous: <a href="templateinheritance.html" title="previous chapter">Template Inheritance</a></li>
+ <li>Next: <a href="jquery.html" title="next chapter">AJAX with jQuery</a></li>
+ </ul></li>
+ </ul></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="../_sources/patterns/flashing.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/patterns/index.html b/app/static/doc/flask-docs/patterns/index.html
new file mode 100644
index 0000000..8190785
--- /dev/null
+++ b/app/static/doc/flask-docs/patterns/index.html
@@ -0,0 +1,240 @@
+
+<!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>Patterns for Flask &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="../index.html" />
+ <link rel="next" title="Larger Applications" href="packages.html" />
+ <link rel="prev" title="Working with the Shell" href="../shell.html" />
+
+
+ <link rel="apple-touch-icon" href="../_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="../_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <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="packages.html" title="Larger Applications"
+ accesskey="N">next</a> |</li>
+ <li class="right" >
+ <a href="../shell.html" title="Working with the Shell"
+ accesskey="P">previous</a> |</li>
+ <li><a href="../index.html">Flask 0.8 documentation</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="patterns-for-flask">
+<span id="patterns"></span><h1>Patterns for Flask<a class="headerlink" href="#patterns-for-flask" title="Permalink to this headline">¶</a></h1>
+<p>Certain things are common enough that the chances are high you will find
+them in most web applications. For example quite a lot of applications
+are using relational databases and user authentication. In that case,
+chances are they will open a database connection at the beginning of the
+request and get the information of the currently logged in user. At the
+end of the request, the database connection is closed again.</p>
+<p>There are more user contributed snippets and patterns in the <a class="reference external" href="http://flask.pocoo.org/snippets/">Flask
+Snippet Archives</a>.</p>
+<div class="toctree-wrapper compound">
+<ul>
+<li class="toctree-l1"><a class="reference internal" href="packages.html">Larger Applications</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="packages.html#simple-packages">Simple Packages</a></li>
+<li class="toctree-l2"><a class="reference internal" href="packages.html#working-with-blueprints">Working with Blueprints</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="appfactories.html">Application Factories</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="appfactories.html#basic-factories">Basic Factories</a></li>
+<li class="toctree-l2"><a class="reference internal" href="appfactories.html#using-applications">Using Applications</a></li>
+<li class="toctree-l2"><a class="reference internal" href="appfactories.html#factory-improvements">Factory Improvements</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="appdispatch.html">Application Dispatching</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="appdispatch.html#working-with-this-document">Working with this Document</a></li>
+<li class="toctree-l2"><a class="reference internal" href="appdispatch.html#combining-applications">Combining Applications</a></li>
+<li class="toctree-l2"><a class="reference internal" href="appdispatch.html#dispatch-by-subdomain">Dispatch by Subdomain</a></li>
+<li class="toctree-l2"><a class="reference internal" href="appdispatch.html#dispatch-by-path">Dispatch by Path</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="urlprocessors.html">Using URL Processors</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="urlprocessors.html#internationalized-application-urls">Internationalized Application URLs</a></li>
+<li class="toctree-l2"><a class="reference internal" href="urlprocessors.html#internationalized-blueprint-urls">Internationalized Blueprint URLs</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="distribute.html">Deploying with Distribute</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="distribute.html#basic-setup-script">Basic Setup Script</a></li>
+<li class="toctree-l2"><a class="reference internal" href="distribute.html#distributing-resources">Distributing Resources</a></li>
+<li class="toctree-l2"><a class="reference internal" href="distribute.html#declaring-dependencies">Declaring Dependencies</a></li>
+<li class="toctree-l2"><a class="reference internal" href="distribute.html#installing-developing">Installing / Developing</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="fabric.html">Deploying with Fabric</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="fabric.html#creating-the-first-fabfile">Creating the first Fabfile</a></li>
+<li class="toctree-l2"><a class="reference internal" href="fabric.html#running-fabfiles">Running Fabfiles</a></li>
+<li class="toctree-l2"><a class="reference internal" href="fabric.html#the-wsgi-file">The WSGI File</a></li>
+<li class="toctree-l2"><a class="reference internal" href="fabric.html#the-configuration-file">The Configuration File</a></li>
+<li class="toctree-l2"><a class="reference internal" href="fabric.html#first-deployment">First Deployment</a></li>
+<li class="toctree-l2"><a class="reference internal" href="fabric.html#next-steps">Next Steps</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="sqlite3.html">Using SQLite 3 with Flask</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="sqlite3.html#connect-on-demand">Connect on Demand</a></li>
+<li class="toctree-l2"><a class="reference internal" href="sqlite3.html#easy-querying">Easy Querying</a></li>
+<li class="toctree-l2"><a class="reference internal" href="sqlite3.html#initial-schemas">Initial Schemas</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="sqlalchemy.html">SQLAlchemy in Flask</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="sqlalchemy.html#flask-sqlalchemy-extension">Flask-SQLAlchemy Extension</a></li>
+<li class="toctree-l2"><a class="reference internal" href="sqlalchemy.html#declarative">Declarative</a></li>
+<li class="toctree-l2"><a class="reference internal" href="sqlalchemy.html#manual-object-relational-mapping">Manual Object Relational Mapping</a></li>
+<li class="toctree-l2"><a class="reference internal" href="sqlalchemy.html#sql-abstraction-layer">SQL Abstraction Layer</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="fileuploads.html">Uploading Files</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="fileuploads.html#a-gentle-introduction">A Gentle Introduction</a></li>
+<li class="toctree-l2"><a class="reference internal" href="fileuploads.html#improving-uploads">Improving Uploads</a></li>
+<li class="toctree-l2"><a class="reference internal" href="fileuploads.html#upload-progress-bars">Upload Progress Bars</a></li>
+<li class="toctree-l2"><a class="reference internal" href="fileuploads.html#an-easier-solution">An Easier Solution</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="caching.html">Caching</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="caching.html#setting-up-a-cache">Setting up a Cache</a></li>
+<li class="toctree-l2"><a class="reference internal" href="caching.html#using-a-cache">Using a Cache</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="viewdecorators.html">View Decorators</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="viewdecorators.html#login-required-decorator">Login Required Decorator</a></li>
+<li class="toctree-l2"><a class="reference internal" href="viewdecorators.html#caching-decorator">Caching Decorator</a></li>
+<li class="toctree-l2"><a class="reference internal" href="viewdecorators.html#templating-decorator">Templating Decorator</a></li>
+<li class="toctree-l2"><a class="reference internal" href="viewdecorators.html#endpoint-decorator">Endpoint Decorator</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="wtforms.html">Form Validation with WTForms</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="wtforms.html#the-forms">The Forms</a></li>
+<li class="toctree-l2"><a class="reference internal" href="wtforms.html#in-the-view">In the View</a></li>
+<li class="toctree-l2"><a class="reference internal" href="wtforms.html#forms-in-templates">Forms in Templates</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="templateinheritance.html">Template Inheritance</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="templateinheritance.html#base-template">Base Template</a></li>
+<li class="toctree-l2"><a class="reference internal" href="templateinheritance.html#child-template">Child Template</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="flashing.html">Message Flashing</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="flashing.html#simple-flashing">Simple Flashing</a></li>
+<li class="toctree-l2"><a class="reference internal" href="flashing.html#flashing-with-categories">Flashing With Categories</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="jquery.html">AJAX with jQuery</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="jquery.html#loading-jquery">Loading jQuery</a></li>
+<li class="toctree-l2"><a class="reference internal" href="jquery.html#where-is-my-site">Where is My Site?</a></li>
+<li class="toctree-l2"><a class="reference internal" href="jquery.html#json-view-functions">JSON View Functions</a></li>
+<li class="toctree-l2"><a class="reference internal" href="jquery.html#the-html">The HTML</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="errorpages.html">Custom Error Pages</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="errorpages.html#common-error-codes">Common Error Codes</a></li>
+<li class="toctree-l2"><a class="reference internal" href="errorpages.html#error-handlers">Error Handlers</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="lazyloading.html">Lazily Loading Views</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="lazyloading.html#converting-to-centralized-url-map">Converting to Centralized URL Map</a></li>
+<li class="toctree-l2"><a class="reference internal" href="lazyloading.html#loading-late">Loading Late</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="mongokit.html">MongoKit in Flask</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="mongokit.html#declarative">Declarative</a></li>
+<li class="toctree-l2"><a class="reference internal" href="mongokit.html#pymongo-compatibility-layer">PyMongo Compatibility Layer</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="favicon.html">Adding a favicon</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="favicon.html#see-also">See also</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="streaming.html">Streaming Contents</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="streaming.html#basic-usage">Basic Usage</a></li>
+<li class="toctree-l2"><a class="reference internal" href="streaming.html#streaming-from-templates">Streaming from Templates</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="deferredcallbacks.html">Deferred Request Callbacks</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="deferredcallbacks.html#the-decorator">The Decorator</a></li>
+<li class="toctree-l2"><a class="reference internal" href="deferredcallbacks.html#calling-the-deferred">Calling the Deferred</a></li>
+<li class="toctree-l2"><a class="reference internal" href="deferredcallbacks.html#a-practical-example">A Practical Example</a></li>
+</ul>
+</li>
+</ul>
+</div>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="../index.html">
+ <img class="logo" src="../_static/flask.png" alt="Logo"/>
+</a></p><h3>Related Topics</h3>
+<ul>
+ <li><a href="../index.html">Documentation overview</a><ul>
+ <li>Previous: <a href="../shell.html" title="previous chapter">Working with the Shell</a></li>
+ <li>Next: <a href="packages.html" title="next chapter">Larger Applications</a></li>
+ </ul></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="../_sources/patterns/index.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/patterns/jquery.html b/app/static/doc/flask-docs/patterns/jquery.html
new file mode 100644
index 0000000..7d03623
--- /dev/null
+++ b/app/static/doc/flask-docs/patterns/jquery.html
@@ -0,0 +1,261 @@
+
+<!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>AJAX with jQuery &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="../index.html" />
+ <link rel="up" title="Patterns for Flask" href="index.html" />
+ <link rel="next" title="Custom Error Pages" href="errorpages.html" />
+ <link rel="prev" title="Message Flashing" href="flashing.html" />
+
+
+ <link rel="apple-touch-icon" href="../_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="../_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <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="errorpages.html" title="Custom Error Pages"
+ accesskey="N">next</a> |</li>
+ <li class="right" >
+ <a href="flashing.html" title="Message Flashing"
+ accesskey="P">previous</a> |</li>
+ <li><a href="../index.html">Flask 0.8 documentation</a> &raquo;</li>
+ <li><a href="index.html" accesskey="U">Patterns for Flask</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="ajax-with-jquery">
+<h1>AJAX with jQuery<a class="headerlink" href="#ajax-with-jquery" title="Permalink to this headline">¶</a></h1>
+<p><a class="reference external" href="http://jquery.com/">jQuery</a> is a small JavaScript library commonly used to simplify working
+with the DOM and JavaScript in general. It is the perfect tool to make
+web applications more dynamic by exchanging JSON between server and
+client.</p>
+<p>JSON itself is a very lightweight transport format, very similar to how
+Python primitives (numbers, strings, dicts and lists) look like which is
+widely supported and very easy to parse. It became popular a few years
+ago and quickly replaced XML as transport format in web applications.</p>
+<p>If you have Python 2.6 JSON will work out of the box, in Python 2.5 you
+will have to install the <a class="reference external" href="http://pypi.python.org/pypi/simplejson">simplejson</a> library from PyPI.</p>
+<div class="section" id="loading-jquery">
+<h2>Loading jQuery<a class="headerlink" href="#loading-jquery" title="Permalink to this headline">¶</a></h2>
+<p>In order to use jQuery, you have to download it first and place it in the
+static folder of your application and then ensure it&#8217;s loaded. Ideally
+you have a layout template that is used for all pages where you just have
+to add a script statement to the bottom of your <cite>&lt;body&gt;</cite> to load jQuery:</p>
+<div class="highlight-html"><div class="highlight"><pre><span class="nt">&lt;script </span><span class="na">type=</span><span class="s">text/javascript</span> <span class="na">src=</span><span class="s">&quot;{{</span>
+<span class="s"> url_for(&#39;static&#39;, filename=&#39;jquery.js&#39;) }}&quot;</span><span class="nt">&gt;&lt;/script&gt;</span>
+</pre></div>
+</div>
+<p>Another method is using Google&#8217;s <a class="reference external" href="http://code.google.com/apis/ajaxlibs/documentation/">AJAX Libraries API</a> to load jQuery:</p>
+<div class="highlight-html"><div class="highlight"><pre><span class="nt">&lt;script </span><span class="na">src=</span><span class="s">&quot;//ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.js&quot;</span><span class="nt">&gt;&lt;/script&gt;</span>
+<span class="nt">&lt;script&gt;</span><span class="nb">window</span><span class="p">.</span><span class="nx">jQuery</span> <span class="o">||</span> <span class="nb">document</span><span class="p">.</span><span class="nx">write</span><span class="p">(</span><span class="s1">&#39;&lt;script src=&quot;{{</span>
+<span class="s1"> url_for(&#39;</span><span class="kr">static</span><span class="s1">&#39;, filename=&#39;</span><span class="nx">jquery</span><span class="p">.</span><span class="nx">js</span><span class="s1">&#39;) }}&quot;&gt;\x3C/script&gt;&#39;</span><span class="p">)</span><span class="nt">&lt;/script&gt;</span>
+</pre></div>
+</div>
+<p>In this case you have to put jQuery into your static folder as a fallback, but it will
+first try to load it directly from Google. This has the advantage that your
+website will probably load faster for users if they went to at least one
+other website before using the same jQuery version from Google because it
+will already be in the browser cache.</p>
+</div>
+<div class="section" id="where-is-my-site">
+<h2>Where is My Site?<a class="headerlink" href="#where-is-my-site" title="Permalink to this headline">¶</a></h2>
+<p>Do you know where your application is? If you are developing the answer
+is quite simple: it&#8217;s on localhost port something and directly on the root
+of that server. But what if you later decide to move your application to
+a different location? For example to <tt class="docutils literal"><span class="pre">http://example.com/myapp</span></tt>? On
+the server side this never was a problem because we were using the handy
+<a class="reference internal" href="../api.html#flask.url_for" title="flask.url_for"><tt class="xref py py-func docutils literal"><span class="pre">url_for()</span></tt></a> function that could answer that question for
+us, but if we are using jQuery we should not hardcode the path to
+the application but make that dynamic, so how can we do that?</p>
+<p>A simple method would be to add a script tag to our page that sets a
+global variable to the prefix to the root of the application. Something
+like this:</p>
+<div class="highlight-html+jinja"><div class="highlight"><pre><span class="nt">&lt;script </span><span class="na">type=</span><span class="s">text/javascript</span><span class="nt">&gt;</span>
+ <span class="nx">$SCRIPT_ROOT</span> <span class="o">=</span> <span class="cp">{{</span> <span class="nv">request.script_root</span><span class="o">|</span><span class="nf">tojson</span><span class="o">|</span><span class="nf">safe</span> <span class="cp">}}</span><span class="p">;</span>
+<span class="nt">&lt;/script&gt;</span>
+</pre></div>
+</div>
+<p>The <tt class="docutils literal"><span class="pre">|safe</span></tt> is necessary so that Jinja does not escape the JSON encoded
+string with HTML rules. Usually this would be necessary, but we are
+inside a <cite>script</cite> block here where different rules apply.</p>
+<div class="admonition-information-for-pros admonition ">
+<p class="first admonition-title">Information for Pros</p>
+<p class="last">In HTML the <cite>script</cite> tag is declared <cite>CDATA</cite> which means that entities
+will not be parsed. Everything until <tt class="docutils literal"><span class="pre">&lt;/script&gt;</span></tt> is handled as script.
+This also means that there must never be any <tt class="docutils literal"><span class="pre">&lt;/</span></tt> between the script
+tags. <tt class="docutils literal"><span class="pre">|tojson</span></tt> is kind enough to do the right thing here and
+escape slashes for you (<tt class="docutils literal"><span class="pre">{{</span> <span class="pre">&quot;&lt;/script&gt;&quot;|tojson|safe</span> <span class="pre">}}</span></tt> is rendered as
+<tt class="docutils literal"><span class="pre">&quot;&lt;\/script&gt;&quot;</span></tt>).</p>
+</div>
+</div>
+<div class="section" id="json-view-functions">
+<h2>JSON View Functions<a class="headerlink" href="#json-view-functions" title="Permalink to this headline">¶</a></h2>
+<p>Now let&#8217;s create a server side function that accepts two URL arguments of
+numbers which should be added together and then sent back to the
+application in a JSON object. This is a really ridiculous example and is
+something you usually would do on the client side alone, but a simple
+example that shows how you would use jQuery and Flask nonetheless:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">Flask</span><span class="p">,</span> <span class="n">jsonify</span><span class="p">,</span> <span class="n">render_template</span><span class="p">,</span> <span class="n">request</span>
+<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="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/_add_numbers&#39;</span><span class="p">)</span>
+<span class="k">def</span> <span class="nf">add_numbers</span><span class="p">():</span>
+ <span class="n">a</span> <span class="o">=</span> <span class="n">request</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;a&#39;</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="nb">type</span><span class="o">=</span><span class="nb">int</span><span class="p">)</span>
+ <span class="n">b</span> <span class="o">=</span> <span class="n">request</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;b&#39;</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="nb">type</span><span class="o">=</span><span class="nb">int</span><span class="p">)</span>
+ <span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">result</span><span class="o">=</span><span class="n">a</span> <span class="o">+</span> <span class="n">b</span><span class="p">)</span>
+
+<span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/&#39;</span><span class="p">)</span>
+<span class="k">def</span> <span class="nf">index</span><span class="p">():</span>
+ <span class="k">return</span> <span class="n">render_template</span><span class="p">(</span><span class="s">&#39;index.html&#39;</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>As you can see I also added an <cite>index</cite> method here that renders a
+template. This template will load jQuery as above and have a little form
+we can add two numbers and a link to trigger the function on the server
+side.</p>
+<p>Note that we are using the <a class="reference external" href="http://werkzeug.pocoo.org/docs/datastructures/#werkzeug.datastructures.MultiDict.get" title="(in Werkzeug v0.7)"><tt class="xref py py-meth docutils literal"><span class="pre">get()</span></tt></a> method here
+which will never fail. If the key is missing a default value (here <tt class="docutils literal"><span class="pre">0</span></tt>)
+is returned. Furthermore it can convert values to a specific type (like
+in our case <cite>int</cite>). This is especially handy for code that is
+triggered by a script (APIs, JavaScript etc.) because you don&#8217;t need
+special error reporting in that case.</p>
+</div>
+<div class="section" id="the-html">
+<h2>The HTML<a class="headerlink" href="#the-html" title="Permalink to this headline">¶</a></h2>
+<p>Your index.html template either has to extend a <cite>layout.html</cite> template with
+jQuery loaded and the <cite>$SCRIPT_ROOT</cite> variable set, or do that on the top.
+Here&#8217;s the HTML code needed for our little application (<cite>index.html</cite>).
+Notice that we also drop the script directly into the HTML here. It is
+usually a better idea to have that in a separate script file:</p>
+<div class="highlight-html"><div class="highlight"><pre><span class="nt">&lt;script </span><span class="na">type=</span><span class="s">text/javascript</span><span class="nt">&gt;</span>
+ <span class="nx">$</span><span class="p">(</span><span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
+ <span class="nx">$</span><span class="p">(</span><span class="s1">&#39;a#calculate&#39;</span><span class="p">).</span><span class="nx">bind</span><span class="p">(</span><span class="s1">&#39;click&#39;</span><span class="p">,</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
+ <span class="nx">$</span><span class="p">.</span><span class="nx">getJSON</span><span class="p">(</span><span class="nx">$SCRIPT_ROOT</span> <span class="o">+</span> <span class="s1">&#39;/_add_numbers&#39;</span><span class="p">,</span> <span class="p">{</span>
+ <span class="nx">a</span><span class="o">:</span> <span class="nx">$</span><span class="p">(</span><span class="s1">&#39;input[name=&quot;a&quot;]&#39;</span><span class="p">).</span><span class="nx">val</span><span class="p">(),</span>
+ <span class="nx">b</span><span class="o">:</span> <span class="nx">$</span><span class="p">(</span><span class="s1">&#39;input[name=&quot;b&quot;]&#39;</span><span class="p">).</span><span class="nx">val</span><span class="p">()</span>
+ <span class="p">},</span> <span class="kd">function</span><span class="p">(</span><span class="nx">data</span><span class="p">)</span> <span class="p">{</span>
+ <span class="nx">$</span><span class="p">(</span><span class="s2">&quot;#result&quot;</span><span class="p">).</span><span class="nx">text</span><span class="p">(</span><span class="nx">data</span><span class="p">.</span><span class="nx">result</span><span class="p">);</span>
+ <span class="p">});</span>
+ <span class="k">return</span> <span class="kc">false</span><span class="p">;</span>
+ <span class="p">});</span>
+ <span class="p">});</span>
+<span class="nt">&lt;/script&gt;</span>
+<span class="nt">&lt;h1&gt;</span>jQuery Example<span class="nt">&lt;/h1&gt;</span>
+<span class="nt">&lt;p&gt;&lt;input</span> <span class="na">type=</span><span class="s">text</span> <span class="na">size=</span><span class="s">5</span> <span class="na">name=</span><span class="s">a</span><span class="nt">&gt;</span> +
+ <span class="nt">&lt;input</span> <span class="na">type=</span><span class="s">text</span> <span class="na">size=</span><span class="s">5</span> <span class="na">name=</span><span class="s">b</span><span class="nt">&gt;</span> =
+ <span class="nt">&lt;span</span> <span class="na">id=</span><span class="s">result</span><span class="nt">&gt;</span>?<span class="nt">&lt;/span&gt;</span>
+<span class="nt">&lt;p&gt;&lt;a</span> <span class="na">href=</span><span class="s">#</span> <span class="na">id=</span><span class="s">calculate</span><span class="nt">&gt;</span>calculate server side<span class="nt">&lt;/a&gt;</span>
+</pre></div>
+</div>
+<p>I won&#8217;t got into detail here about how jQuery works, just a very quick
+explanation of the little bit of code above:</p>
+<ol class="arabic simple">
+<li><tt class="docutils literal"><span class="pre">$(function()</span> <span class="pre">{</span> <span class="pre">...</span> <span class="pre">})</span></tt> specifies code that should run once the
+browser is done loading the basic parts of the page.</li>
+<li><tt class="docutils literal"><span class="pre">$('selector')</span></tt> selects an element and lets you operate on it.</li>
+<li><tt class="docutils literal"><span class="pre">element.bind('event',</span> <span class="pre">func)</span></tt> specifies a function that should run
+when the user clicked on the element. If that function returns
+<cite>false</cite>, the default behaviour will not kick in (in this case, navigate
+to the <cite>#</cite> URL).</li>
+<li><tt class="docutils literal"><span class="pre">$.getJSON(url,</span> <span class="pre">data,</span> <span class="pre">func)</span></tt> sends a <cite>GET</cite> request to <cite>url</cite> and will
+send the contents of the <cite>data</cite> object as query parameters. Once the
+data arrived, it will call the given function with the return value as
+argument. Note that we can use the <cite>$SCRIPT_ROOT</cite> variable here that
+we set earlier.</li>
+</ol>
+<p>If you don&#8217;t get the whole picture, download the <a class="reference external" href="http://github.com/mitsuhiko/flask/tree/master/examples/jqueryexample">sourcecode
+for this example</a>
+from github.</p>
+</div>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="../index.html">
+ <img class="logo" src="../_static/flask.png" alt="Logo"/>
+</a></p>
+ <h3><a href="../index.html">Table Of Contents</a></h3>
+ <ul>
+<li><a class="reference internal" href="#">AJAX with jQuery</a><ul>
+<li><a class="reference internal" href="#loading-jquery">Loading jQuery</a></li>
+<li><a class="reference internal" href="#where-is-my-site">Where is My Site?</a></li>
+<li><a class="reference internal" href="#json-view-functions">JSON View Functions</a></li>
+<li><a class="reference internal" href="#the-html">The HTML</a></li>
+</ul>
+</li>
+</ul>
+<h3>Related Topics</h3>
+<ul>
+ <li><a href="../index.html">Documentation overview</a><ul>
+ <li><a href="index.html">Patterns for Flask</a><ul>
+ <li>Previous: <a href="flashing.html" title="previous chapter">Message Flashing</a></li>
+ <li>Next: <a href="errorpages.html" title="next chapter">Custom Error Pages</a></li>
+ </ul></li>
+ </ul></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="../_sources/patterns/jquery.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/patterns/lazyloading.html b/app/static/doc/flask-docs/patterns/lazyloading.html
new file mode 100644
index 0000000..982b86a
--- /dev/null
+++ b/app/static/doc/flask-docs/patterns/lazyloading.html
@@ -0,0 +1,214 @@
+
+<!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>Lazily Loading Views &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="../index.html" />
+ <link rel="up" title="Patterns for Flask" href="index.html" />
+ <link rel="next" title="MongoKit in Flask" href="mongokit.html" />
+ <link rel="prev" title="Custom Error Pages" href="errorpages.html" />
+
+
+ <link rel="apple-touch-icon" href="../_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="../_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <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="mongokit.html" title="MongoKit in Flask"
+ accesskey="N">next</a> |</li>
+ <li class="right" >
+ <a href="errorpages.html" title="Custom Error Pages"
+ accesskey="P">previous</a> |</li>
+ <li><a href="../index.html">Flask 0.8 documentation</a> &raquo;</li>
+ <li><a href="index.html" accesskey="U">Patterns for Flask</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="lazily-loading-views">
+<h1>Lazily Loading Views<a class="headerlink" href="#lazily-loading-views" title="Permalink to this headline">¶</a></h1>
+<p>Flask is usually used with the decorators. Decorators are simple and you
+have the URL right next to the function that is called for that specific
+URL. However there is a downside to this approach: it means all your code
+that uses decorators has to be imported upfront or Flask will never
+actually find your function.</p>
+<p>This can be a problem if your application has to import quick. It might
+have to do that on systems like Google&#8217;s App Engine or other systems. So
+if you suddenly notice that your application outgrows this approach you
+can fall back to a centralized URL mapping.</p>
+<p>The system that enables having a central URL map is the
+<a class="reference internal" href="../api.html#flask.Flask.add_url_rule" title="flask.Flask.add_url_rule"><tt class="xref py py-meth docutils literal"><span class="pre">add_url_rule()</span></tt></a> function. Instead of using decorators,
+you have a file that sets up the application with all URLs.</p>
+<div class="section" id="converting-to-centralized-url-map">
+<h2>Converting to Centralized URL Map<a class="headerlink" href="#converting-to-centralized-url-map" title="Permalink to this headline">¶</a></h2>
+<p>Imagine the current application looks somewhat like this:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">Flask</span>
+<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="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/&#39;</span><span class="p">)</span>
+<span class="k">def</span> <span class="nf">index</span><span class="p">():</span>
+ <span class="k">pass</span>
+
+<span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/user/&lt;username&gt;&#39;</span><span class="p">)</span>
+<span class="k">def</span> <span class="nf">user</span><span class="p">(</span><span class="n">username</span><span class="p">):</span>
+ <span class="k">pass</span>
+</pre></div>
+</div>
+<p>Then the centralized approach you would have one file with the views
+(<cite>views.py</cite>) but without any decorator:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">def</span> <span class="nf">index</span><span class="p">():</span>
+ <span class="k">pass</span>
+
+<span class="k">def</span> <span class="nf">user</span><span class="p">(</span><span class="n">username</span><span class="p">):</span>
+ <span class="k">pass</span>
+</pre></div>
+</div>
+<p>And then a file that sets up an application which maps the functions to
+URLs:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">Flask</span>
+<span class="kn">from</span> <span class="nn">yourapplication</span> <span class="kn">import</span> <span class="n">views</span>
+<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">app</span><span class="o">.</span><span class="n">add_url_rule</span><span class="p">(</span><span class="s">&#39;/&#39;</span><span class="p">,</span> <span class="n">view_func</span><span class="o">=</span><span class="n">views</span><span class="o">.</span><span class="n">index</span><span class="p">)</span>
+<span class="n">app</span><span class="o">.</span><span class="n">add_url_rule</span><span class="p">(</span><span class="s">&#39;/user/&lt;username&gt;&#39;</span><span class="p">,</span> <span class="n">view_func</span><span class="o">=</span><span class="n">views</span><span class="o">.</span><span class="n">user</span><span class="p">)</span>
+</pre></div>
+</div>
+</div>
+<div class="section" id="loading-late">
+<h2>Loading Late<a class="headerlink" href="#loading-late" title="Permalink to this headline">¶</a></h2>
+<p>So far we only split up the views and the routing, but the module is still
+loaded upfront. The trick to actually load the view function as needed.
+This can be accomplished with a helper class that behaves just like a
+function but internally imports the real function on first use:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">werkzeug</span> <span class="kn">import</span> <span class="n">import_string</span><span class="p">,</span> <span class="n">cached_property</span>
+
+<span class="k">class</span> <span class="nc">LazyView</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
+
+ <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">import_name</span><span class="p">):</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">__module__</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">__name__</span> <span class="o">=</span> <span class="n">import_name</span><span class="o">.</span><span class="n">rsplit</span><span class="p">(</span><span class="s">&#39;.&#39;</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">import_name</span> <span class="o">=</span> <span class="n">import_name</span>
+
+ <span class="nd">@cached_property</span>
+ <span class="k">def</span> <span class="nf">view</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+ <span class="k">return</span> <span class="n">import_string</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">import_name</span><span class="p">)</span>
+
+ <span class="k">def</span> <span class="nf">__call__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
+ <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">view</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>What&#8217;s important here is is that <cite>__module__</cite> and <cite>__name__</cite> are properly
+set. This is used by Flask internally to figure out how to name the
+URL rules in case you don&#8217;t provide a name for the rule yourself.</p>
+<p>Then you can define your central place to combine the views like this:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">Flask</span>
+<span class="kn">from</span> <span class="nn">yourapplication.helpers</span> <span class="kn">import</span> <span class="n">LazyView</span>
+<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">app</span><span class="o">.</span><span class="n">add_url_rule</span><span class="p">(</span><span class="s">&#39;/&#39;</span><span class="p">,</span>
+ <span class="n">view_func</span><span class="o">=</span><span class="n">LazyView</span><span class="p">(</span><span class="s">&#39;yourapplication.views.index&#39;</span><span class="p">))</span>
+<span class="n">app</span><span class="o">.</span><span class="n">add_url_rule</span><span class="p">(</span><span class="s">&#39;/user/&lt;username&gt;&#39;</span><span class="p">,</span>
+ <span class="n">view_func</span><span class="o">=</span><span class="n">LazyView</span><span class="p">(</span><span class="s">&#39;yourapplication.views.user&#39;</span><span class="p">))</span>
+</pre></div>
+</div>
+<p>You can further optimize this in terms of amount of keystrokes needed to
+write this by having a function that calls into
+<a class="reference internal" href="../api.html#flask.Flask.add_url_rule" title="flask.Flask.add_url_rule"><tt class="xref py py-meth docutils literal"><span class="pre">add_url_rule()</span></tt></a> by prefixing a string with the project
+name and a dot, and by wrapping <cite>view_func</cite> in a <cite>LazyView</cite> as needed:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">def</span> <span class="nf">url</span><span class="p">(</span><span class="n">url_rule</span><span class="p">,</span> <span class="n">import_name</span><span class="p">,</span> <span class="o">**</span><span class="n">options</span><span class="p">):</span>
+ <span class="n">view</span> <span class="o">=</span> <span class="n">LazyView</span><span class="p">(</span><span class="s">&#39;yourapplication.&#39;</span> <span class="o">+</span> <span class="n">import_name</span><span class="p">)</span>
+ <span class="n">app</span><span class="o">.</span><span class="n">add_url_rule</span><span class="p">(</span><span class="n">url_rule</span><span class="p">,</span> <span class="n">view_func</span><span class="o">=</span><span class="n">view</span><span class="p">,</span> <span class="o">**</span><span class="n">options</span><span class="p">)</span>
+
+<span class="n">url</span><span class="p">(</span><span class="s">&#39;/&#39;</span><span class="p">,</span> <span class="s">&#39;views.index&#39;</span><span class="p">)</span>
+<span class="n">url</span><span class="p">(</span><span class="s">&#39;/user/&lt;username&gt;&#39;</span><span class="p">,</span> <span class="s">&#39;views.user&#39;</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>One thing to keep in mind is that before and after request handlers have
+to be in a file that is imported upfront to work properly on the first
+request. The same goes for any kind of remaining decorator.</p>
+</div>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="../index.html">
+ <img class="logo" src="../_static/flask.png" alt="Logo"/>
+</a></p>
+ <h3><a href="../index.html">Table Of Contents</a></h3>
+ <ul>
+<li><a class="reference internal" href="#">Lazily Loading Views</a><ul>
+<li><a class="reference internal" href="#converting-to-centralized-url-map">Converting to Centralized URL Map</a></li>
+<li><a class="reference internal" href="#loading-late">Loading Late</a></li>
+</ul>
+</li>
+</ul>
+<h3>Related Topics</h3>
+<ul>
+ <li><a href="../index.html">Documentation overview</a><ul>
+ <li><a href="index.html">Patterns for Flask</a><ul>
+ <li>Previous: <a href="errorpages.html" title="previous chapter">Custom Error Pages</a></li>
+ <li>Next: <a href="mongokit.html" title="next chapter">MongoKit in Flask</a></li>
+ </ul></li>
+ </ul></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="../_sources/patterns/lazyloading.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/patterns/mongokit.html b/app/static/doc/flask-docs/patterns/mongokit.html
new file mode 100644
index 0000000..fa851dc
--- /dev/null
+++ b/app/static/doc/flask-docs/patterns/mongokit.html
@@ -0,0 +1,241 @@
+
+<!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>MongoKit in Flask &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="../index.html" />
+ <link rel="up" title="Patterns for Flask" href="index.html" />
+ <link rel="next" title="Adding a favicon" href="favicon.html" />
+ <link rel="prev" title="Lazily Loading Views" href="lazyloading.html" />
+
+
+ <link rel="apple-touch-icon" href="../_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="../_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <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="favicon.html" title="Adding a favicon"
+ accesskey="N">next</a> |</li>
+ <li class="right" >
+ <a href="lazyloading.html" title="Lazily Loading Views"
+ accesskey="P">previous</a> |</li>
+ <li><a href="../index.html">Flask 0.8 documentation</a> &raquo;</li>
+ <li><a href="index.html" accesskey="U">Patterns for Flask</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="mongokit-in-flask">
+<h1>MongoKit in Flask<a class="headerlink" href="#mongokit-in-flask" title="Permalink to this headline">¶</a></h1>
+<p>Using a document database rather than a full DBMS gets more common these days.
+This pattern shows how to use MongoKit, a document mapper library, to
+integrate with MongoDB.</p>
+<p>This pattern requires a running MongoDB server and the MongoKit library
+installed.</p>
+<p>There are two very common ways to use MongoKit. I will outline each of them
+here:</p>
+<div class="section" id="declarative">
+<h2>Declarative<a class="headerlink" href="#declarative" title="Permalink to this headline">¶</a></h2>
+<p>The default behaviour of MongoKit is the declarative one that is based on
+common ideas from Django or the SQLAlchemy declarative extension.</p>
+<p>Here an example <cite>app.py</cite> module for your application:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">Flask</span>
+<span class="kn">from</span> <span class="nn">mongokit</span> <span class="kn">import</span> <span class="n">Connection</span><span class="p">,</span> <span class="n">Document</span>
+
+<span class="c"># configuration</span>
+<span class="n">MONGODB_HOST</span> <span class="o">=</span> <span class="s">&#39;localhost&#39;</span>
+<span class="n">MONGODB_PORT</span> <span class="o">=</span> <span class="mi">27017</span>
+
+<span class="c"># create the little application object</span>
+<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">app</span><span class="o">.</span><span class="n">config</span><span class="o">.</span><span class="n">from_object</span><span class="p">(</span><span class="n">__name__</span><span class="p">)</span>
+
+<span class="c"># connect to the database</span>
+<span class="n">connection</span> <span class="o">=</span> <span class="n">Connection</span><span class="p">(</span><span class="n">app</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s">&#39;MONGODB_HOST&#39;</span><span class="p">],</span>
+ <span class="n">app</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s">&#39;MONGODB_PORT&#39;</span><span class="p">])</span>
+</pre></div>
+</div>
+<p>To define your models, just subclass the <cite>Document</cite> class that is imported
+from MongoKit. If you&#8217;ve seen the SQLAlchemy pattern you may wonder why we do
+not have a session and even do not define a <cite>init_db</cite> function here. On the
+one hand, MongoKit does not have something like a session. This sometimes
+makes it more to type but also makes it blazingly fast. On the other hand,
+MongoDB is schemaless. This means you can modify the data structure from one
+insert query to the next without any problem. MongoKit is just schemaless
+too, but implements some validation to ensure data integrity.</p>
+<p>Here is an example document (put this also into <cite>app.py</cite>, e.g.):</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">def</span> <span class="nf">max_length</span><span class="p">(</span><span class="n">length</span><span class="p">):</span>
+ <span class="k">def</span> <span class="nf">validate</span><span class="p">(</span><span class="n">value</span><span class="p">):</span>
+ <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">value</span><span class="p">)</span> <span class="o">&lt;=</span> <span class="n">length</span><span class="p">:</span>
+ <span class="k">return</span> <span class="bp">True</span>
+ <span class="k">raise</span> <span class="ne">Exception</span><span class="p">(</span><span class="s">&#39;</span><span class="si">%s</span><span class="s"> must be at most </span><span class="si">%s</span><span class="s"> characters long&#39;</span> <span class="o">%</span> <span class="n">length</span><span class="p">)</span>
+ <span class="k">return</span> <span class="n">validate</span>
+
+<span class="k">class</span> <span class="nc">User</span><span class="p">(</span><span class="n">Document</span><span class="p">):</span>
+ <span class="n">structure</span> <span class="o">=</span> <span class="p">{</span>
+ <span class="s">&#39;name&#39;</span><span class="p">:</span> <span class="nb">unicode</span><span class="p">,</span>
+ <span class="s">&#39;email&#39;</span><span class="p">:</span> <span class="nb">unicode</span><span class="p">,</span>
+ <span class="p">}</span>
+ <span class="n">validators</span> <span class="o">=</span> <span class="p">{</span>
+ <span class="s">&#39;name&#39;</span><span class="p">:</span> <span class="n">max_length</span><span class="p">(</span><span class="mi">50</span><span class="p">),</span>
+ <span class="s">&#39;email&#39;</span><span class="p">:</span> <span class="n">max_length</span><span class="p">(</span><span class="mi">120</span><span class="p">)</span>
+ <span class="p">}</span>
+ <span class="n">use_dot_notation</span> <span class="o">=</span> <span class="bp">True</span>
+ <span class="k">def</span> <span class="nf">__repr__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+ <span class="k">return</span> <span class="s">&#39;&lt;User </span><span class="si">%r</span><span class="s">&gt;&#39;</span> <span class="o">%</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">name</span><span class="p">)</span>
+
+<span class="c"># register the User document with our current connection</span>
+<span class="n">connection</span><span class="o">.</span><span class="n">register</span><span class="p">([</span><span class="n">User</span><span class="p">])</span>
+</pre></div>
+</div>
+<p>This example shows you how to define your schema (named structure), a
+validator for the maximum character length and uses a special MongoKit feature
+called <cite>use_dot_notation</cite>. Per default MongoKit behaves like a python
+dictionary but with <cite>use_dot_notation</cite> set to <cite>True</cite> you can use your
+documents like you use models in nearly any other ORM by using dots to
+separate between attributes.</p>
+<p>You can insert entries into the database like this:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">yourapplication.database</span> <span class="kn">import</span> <span class="n">connection</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">yourapplication.models</span> <span class="kn">import</span> <span class="n">User</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">collection</span> <span class="o">=</span> <span class="n">connection</span><span class="p">[</span><span class="s">&#39;test&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">users</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">user</span> <span class="o">=</span> <span class="n">collection</span><span class="o">.</span><span class="n">User</span><span class="p">()</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">user</span><span class="p">[</span><span class="s">&#39;name&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s">u&#39;admin&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">user</span><span class="p">[</span><span class="s">&#39;email&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s">u&#39;admin@localhost&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">user</span><span class="o">.</span><span class="n">save</span><span class="p">()</span>
+</pre></div>
+</div>
+<p>Note that MongoKit is kinda strict with used column types, you must not use a
+common <cite>str</cite> type for either <cite>name</cite> or <cite>email</cite> but unicode.</p>
+<p>Querying is simple as well:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="nb">list</span><span class="p">(</span><span class="n">collection</span><span class="o">.</span><span class="n">User</span><span class="o">.</span><span class="n">find</span><span class="p">())</span>
+<span class="go">[&lt;User u&#39;admin&#39;&gt;]</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">collection</span><span class="o">.</span><span class="n">User</span><span class="o">.</span><span class="n">find_one</span><span class="p">({</span><span class="s">&#39;name&#39;</span><span class="p">:</span> <span class="s">u&#39;admin&#39;</span><span class="p">})</span>
+<span class="go">&lt;User u&#39;admin&#39;&gt;</span>
+</pre></div>
+</div>
+</div>
+<div class="section" id="pymongo-compatibility-layer">
+<h2>PyMongo Compatibility Layer<a class="headerlink" href="#pymongo-compatibility-layer" title="Permalink to this headline">¶</a></h2>
+<p>If you just want to use PyMongo, you can do that with MongoKit as well. You
+may use this process if you need the best performance to get. Note that this
+example does not show how to couple it with Flask, see the above MongoKit code
+for examples:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">MongoKit</span> <span class="kn">import</span> <span class="n">Connection</span>
+
+<span class="n">connection</span> <span class="o">=</span> <span class="n">Connection</span><span class="p">()</span>
+</pre></div>
+</div>
+<p>To insert data you can use the <cite>insert</cite> method. We have to get a
+collection first, this is somewhat the same as a table in the SQL world.</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">collection</span> <span class="o">=</span> <span class="n">connection</span><span class="p">[</span><span class="s">&#39;test&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">users</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">user</span> <span class="o">=</span> <span class="p">{</span><span class="s">&#39;name&#39;</span><span class="p">:</span> <span class="s">u&#39;admin&#39;</span><span class="p">,</span> <span class="s">&#39;email&#39;</span><span class="p">:</span> <span class="s">u&#39;admin@localhost&#39;</span><span class="p">}</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">collection</span><span class="o">.</span><span class="n">insert</span><span class="p">(</span><span class="n">user</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>print list(collection.find())
+print collection.find_one({&#8216;name&#8217;: u&#8217;admin&#8217;})</p>
+<p>MongoKit will automatically commit for us.</p>
+<p>To query your database, you use the collection directly:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="nb">list</span><span class="p">(</span><span class="n">collection</span><span class="o">.</span><span class="n">find</span><span class="p">())</span>
+<span class="go">[{u&#39;_id&#39;: ObjectId(&#39;4c271729e13823182f000000&#39;), u&#39;name&#39;: u&#39;admin&#39;, u&#39;email&#39;: u&#39;admin@localhost&#39;}]</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">collection</span><span class="o">.</span><span class="n">find_one</span><span class="p">({</span><span class="s">&#39;name&#39;</span><span class="p">:</span> <span class="s">u&#39;admin&#39;</span><span class="p">})</span>
+<span class="go">{u&#39;_id&#39;: ObjectId(&#39;4c271729e13823182f000000&#39;), u&#39;name&#39;: u&#39;admin&#39;, u&#39;email&#39;: u&#39;admin@localhost&#39;}</span>
+</pre></div>
+</div>
+<p>These results are also dict-like objects:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">r</span> <span class="o">=</span> <span class="n">collection</span><span class="o">.</span><span class="n">find_one</span><span class="p">({</span><span class="s">&#39;name&#39;</span><span class="p">:</span> <span class="s">u&#39;admin&#39;</span><span class="p">})</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">r</span><span class="p">[</span><span class="s">&#39;email&#39;</span><span class="p">]</span>
+<span class="go">u&#39;admin@localhost&#39;</span>
+</pre></div>
+</div>
+<p>For more information about MongoKit, head over to the
+<a class="reference external" href="http://bytebucket.org/namlook/mongokit/">website</a>.</p>
+</div>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="../index.html">
+ <img class="logo" src="../_static/flask.png" alt="Logo"/>
+</a></p>
+ <h3><a href="../index.html">Table Of Contents</a></h3>
+ <ul>
+<li><a class="reference internal" href="#">MongoKit in Flask</a><ul>
+<li><a class="reference internal" href="#declarative">Declarative</a></li>
+<li><a class="reference internal" href="#pymongo-compatibility-layer">PyMongo Compatibility Layer</a></li>
+</ul>
+</li>
+</ul>
+<h3>Related Topics</h3>
+<ul>
+ <li><a href="../index.html">Documentation overview</a><ul>
+ <li><a href="index.html">Patterns for Flask</a><ul>
+ <li>Previous: <a href="lazyloading.html" title="previous chapter">Lazily Loading Views</a></li>
+ <li>Next: <a href="favicon.html" title="next chapter">Adding a favicon</a></li>
+ </ul></li>
+ </ul></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="../_sources/patterns/mongokit.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/patterns/packages.html b/app/static/doc/flask-docs/patterns/packages.html
new file mode 100644
index 0000000..9704b14
--- /dev/null
+++ b/app/static/doc/flask-docs/patterns/packages.html
@@ -0,0 +1,219 @@
+
+<!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>Larger Applications &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="../index.html" />
+ <link rel="up" title="Patterns for Flask" href="index.html" />
+ <link rel="next" title="Application Factories" href="appfactories.html" />
+ <link rel="prev" title="Patterns for Flask" href="index.html" />
+
+
+ <link rel="apple-touch-icon" href="../_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="../_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <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="appfactories.html" title="Application Factories"
+ accesskey="N">next</a> |</li>
+ <li class="right" >
+ <a href="index.html" title="Patterns for Flask"
+ accesskey="P">previous</a> |</li>
+ <li><a href="../index.html">Flask 0.8 documentation</a> &raquo;</li>
+ <li><a href="index.html" accesskey="U">Patterns for Flask</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="larger-applications">
+<span id="id1"></span><h1>Larger Applications<a class="headerlink" href="#larger-applications" title="Permalink to this headline">¶</a></h1>
+<p>For larger applications it&#8217;s a good idea to use a package instead of a
+module. That is quite simple. Imagine a small application looks like
+this:</p>
+<div class="highlight-python"><pre>/yourapplication
+ /yourapplication.py
+ /static
+ /style.css
+ /templates
+ layout.html
+ index.html
+ login.html
+ ...</pre>
+</div>
+<div class="section" id="simple-packages">
+<h2>Simple Packages<a class="headerlink" href="#simple-packages" title="Permalink to this headline">¶</a></h2>
+<p>To convert that into a larger one, just create a new folder
+<cite>yourapplication</cite> inside the existing one and move everything below it.
+Then rename <cite>yourapplication.py</cite> to <cite>__init__.py</cite>. (Make sure to delete
+all <cite>.pyc</cite> files first, otherwise things would most likely break)</p>
+<p>You should then end up with something like that:</p>
+<div class="highlight-python"><pre>/yourapplication
+ /yourapplication
+ /__init__.py
+ /static
+ /style.css
+ /templates
+ layout.html
+ index.html
+ login.html
+ ...</pre>
+</div>
+<p>But how do you run your application now? The naive <tt class="docutils literal"><span class="pre">python</span>
+<span class="pre">yourapplication/__init__.py</span></tt> will not work. Let&#8217;s just say that Python
+does not want modules in packages to be the startup file. But that is not
+a big problem, just add a new file called <cite>runserver.py</cite> next to the inner
+<cite>yourapplication</cite> folder with the following contents:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">yourapplication</span> <span class="kn">import</span> <span class="n">app</span>
+<span class="n">app</span><span class="o">.</span><span class="n">run</span><span class="p">(</span><span class="n">debug</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>What did we gain from this? Now we can restructure the application a bit
+into multiple modules. The only thing you have to remember is the
+following quick checklist:</p>
+<ol class="arabic simple">
+<li>the <cite>Flask</cite> application object creation has to be in the
+<cite>__init__.py</cite> file. That way each module can import it safely and the
+<cite>__name__</cite> variable will resolve to the correct package.</li>
+<li>all the view functions (the ones with a <a class="reference internal" href="../api.html#flask.Flask.route" title="flask.Flask.route"><tt class="xref py py-meth docutils literal"><span class="pre">route()</span></tt></a>
+decorator on top) have to be imported when in the <cite>__init__.py</cite> file.
+Not the object itself, but the module it is in. Import the view module
+<strong>after the application object is created</strong>.</li>
+</ol>
+<p>Here&#8217;s an example <cite>__init__.py</cite>:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">Flask</span>
+<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="kn">import</span> <span class="nn">yourapplication.views</span>
+</pre></div>
+</div>
+<p>And this is what <cite>views.py</cite> would look like:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">yourapplication</span> <span class="kn">import</span> <span class="n">app</span>
+
+<span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/&#39;</span><span class="p">)</span>
+<span class="k">def</span> <span class="nf">index</span><span class="p">():</span>
+ <span class="k">return</span> <span class="s">&#39;Hello World!&#39;</span>
+</pre></div>
+</div>
+<p>You should then end up with something like that:</p>
+<div class="highlight-python"><pre>/yourapplication
+ /runserver.py
+ /yourapplication
+ /__init__.py
+ /views.py
+ /static
+ /style.css
+ /templates
+ layout.html
+ index.html
+ login.html
+ ...</pre>
+</div>
+<div class="admonition-circular-imports admonition ">
+<p class="first admonition-title">Circular Imports</p>
+<p>Every Python programmer hates them, and yet we just added some:
+circular imports (That&#8217;s when two modules depend on each other. In this
+case <cite>views.py</cite> depends on <cite>__init__.py</cite>). Be advised that this is a
+bad idea in general but here it is actually fine. The reason for this is
+that we are not actually using the views in <cite>__init__.py</cite> and just
+ensuring the module is imported and we are doing that at the bottom of
+the file.</p>
+<p class="last">There are still some problems with that approach but if you want to use
+decorators there is no way around that. Check out the
+<a class="reference internal" href="../becomingbig.html#becomingbig"><em>Becoming Big</em></a> section for some inspiration how to deal with that.</p>
+</div>
+</div>
+<div class="section" id="working-with-blueprints">
+<span id="working-with-modules"></span><h2>Working with Blueprints<a class="headerlink" href="#working-with-blueprints" title="Permalink to this headline">¶</a></h2>
+<p>If you have larger applications it&#8217;s recommended to divide them into
+smaller groups where each group is implemented with the help of a
+blueprint. For a gentle introduction into this topic refer to the
+<a class="reference internal" href="../blueprints.html#blueprints"><em>Modular Applications with Blueprints</em></a> chapter of the documentation.</p>
+</div>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="../index.html">
+ <img class="logo" src="../_static/flask.png" alt="Logo"/>
+</a></p>
+ <h3><a href="../index.html">Table Of Contents</a></h3>
+ <ul>
+<li><a class="reference internal" href="#">Larger Applications</a><ul>
+<li><a class="reference internal" href="#simple-packages">Simple Packages</a></li>
+<li><a class="reference internal" href="#working-with-blueprints">Working with Blueprints</a></li>
+</ul>
+</li>
+</ul>
+<h3>Related Topics</h3>
+<ul>
+ <li><a href="../index.html">Documentation overview</a><ul>
+ <li><a href="index.html">Patterns for Flask</a><ul>
+ <li>Previous: <a href="index.html" title="previous chapter">Patterns for Flask</a></li>
+ <li>Next: <a href="appfactories.html" title="next chapter">Application Factories</a></li>
+ </ul></li>
+ </ul></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="../_sources/patterns/packages.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/patterns/sqlalchemy.html b/app/static/doc/flask-docs/patterns/sqlalchemy.html
new file mode 100644
index 0000000..8fd4363
--- /dev/null
+++ b/app/static/doc/flask-docs/patterns/sqlalchemy.html
@@ -0,0 +1,310 @@
+
+<!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>SQLAlchemy in Flask &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="../index.html" />
+ <link rel="up" title="Patterns for Flask" href="index.html" />
+ <link rel="next" title="Uploading Files" href="fileuploads.html" />
+ <link rel="prev" title="Using SQLite 3 with Flask" href="sqlite3.html" />
+
+
+ <link rel="apple-touch-icon" href="../_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="../_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <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="fileuploads.html" title="Uploading Files"
+ accesskey="N">next</a> |</li>
+ <li class="right" >
+ <a href="sqlite3.html" title="Using SQLite 3 with Flask"
+ accesskey="P">previous</a> |</li>
+ <li><a href="../index.html">Flask 0.8 documentation</a> &raquo;</li>
+ <li><a href="index.html" accesskey="U">Patterns for Flask</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="sqlalchemy-in-flask">
+<span id="sqlalchemy-pattern"></span><h1>SQLAlchemy in Flask<a class="headerlink" href="#sqlalchemy-in-flask" title="Permalink to this headline">¶</a></h1>
+<p>Many people prefer <a class="reference external" href="http://www.sqlalchemy.org/">SQLAlchemy</a> for database access. In this case it&#8217;s
+encouraged to use a package instead of a module for your flask application
+and drop the models into a separate module (<a class="reference internal" href="packages.html#larger-applications"><em>Larger Applications</em></a>).
+While that is not necessary, it makes a lot of sense.</p>
+<p>There are four very common ways to use SQLAlchemy. I will outline each
+of them here:</p>
+<div class="section" id="flask-sqlalchemy-extension">
+<h2>Flask-SQLAlchemy Extension<a class="headerlink" href="#flask-sqlalchemy-extension" title="Permalink to this headline">¶</a></h2>
+<p>Because SQLAlchemy is a common database abstraction layer and object
+relational mapper that requires a little bit of configuration effort,
+there is a Flask extension that handles that for you. This is recommended
+if you want to get started quickly.</p>
+<p>You can download <a class="reference external" href="http://packages.python.org/Flask-SQLAlchemy/">Flask-SQLAlchemy</a> from <a class="reference external" href="http://pypi.python.org/pypi/Flask-SQLAlchemy">PyPI</a>.</p>
+</div>
+<div class="section" id="declarative">
+<h2>Declarative<a class="headerlink" href="#declarative" title="Permalink to this headline">¶</a></h2>
+<p>The declarative extension in SQLAlchemy is the most recent method of using
+SQLAlchemy. It allows you to define tables and models in one go, similar
+to how Django works. In addition to the following text I recommend the
+official documentation on the <a class="reference external" href="http://www.sqlalchemy.org/docs/orm/extensions/declarative.html">declarative</a> extension.</p>
+<p>Here the example <cite>database.py</cite> module for your application:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">sqlalchemy</span> <span class="kn">import</span> <span class="n">create_engine</span>
+<span class="kn">from</span> <span class="nn">sqlalchemy.orm</span> <span class="kn">import</span> <span class="n">scoped_session</span><span class="p">,</span> <span class="n">sessionmaker</span>
+<span class="kn">from</span> <span class="nn">sqlalchemy.ext.declarative</span> <span class="kn">import</span> <span class="n">declarative_base</span>
+
+<span class="n">engine</span> <span class="o">=</span> <span class="n">create_engine</span><span class="p">(</span><span class="s">&#39;sqlite:////tmp/test.db&#39;</span><span class="p">,</span> <span class="n">convert_unicode</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
+<span class="n">db_session</span> <span class="o">=</span> <span class="n">scoped_session</span><span class="p">(</span><span class="n">sessionmaker</span><span class="p">(</span><span class="n">autocommit</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span>
+ <span class="n">autoflush</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span>
+ <span class="n">bind</span><span class="o">=</span><span class="n">engine</span><span class="p">))</span>
+<span class="n">Base</span> <span class="o">=</span> <span class="n">declarative_base</span><span class="p">()</span>
+<span class="n">Base</span><span class="o">.</span><span class="n">query</span> <span class="o">=</span> <span class="n">db_session</span><span class="o">.</span><span class="n">query_property</span><span class="p">()</span>
+
+<span class="k">def</span> <span class="nf">init_db</span><span class="p">():</span>
+ <span class="c"># import all modules here that might define models so that</span>
+ <span class="c"># they will be registered properly on the metadata. Otherwise</span>
+ <span class="c"># you will have to import them first before calling init_db()</span>
+ <span class="kn">import</span> <span class="nn">yourapplication.models</span>
+ <span class="n">Base</span><span class="o">.</span><span class="n">metadata</span><span class="o">.</span><span class="n">create_all</span><span class="p">(</span><span class="n">bind</span><span class="o">=</span><span class="n">engine</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>To define your models, just subclass the <cite>Base</cite> class that was created by
+the code above. If you are wondering why we don&#8217;t have to care about
+threads here (like we did in the SQLite3 example above with the
+<a class="reference internal" href="../api.html#flask.g" title="flask.g"><tt class="xref py py-data docutils literal"><span class="pre">g</span></tt></a> object): that&#8217;s because SQLAlchemy does that for us
+already with the <tt class="xref py py-class docutils literal"><span class="pre">scoped_session</span></tt>.</p>
+<p>To use SQLAlchemy in a declarative way with your application, you just
+have to put the following code into your application module. Flask will
+automatically remove database sessions at the end of the request for you:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">yourapplication.database</span> <span class="kn">import</span> <span class="n">db_session</span>
+
+<span class="nd">@app.teardown_request</span>
+<span class="k">def</span> <span class="nf">shutdown_session</span><span class="p">(</span><span class="n">exception</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+ <span class="n">db_session</span><span class="o">.</span><span class="n">remove</span><span class="p">()</span>
+</pre></div>
+</div>
+<p>Here is an example model (put this into <cite>models.py</cite>, e.g.):</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">sqlalchemy</span> <span class="kn">import</span> <span class="n">Column</span><span class="p">,</span> <span class="n">Integer</span><span class="p">,</span> <span class="n">String</span>
+<span class="kn">from</span> <span class="nn">yourapplication.database</span> <span class="kn">import</span> <span class="n">Base</span>
+
+<span class="k">class</span> <span class="nc">User</span><span class="p">(</span><span class="n">Base</span><span class="p">):</span>
+ <span class="n">__tablename__</span> <span class="o">=</span> <span class="s">&#39;users&#39;</span>
+ <span class="nb">id</span> <span class="o">=</span> <span class="n">Column</span><span class="p">(</span><span class="n">Integer</span><span class="p">,</span> <span class="n">primary_key</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
+ <span class="n">name</span> <span class="o">=</span> <span class="n">Column</span><span class="p">(</span><span class="n">String</span><span class="p">(</span><span class="mi">50</span><span class="p">),</span> <span class="n">unique</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
+ <span class="n">email</span> <span class="o">=</span> <span class="n">Column</span><span class="p">(</span><span class="n">String</span><span class="p">(</span><span class="mi">120</span><span class="p">),</span> <span class="n">unique</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
+
+ <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">email</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">name</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">email</span> <span class="o">=</span> <span class="n">email</span>
+
+ <span class="k">def</span> <span class="nf">__repr__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+ <span class="k">return</span> <span class="s">&#39;&lt;User </span><span class="si">%r</span><span class="s">&gt;&#39;</span> <span class="o">%</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">name</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>To create the database you can use the <cite>init_db</cite> function:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">yourapplication.database</span> <span class="kn">import</span> <span class="n">init_db</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">init_db</span><span class="p">()</span>
+</pre></div>
+</div>
+<p>You can insert entries into the database like this:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">yourapplication.database</span> <span class="kn">import</span> <span class="n">db_session</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">yourapplication.models</span> <span class="kn">import</span> <span class="n">User</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">u</span> <span class="o">=</span> <span class="n">User</span><span class="p">(</span><span class="s">&#39;admin&#39;</span><span class="p">,</span> <span class="s">&#39;admin@localhost&#39;</span><span class="p">)</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">db_session</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">u</span><span class="p">)</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">db_session</span><span class="o">.</span><span class="n">commit</span><span class="p">()</span>
+</pre></div>
+</div>
+<p>Querying is simple as well:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">User</span><span class="o">.</span><span class="n">query</span><span class="o">.</span><span class="n">all</span><span class="p">()</span>
+<span class="go">[&lt;User u&#39;admin&#39;&gt;]</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">User</span><span class="o">.</span><span class="n">query</span><span class="o">.</span><span class="n">filter</span><span class="p">(</span><span class="n">User</span><span class="o">.</span><span class="n">name</span> <span class="o">==</span> <span class="s">&#39;admin&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">first</span><span class="p">()</span>
+<span class="go">&lt;User u&#39;admin&#39;&gt;</span>
+</pre></div>
+</div>
+</div>
+<div class="section" id="manual-object-relational-mapping">
+<h2>Manual Object Relational Mapping<a class="headerlink" href="#manual-object-relational-mapping" title="Permalink to this headline">¶</a></h2>
+<p>Manual object relational mapping has a few upsides and a few downsides
+versus the declarative approach from above. The main difference is that
+you define tables and classes separately and map them together. It&#8217;s more
+flexible but a little more to type. In general it works like the
+declarative approach, so make sure to also split up your application into
+multiple modules in a package.</p>
+<p>Here is an example <cite>database.py</cite> module for your application:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">sqlalchemy</span> <span class="kn">import</span> <span class="n">create_engine</span><span class="p">,</span> <span class="n">MetaData</span>
+<span class="kn">from</span> <span class="nn">sqlalchemy.orm</span> <span class="kn">import</span> <span class="n">scoped_session</span><span class="p">,</span> <span class="n">sessionmaker</span>
+
+<span class="n">engine</span> <span class="o">=</span> <span class="n">create_engine</span><span class="p">(</span><span class="s">&#39;sqlite:////tmp/test.db&#39;</span><span class="p">,</span> <span class="n">convert_unicode</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
+<span class="n">metadata</span> <span class="o">=</span> <span class="n">MetaData</span><span class="p">()</span>
+<span class="n">db_session</span> <span class="o">=</span> <span class="n">scoped_session</span><span class="p">(</span><span class="n">sessionmaker</span><span class="p">(</span><span class="n">autocommit</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span>
+ <span class="n">autoflush</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span>
+ <span class="n">bind</span><span class="o">=</span><span class="n">engine</span><span class="p">))</span>
+<span class="k">def</span> <span class="nf">init_db</span><span class="p">():</span>
+ <span class="n">metadata</span><span class="o">.</span><span class="n">create_all</span><span class="p">(</span><span class="n">bind</span><span class="o">=</span><span class="n">engine</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>As for the declarative approach you need to close the session after
+each request. Put this into your application module:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">yourapplication.database</span> <span class="kn">import</span> <span class="n">db_session</span>
+
+<span class="nd">@app.teardown_request</span>
+<span class="k">def</span> <span class="nf">shutdown_session</span><span class="p">(</span><span class="n">exception</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+ <span class="n">db_session</span><span class="o">.</span><span class="n">remove</span><span class="p">()</span>
+</pre></div>
+</div>
+<p>Here is an example table and model (put this into <cite>models.py</cite>):</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">sqlalchemy</span> <span class="kn">import</span> <span class="n">Table</span><span class="p">,</span> <span class="n">Column</span><span class="p">,</span> <span class="n">Integer</span><span class="p">,</span> <span class="n">String</span>
+<span class="kn">from</span> <span class="nn">sqlalchemy.orm</span> <span class="kn">import</span> <span class="n">mapper</span>
+<span class="kn">from</span> <span class="nn">yourapplication.database</span> <span class="kn">import</span> <span class="n">metadata</span><span class="p">,</span> <span class="n">db_session</span>
+
+<span class="k">class</span> <span class="nc">User</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
+ <span class="n">query</span> <span class="o">=</span> <span class="n">db_session</span><span class="o">.</span><span class="n">query_property</span><span class="p">()</span>
+
+ <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">email</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">name</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">email</span> <span class="o">=</span> <span class="n">email</span>
+
+ <span class="k">def</span> <span class="nf">__repr__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+ <span class="k">return</span> <span class="s">&#39;&lt;User </span><span class="si">%r</span><span class="s">&gt;&#39;</span> <span class="o">%</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">email</span><span class="p">)</span>
+
+<span class="n">users</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="s">&#39;users&#39;</span><span class="p">,</span> <span class="n">metadata</span><span class="p">,</span>
+ <span class="n">Column</span><span class="p">(</span><span class="s">&#39;id&#39;</span><span class="p">,</span> <span class="n">Integer</span><span class="p">,</span> <span class="n">primary_key</span><span class="o">=</span><span class="bp">True</span><span class="p">),</span>
+ <span class="n">Column</span><span class="p">(</span><span class="s">&#39;name&#39;</span><span class="p">,</span> <span class="n">String</span><span class="p">(</span><span class="mi">50</span><span class="p">),</span> <span class="n">unique</span><span class="o">=</span><span class="bp">True</span><span class="p">),</span>
+ <span class="n">Column</span><span class="p">(</span><span class="s">&#39;email&#39;</span><span class="p">,</span> <span class="n">String</span><span class="p">(</span><span class="mi">120</span><span class="p">),</span> <span class="n">unique</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
+<span class="p">)</span>
+<span class="n">mapper</span><span class="p">(</span><span class="n">User</span><span class="p">,</span> <span class="n">users</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>Querying and inserting works exactly the same as in the example above.</p>
+</div>
+<div class="section" id="sql-abstraction-layer">
+<h2>SQL Abstraction Layer<a class="headerlink" href="#sql-abstraction-layer" title="Permalink to this headline">¶</a></h2>
+<p>If you just want to use the database system (and SQL) abstraction layer
+you basically only need the engine:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">sqlalchemy</span> <span class="kn">import</span> <span class="n">create_engine</span><span class="p">,</span> <span class="n">MetaData</span>
+
+<span class="n">engine</span> <span class="o">=</span> <span class="n">create_engine</span><span class="p">(</span><span class="s">&#39;sqlite:////tmp/test.db&#39;</span><span class="p">,</span> <span class="n">convert_unicode</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
+<span class="n">metadata</span> <span class="o">=</span> <span class="n">MetaData</span><span class="p">(</span><span class="n">bind</span><span class="o">=</span><span class="n">engine</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>Then you can either declare the tables in your code like in the examples
+above, or automatically load them:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="n">users</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="s">&#39;users&#39;</span><span class="p">,</span> <span class="n">metadata</span><span class="p">,</span> <span class="n">autoload</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>To insert data you can use the <cite>insert</cite> method. We have to get a
+connection first so that we can use a transaction:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">con</span> <span class="o">=</span> <span class="n">engine</span><span class="o">.</span><span class="n">connect</span><span class="p">()</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">con</span><span class="o">.</span><span class="n">execute</span><span class="p">(</span><span class="n">users</span><span class="o">.</span><span class="n">insert</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s">&#39;admin&#39;</span><span class="p">,</span> <span class="n">email</span><span class="o">=</span><span class="s">&#39;admin@localhost&#39;</span><span class="p">))</span>
+</pre></div>
+</div>
+<p>SQLAlchemy will automatically commit for us.</p>
+<p>To query your database, you use the engine directly or use a connection:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">users</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="n">users</span><span class="o">.</span><span class="n">c</span><span class="o">.</span><span class="n">id</span> <span class="o">==</span> <span class="mi">1</span><span class="p">)</span><span class="o">.</span><span class="n">execute</span><span class="p">()</span><span class="o">.</span><span class="n">first</span><span class="p">()</span>
+<span class="go">(1, u&#39;admin&#39;, u&#39;admin@localhost&#39;)</span>
+</pre></div>
+</div>
+<p>These results are also dict-like tuples:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">r</span> <span class="o">=</span> <span class="n">users</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="n">users</span><span class="o">.</span><span class="n">c</span><span class="o">.</span><span class="n">id</span> <span class="o">==</span> <span class="mi">1</span><span class="p">)</span><span class="o">.</span><span class="n">execute</span><span class="p">()</span><span class="o">.</span><span class="n">first</span><span class="p">()</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">r</span><span class="p">[</span><span class="s">&#39;name&#39;</span><span class="p">]</span>
+<span class="go">u&#39;admin&#39;</span>
+</pre></div>
+</div>
+<p>You can also pass strings of SQL statements to the
+<a class="reference external" href="http://www.sqlalchemy.org/docs/core/connections.html#sqlalchemy.engine.base.Connection.execute" title="(in SQLAlchemy v0.7)"><tt class="xref py py-meth docutils literal"><span class="pre">execute()</span></tt></a> method:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">engine</span><span class="o">.</span><span class="n">execute</span><span class="p">(</span><span class="s">&#39;select * from users where id = :1&#39;</span><span class="p">,</span> <span class="p">[</span><span class="mi">1</span><span class="p">])</span><span class="o">.</span><span class="n">first</span><span class="p">()</span>
+<span class="go">(1, u&#39;admin&#39;, u&#39;admin@localhost&#39;)</span>
+</pre></div>
+</div>
+<p>For more information about SQLAlchemy, head over to the
+<a class="reference external" href="http://sqlalchemy.org/">website</a>.</p>
+</div>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="../index.html">
+ <img class="logo" src="../_static/flask.png" alt="Logo"/>
+</a></p>
+ <h3><a href="../index.html">Table Of Contents</a></h3>
+ <ul>
+<li><a class="reference internal" href="#">SQLAlchemy in Flask</a><ul>
+<li><a class="reference internal" href="#flask-sqlalchemy-extension">Flask-SQLAlchemy Extension</a></li>
+<li><a class="reference internal" href="#declarative">Declarative</a></li>
+<li><a class="reference internal" href="#manual-object-relational-mapping">Manual Object Relational Mapping</a></li>
+<li><a class="reference internal" href="#sql-abstraction-layer">SQL Abstraction Layer</a></li>
+</ul>
+</li>
+</ul>
+<h3>Related Topics</h3>
+<ul>
+ <li><a href="../index.html">Documentation overview</a><ul>
+ <li><a href="index.html">Patterns for Flask</a><ul>
+ <li>Previous: <a href="sqlite3.html" title="previous chapter">Using SQLite 3 with Flask</a></li>
+ <li>Next: <a href="fileuploads.html" title="next chapter">Uploading Files</a></li>
+ </ul></li>
+ </ul></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="../_sources/patterns/sqlalchemy.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/patterns/sqlite3.html b/app/static/doc/flask-docs/patterns/sqlite3.html
new file mode 100644
index 0000000..8e892e3
--- /dev/null
+++ b/app/static/doc/flask-docs/patterns/sqlite3.html
@@ -0,0 +1,226 @@
+
+<!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>Using SQLite 3 with Flask &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="../index.html" />
+ <link rel="up" title="Patterns for Flask" href="index.html" />
+ <link rel="next" title="SQLAlchemy in Flask" href="sqlalchemy.html" />
+ <link rel="prev" title="Deploying with Fabric" href="fabric.html" />
+
+
+ <link rel="apple-touch-icon" href="../_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="../_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <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="sqlalchemy.html" title="SQLAlchemy in Flask"
+ accesskey="N">next</a> |</li>
+ <li class="right" >
+ <a href="fabric.html" title="Deploying with Fabric"
+ accesskey="P">previous</a> |</li>
+ <li><a href="../index.html">Flask 0.8 documentation</a> &raquo;</li>
+ <li><a href="index.html" accesskey="U">Patterns for Flask</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="using-sqlite-3-with-flask">
+<span id="sqlite3"></span><h1>Using SQLite 3 with Flask<a class="headerlink" href="#using-sqlite-3-with-flask" title="Permalink to this headline">¶</a></h1>
+<p>In Flask you can implement the opening of database connections at the
+beginning of the request and closing at the end with the
+<a class="reference internal" href="../api.html#flask.Flask.before_request" title="flask.Flask.before_request"><tt class="xref py py-meth docutils literal"><span class="pre">before_request()</span></tt></a> and <a class="reference internal" href="../api.html#flask.Flask.teardown_request" title="flask.Flask.teardown_request"><tt class="xref py py-meth docutils literal"><span class="pre">teardown_request()</span></tt></a>
+decorators in combination with the special <a class="reference internal" href="../api.html#flask.g" title="flask.g"><tt class="xref py py-class docutils literal"><span class="pre">g</span></tt></a> object.</p>
+<p>So here is a simple example of how you can use SQLite 3 with Flask:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">sqlite3</span>
+<span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">g</span>
+
+<span class="n">DATABASE</span> <span class="o">=</span> <span class="s">&#39;/path/to/database.db&#39;</span>
+
+<span class="k">def</span> <span class="nf">connect_db</span><span class="p">():</span>
+ <span class="k">return</span> <span class="n">sqlite3</span><span class="o">.</span><span class="n">connect</span><span class="p">(</span><span class="n">DATABASE</span><span class="p">)</span>
+
+<span class="nd">@app.before_request</span>
+<span class="k">def</span> <span class="nf">before_request</span><span class="p">():</span>
+ <span class="n">g</span><span class="o">.</span><span class="n">db</span> <span class="o">=</span> <span class="n">connect_db</span><span class="p">()</span>
+
+<span class="nd">@app.teardown_request</span>
+<span class="k">def</span> <span class="nf">teardown_request</span><span class="p">(</span><span class="n">exception</span><span class="p">):</span>
+ <span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="n">g</span><span class="p">,</span> <span class="s">&#39;db&#39;</span><span class="p">):</span>
+ <span class="n">g</span><span class="o">.</span><span class="n">db</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
+</pre></div>
+</div>
+<div class="admonition note">
+<p class="first admonition-title">Note</p>
+<p class="last">Please keep in mind that the teardown request functions are always
+executed, even if a before-request handler failed or was never
+executed. Because of this we have to make sure here that the database
+is there before we close it.</p>
+</div>
+<div class="section" id="connect-on-demand">
+<h2>Connect on Demand<a class="headerlink" href="#connect-on-demand" title="Permalink to this headline">¶</a></h2>
+<p>The downside of this approach is that this will only work if Flask
+executed the before-request handlers for you. If you are attempting to
+use the database from a script or the interactive Python shell you would
+have to do something like this:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">with</span> <span class="n">app</span><span class="o">.</span><span class="n">test_request_context</span><span class="p">():</span>
+ <span class="n">app</span><span class="o">.</span><span class="n">preprocess_request</span><span class="p">()</span>
+ <span class="c"># now you can use the g.db object</span>
+</pre></div>
+</div>
+<p>In order to trigger the execution of the connection code. You won&#8217;t be
+able to drop the dependency on the request context this way, but you could
+make it so that the application connects when necessary:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">def</span> <span class="nf">get_connection</span><span class="p">():</span>
+ <span class="n">db</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="n">g</span><span class="p">,</span> <span class="s">&#39;_db&#39;</span><span class="p">,</span> <span class="bp">None</span><span class="p">)</span>
+ <span class="k">if</span> <span class="n">db</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+ <span class="n">db</span> <span class="o">=</span> <span class="n">g</span><span class="o">.</span><span class="n">_db</span> <span class="o">=</span> <span class="n">connect_db</span><span class="p">()</span>
+ <span class="k">return</span> <span class="n">db</span>
+</pre></div>
+</div>
+<p>Downside here is that you have to use <tt class="docutils literal"><span class="pre">db</span> <span class="pre">=</span> <span class="pre">get_connection()</span></tt> instead of
+just being able to use <tt class="docutils literal"><span class="pre">g.db</span></tt> directly.</p>
+</div>
+<div class="section" id="easy-querying">
+<span id="id1"></span><h2>Easy Querying<a class="headerlink" href="#easy-querying" title="Permalink to this headline">¶</a></h2>
+<p>Now in each request handling function you can access <cite>g.db</cite> to get the
+current open database connection. To simplify working with SQLite, a
+helper function can be useful:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">def</span> <span class="nf">query_db</span><span class="p">(</span><span class="n">query</span><span class="p">,</span> <span class="n">args</span><span class="o">=</span><span class="p">(),</span> <span class="n">one</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span>
+ <span class="n">cur</span> <span class="o">=</span> <span class="n">g</span><span class="o">.</span><span class="n">db</span><span class="o">.</span><span class="n">execute</span><span class="p">(</span><span class="n">query</span><span class="p">,</span> <span class="n">args</span><span class="p">)</span>
+ <span class="n">rv</span> <span class="o">=</span> <span class="p">[</span><span class="nb">dict</span><span class="p">((</span><span class="n">cur</span><span class="o">.</span><span class="n">description</span><span class="p">[</span><span class="n">idx</span><span class="p">][</span><span class="mi">0</span><span class="p">],</span> <span class="n">value</span><span class="p">)</span>
+ <span class="k">for</span> <span class="n">idx</span><span class="p">,</span> <span class="n">value</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">row</span><span class="p">))</span> <span class="k">for</span> <span class="n">row</span> <span class="ow">in</span> <span class="n">cur</span><span class="o">.</span><span class="n">fetchall</span><span class="p">()]</span>
+ <span class="k">return</span> <span class="p">(</span><span class="n">rv</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="k">if</span> <span class="n">rv</span> <span class="k">else</span> <span class="bp">None</span><span class="p">)</span> <span class="k">if</span> <span class="n">one</span> <span class="k">else</span> <span class="n">rv</span>
+</pre></div>
+</div>
+<p>This handy little function makes working with the database much more
+pleasant than it is by just using the raw cursor and connection objects.</p>
+<p>Here is how you can use it:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">for</span> <span class="n">user</span> <span class="ow">in</span> <span class="n">query_db</span><span class="p">(</span><span class="s">&#39;select * from users&#39;</span><span class="p">):</span>
+ <span class="k">print</span> <span class="n">user</span><span class="p">[</span><span class="s">&#39;username&#39;</span><span class="p">],</span> <span class="s">&#39;has the id&#39;</span><span class="p">,</span> <span class="n">user</span><span class="p">[</span><span class="s">&#39;user_id&#39;</span><span class="p">]</span>
+</pre></div>
+</div>
+<p>Or if you just want a single result:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="n">user</span> <span class="o">=</span> <span class="n">query_db</span><span class="p">(</span><span class="s">&#39;select * from users where username = ?&#39;</span><span class="p">,</span>
+ <span class="p">[</span><span class="n">the_username</span><span class="p">],</span> <span class="n">one</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
+<span class="k">if</span> <span class="n">user</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+ <span class="k">print</span> <span class="s">&#39;No such user&#39;</span>
+<span class="k">else</span><span class="p">:</span>
+ <span class="k">print</span> <span class="n">the_username</span><span class="p">,</span> <span class="s">&#39;has the id&#39;</span><span class="p">,</span> <span class="n">user</span><span class="p">[</span><span class="s">&#39;user_id&#39;</span><span class="p">]</span>
+</pre></div>
+</div>
+<p>To pass variable parts to the SQL statement, use a question mark in the
+statement and pass in the arguments as a list. Never directly add them to
+the SQL statement with string formatting because this makes it possible
+to attack the application using <a class="reference external" href="http://en.wikipedia.org/wiki/SQL_injection">SQL Injections</a>.</p>
+</div>
+<div class="section" id="initial-schemas">
+<h2>Initial Schemas<a class="headerlink" href="#initial-schemas" title="Permalink to this headline">¶</a></h2>
+<p>Relational databases need schemas, so applications often ship a
+<cite>schema.sql</cite> file that creates the database. It&#8217;s a good idea to provide
+a function that creates the database based on that schema. This function
+can do that for you:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">contextlib</span> <span class="kn">import</span> <span class="n">closing</span>
+
+<span class="k">def</span> <span class="nf">init_db</span><span class="p">():</span>
+ <span class="k">with</span> <span class="n">closing</span><span class="p">(</span><span class="n">connect_db</span><span class="p">())</span> <span class="k">as</span> <span class="n">db</span><span class="p">:</span>
+ <span class="k">with</span> <span class="n">app</span><span class="o">.</span><span class="n">open_resource</span><span class="p">(</span><span class="s">&#39;schema.sql&#39;</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
+ <span class="n">db</span><span class="o">.</span><span class="n">cursor</span><span class="p">()</span><span class="o">.</span><span class="n">executescript</span><span class="p">(</span><span class="n">f</span><span class="o">.</span><span class="n">read</span><span class="p">())</span>
+ <span class="n">db</span><span class="o">.</span><span class="n">commit</span><span class="p">()</span>
+</pre></div>
+</div>
+<p>You can then create such a database from the python shell:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">yourapplication</span> <span class="kn">import</span> <span class="n">init_db</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">init_db</span><span class="p">()</span>
+</pre></div>
+</div>
+</div>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="../index.html">
+ <img class="logo" src="../_static/flask.png" alt="Logo"/>
+</a></p>
+ <h3><a href="../index.html">Table Of Contents</a></h3>
+ <ul>
+<li><a class="reference internal" href="#">Using SQLite 3 with Flask</a><ul>
+<li><a class="reference internal" href="#connect-on-demand">Connect on Demand</a></li>
+<li><a class="reference internal" href="#easy-querying">Easy Querying</a></li>
+<li><a class="reference internal" href="#initial-schemas">Initial Schemas</a></li>
+</ul>
+</li>
+</ul>
+<h3>Related Topics</h3>
+<ul>
+ <li><a href="../index.html">Documentation overview</a><ul>
+ <li><a href="index.html">Patterns for Flask</a><ul>
+ <li>Previous: <a href="fabric.html" title="previous chapter">Deploying with Fabric</a></li>
+ <li>Next: <a href="sqlalchemy.html" title="next chapter">SQLAlchemy in Flask</a></li>
+ </ul></li>
+ </ul></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="../_sources/patterns/sqlite3.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/patterns/streaming.html b/app/static/doc/flask-docs/patterns/streaming.html
new file mode 100644
index 0000000..9285ec4
--- /dev/null
+++ b/app/static/doc/flask-docs/patterns/streaming.html
@@ -0,0 +1,172 @@
+
+<!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>Streaming Contents &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="../index.html" />
+ <link rel="up" title="Patterns for Flask" href="index.html" />
+ <link rel="next" title="Deferred Request Callbacks" href="deferredcallbacks.html" />
+ <link rel="prev" title="Adding a favicon" href="favicon.html" />
+
+
+ <link rel="apple-touch-icon" href="../_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="../_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <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="deferredcallbacks.html" title="Deferred Request Callbacks"
+ accesskey="N">next</a> |</li>
+ <li class="right" >
+ <a href="favicon.html" title="Adding a favicon"
+ accesskey="P">previous</a> |</li>
+ <li><a href="../index.html">Flask 0.8 documentation</a> &raquo;</li>
+ <li><a href="index.html" accesskey="U">Patterns for Flask</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="streaming-contents">
+<h1>Streaming Contents<a class="headerlink" href="#streaming-contents" title="Permalink to this headline">¶</a></h1>
+<p>Sometimes you want to send an enormous amount of data to the client, much
+more than you want to keep in memory. When you are generating the data on
+the fly though, how do you send that back to the client without the
+roundtrip to the filesystem?</p>
+<p>The answer is by using generators and direct responses.</p>
+<div class="section" id="basic-usage">
+<h2>Basic Usage<a class="headerlink" href="#basic-usage" title="Permalink to this headline">¶</a></h2>
+<p>This is a basic view function that generates a lot of CSV data on the fly.
+The trick is to have an inner function that uses a generator to generate
+data and to then invoke that function and pass it to a response object:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">Response</span>
+
+<span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/large.csv&#39;</span><span class="p">)</span>
+<span class="k">def</span> <span class="nf">generate_large_csv</span><span class="p">():</span>
+ <span class="k">def</span> <span class="nf">generate</span><span class="p">():</span>
+ <span class="k">for</span> <span class="n">row</span> <span class="ow">in</span> <span class="n">iter_all_rows</span><span class="p">():</span>
+ <span class="k">yield</span> <span class="s">&#39;,&#39;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">row</span><span class="p">)</span> <span class="o">+</span> <span class="s">&#39;</span><span class="se">\n</span><span class="s">&#39;</span>
+ <span class="k">return</span> <span class="n">Response</span><span class="p">(</span><span class="n">generate</span><span class="p">(),</span> <span class="n">mimetype</span><span class="o">=</span><span class="s">&#39;text/csv&#39;</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>Each <tt class="docutils literal"><span class="pre">yield</span></tt> expression is directly sent to the browser. Now though
+that some WSGI middlewares might break streaming, so be careful there in
+debug environments with profilers and other things you might have enabled.</p>
+</div>
+<div class="section" id="streaming-from-templates">
+<h2>Streaming from Templates<a class="headerlink" href="#streaming-from-templates" title="Permalink to this headline">¶</a></h2>
+<p>The Jinja2 template engine also supports rendering templates piece by
+piece. This functionality is not directly exposed by Flask because it is
+quite uncommon, but you can easily do it yourself:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">Response</span>
+
+<span class="k">def</span> <span class="nf">stream_template</span><span class="p">(</span><span class="n">template_name</span><span class="p">,</span> <span class="o">**</span><span class="n">context</span><span class="p">):</span>
+ <span class="n">app</span><span class="o">.</span><span class="n">update_template_context</span><span class="p">(</span><span class="n">context</span><span class="p">)</span>
+ <span class="n">t</span> <span class="o">=</span> <span class="n">app</span><span class="o">.</span><span class="n">jinja_env</span><span class="o">.</span><span class="n">get_template</span><span class="p">(</span><span class="n">template_name</span><span class="p">)</span>
+ <span class="n">rv</span> <span class="o">=</span> <span class="n">t</span><span class="o">.</span><span class="n">stream</span><span class="p">(</span><span class="n">context</span><span class="p">)</span>
+ <span class="n">rv</span><span class="o">.</span><span class="n">enable_buffering</span><span class="p">(</span><span class="mi">5</span><span class="p">)</span>
+ <span class="k">return</span> <span class="n">rv</span>
+
+<span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/my-large-page.html&#39;</span><span class="p">)</span>
+<span class="k">def</span> <span class="nf">render_large_template</span><span class="p">():</span>
+ <span class="n">rows</span> <span class="o">=</span> <span class="n">iter_all_rows</span><span class="p">()</span>
+ <span class="k">return</span> <span class="n">Response</span><span class="p">(</span><span class="n">stream_template</span><span class="p">(</span><span class="s">&#39;the_template.html&#39;</span><span class="p">,</span> <span class="n">rows</span><span class="o">=</span><span class="n">rows</span><span class="p">))</span>
+</pre></div>
+</div>
+<p>The trick here is to get the template object from the Jinja2 environment
+on the application and to call <tt class="xref py py-meth docutils literal"><span class="pre">stream()</span></tt> instead of
+<tt class="xref py py-meth docutils literal"><span class="pre">render()</span></tt> which returns a stream object instead of a
+string. Since we&#8217;re bypassing the Flask template render functions and
+using the template object itself we have to make sure to update the render
+context ourselves by calling <a class="reference internal" href="../api.html#flask.Flask.update_template_context" title="flask.Flask.update_template_context"><tt class="xref py py-meth docutils literal"><span class="pre">update_template_context()</span></tt></a>.
+The template is then evaluated as the stream is iterated over. Since each
+time you do a yield the server will flush the content to the client you
+might want to buffer up a few items in the template which you can do with
+<tt class="docutils literal"><span class="pre">rv.enable_buffering(size)</span></tt>. <tt class="docutils literal"><span class="pre">5</span></tt> is a sane default.</p>
+</div>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="../index.html">
+ <img class="logo" src="../_static/flask.png" alt="Logo"/>
+</a></p>
+ <h3><a href="../index.html">Table Of Contents</a></h3>
+ <ul>
+<li><a class="reference internal" href="#">Streaming Contents</a><ul>
+<li><a class="reference internal" href="#basic-usage">Basic Usage</a></li>
+<li><a class="reference internal" href="#streaming-from-templates">Streaming from Templates</a></li>
+</ul>
+</li>
+</ul>
+<h3>Related Topics</h3>
+<ul>
+ <li><a href="../index.html">Documentation overview</a><ul>
+ <li><a href="index.html">Patterns for Flask</a><ul>
+ <li>Previous: <a href="favicon.html" title="previous chapter">Adding a favicon</a></li>
+ <li>Next: <a href="deferredcallbacks.html" title="next chapter">Deferred Request Callbacks</a></li>
+ </ul></li>
+ </ul></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="../_sources/patterns/streaming.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/patterns/templateinheritance.html b/app/static/doc/flask-docs/patterns/templateinheritance.html
new file mode 100644
index 0000000..6075905
--- /dev/null
+++ b/app/static/doc/flask-docs/patterns/templateinheritance.html
@@ -0,0 +1,173 @@
+
+<!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>Template Inheritance &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="../index.html" />
+ <link rel="up" title="Patterns for Flask" href="index.html" />
+ <link rel="next" title="Message Flashing" href="flashing.html" />
+ <link rel="prev" title="Form Validation with WTForms" href="wtforms.html" />
+
+
+ <link rel="apple-touch-icon" href="../_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="../_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <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="flashing.html" title="Message Flashing"
+ accesskey="N">next</a> |</li>
+ <li class="right" >
+ <a href="wtforms.html" title="Form Validation with WTForms"
+ accesskey="P">previous</a> |</li>
+ <li><a href="../index.html">Flask 0.8 documentation</a> &raquo;</li>
+ <li><a href="index.html" accesskey="U">Patterns for Flask</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="template-inheritance">
+<span id="id1"></span><h1>Template Inheritance<a class="headerlink" href="#template-inheritance" title="Permalink to this headline">¶</a></h1>
+<p>The most powerful part of Jinja is template inheritance. Template inheritance
+allows you to build a base &#8220;skeleton&#8221; template that contains all the common
+elements of your site and defines <strong>blocks</strong> that child templates can override.</p>
+<p>Sounds complicated but is very basic. It&#8217;s easiest to understand it by starting
+with an example.</p>
+<div class="section" id="base-template">
+<h2>Base Template<a class="headerlink" href="#base-template" title="Permalink to this headline">¶</a></h2>
+<p>This template, which we&#8217;ll call <tt class="docutils literal"><span class="pre">layout.html</span></tt>, defines a simple HTML skeleton
+document that you might use for a simple two-column page. It&#8217;s the job of
+&#8220;child&#8221; templates to fill the empty blocks with content:</p>
+<div class="highlight-html+jinja"><div class="highlight"><pre><span class="cp">&lt;!doctype html&gt;</span>
+<span class="nt">&lt;html&gt;</span>
+ <span class="nt">&lt;head&gt;</span>
+ <span class="cp">{%</span> <span class="k">block</span> <span class="nv">head</span> <span class="cp">%}</span>
+ <span class="nt">&lt;link</span> <span class="na">rel=</span><span class="s">&quot;stylesheet&quot;</span> <span class="na">href=</span><span class="s">&quot;</span><span class="cp">{{</span> <span class="nv">url_for</span><span class="o">(</span><span class="s1">&#39;static&#39;</span><span class="o">,</span> <span class="nv">filename</span><span class="o">=</span><span class="s1">&#39;style.css&#39;</span><span class="o">)</span> <span class="cp">}}</span><span class="s">&quot;</span><span class="nt">&gt;</span>
+ <span class="nt">&lt;title&gt;</span><span class="cp">{%</span> <span class="k">block</span> <span class="nv">title</span> <span class="cp">%}{%</span> <span class="k">endblock</span> <span class="cp">%}</span> - My Webpage<span class="nt">&lt;/title&gt;</span>
+ <span class="cp">{%</span> <span class="k">endblock</span> <span class="cp">%}</span>
+ <span class="nt">&lt;/head&gt;</span>
+<span class="nt">&lt;body&gt;</span>
+ <span class="nt">&lt;div</span> <span class="na">id=</span><span class="s">&quot;content&quot;</span><span class="nt">&gt;</span><span class="cp">{%</span> <span class="k">block</span> <span class="nv">content</span> <span class="cp">%}{%</span> <span class="k">endblock</span> <span class="cp">%}</span><span class="nt">&lt;/div&gt;</span>
+ <span class="nt">&lt;div</span> <span class="na">id=</span><span class="s">&quot;footer&quot;</span><span class="nt">&gt;</span>
+ <span class="cp">{%</span> <span class="k">block</span> <span class="nv">footer</span> <span class="cp">%}</span>
+ <span class="ni">&amp;copy;</span> Copyright 2010 by <span class="nt">&lt;a</span> <span class="na">href=</span><span class="s">&quot;http://domain.invalid/&quot;</span><span class="nt">&gt;</span>you<span class="nt">&lt;/a&gt;</span>.
+ <span class="cp">{%</span> <span class="k">endblock</span> <span class="cp">%}</span>
+ <span class="nt">&lt;/div&gt;</span>
+<span class="nt">&lt;/body&gt;</span>
+</pre></div>
+</div>
+<p>In this example, the <tt class="docutils literal"><span class="pre">{%</span> <span class="pre">block</span> <span class="pre">%}</span></tt> tags define four blocks that child templates
+can fill in. All the <cite>block</cite> tag does is tell the template engine that a
+child template may override those portions of the template.</p>
+</div>
+<div class="section" id="child-template">
+<h2>Child Template<a class="headerlink" href="#child-template" title="Permalink to this headline">¶</a></h2>
+<p>A child template might look like this:</p>
+<div class="highlight-html+jinja"><div class="highlight"><pre><span class="cp">{%</span> <span class="k">extends</span> <span class="s2">&quot;layout.html&quot;</span> <span class="cp">%}</span>
+<span class="cp">{%</span> <span class="k">block</span> <span class="nv">title</span> <span class="cp">%}</span>Index<span class="cp">{%</span> <span class="k">endblock</span> <span class="cp">%}</span>
+<span class="cp">{%</span> <span class="k">block</span> <span class="nv">head</span> <span class="cp">%}</span>
+ <span class="cp">{{</span> <span class="nb">super</span><span class="o">()</span> <span class="cp">}}</span>
+ <span class="nt">&lt;style </span><span class="na">type=</span><span class="s">&quot;text/css&quot;</span><span class="nt">&gt;</span>
+ <span class="nc">.important</span> <span class="p">{</span> <span class="k">color</span><span class="o">:</span> <span class="m">#336699</span><span class="p">;</span> <span class="p">}</span>
+ <span class="nt">&lt;/style&gt;</span>
+<span class="cp">{%</span> <span class="k">endblock</span> <span class="cp">%}</span>
+<span class="cp">{%</span> <span class="k">block</span> <span class="nv">content</span> <span class="cp">%}</span>
+ <span class="nt">&lt;h1&gt;</span>Index<span class="nt">&lt;/h1&gt;</span>
+ <span class="nt">&lt;p</span> <span class="na">class=</span><span class="s">&quot;important&quot;</span><span class="nt">&gt;</span>
+ Welcome on my awesome homepage.
+<span class="cp">{%</span> <span class="k">endblock</span> <span class="cp">%}</span>
+</pre></div>
+</div>
+<p>The <tt class="docutils literal"><span class="pre">{%</span> <span class="pre">extends</span> <span class="pre">%}</span></tt> tag is the key here. It tells the template engine that
+this template &#8220;extends&#8221; another template. When the template system evaluates
+this template, first it locates the parent. The extends tag must be the
+first tag in the template. To render the contents of a block defined in
+the parent template, use <tt class="docutils literal"><span class="pre">{{</span> <span class="pre">super()</span> <span class="pre">}}</span></tt>.</p>
+</div>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="../index.html">
+ <img class="logo" src="../_static/flask.png" alt="Logo"/>
+</a></p>
+ <h3><a href="../index.html">Table Of Contents</a></h3>
+ <ul>
+<li><a class="reference internal" href="#">Template Inheritance</a><ul>
+<li><a class="reference internal" href="#base-template">Base Template</a></li>
+<li><a class="reference internal" href="#child-template">Child Template</a></li>
+</ul>
+</li>
+</ul>
+<h3>Related Topics</h3>
+<ul>
+ <li><a href="../index.html">Documentation overview</a><ul>
+ <li><a href="index.html">Patterns for Flask</a><ul>
+ <li>Previous: <a href="wtforms.html" title="previous chapter">Form Validation with WTForms</a></li>
+ <li>Next: <a href="flashing.html" title="next chapter">Message Flashing</a></li>
+ </ul></li>
+ </ul></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="../_sources/patterns/templateinheritance.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/patterns/urlprocessors.html b/app/static/doc/flask-docs/patterns/urlprocessors.html
new file mode 100644
index 0000000..8e50e36
--- /dev/null
+++ b/app/static/doc/flask-docs/patterns/urlprocessors.html
@@ -0,0 +1,237 @@
+
+<!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>Using URL Processors &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="../index.html" />
+ <link rel="up" title="Patterns for Flask" href="index.html" />
+ <link rel="next" title="Deploying with Distribute" href="distribute.html" />
+ <link rel="prev" title="Application Dispatching" href="appdispatch.html" />
+
+
+ <link rel="apple-touch-icon" href="../_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="../_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <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="distribute.html" title="Deploying with Distribute"
+ accesskey="N">next</a> |</li>
+ <li class="right" >
+ <a href="appdispatch.html" title="Application Dispatching"
+ accesskey="P">previous</a> |</li>
+ <li><a href="../index.html">Flask 0.8 documentation</a> &raquo;</li>
+ <li><a href="index.html" accesskey="U">Patterns for Flask</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="using-url-processors">
+<h1>Using URL Processors<a class="headerlink" href="#using-url-processors" title="Permalink to this headline">¶</a></h1>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.7.</span></p>
+<p>Flask 0.7 introduces the concept of URL processors. The idea is that you
+might have a bunch of resources with common parts in the URL that you
+don&#8217;t always explicitly want to provide. For instance you might have a
+bunch of URLs that have the language code in it but you don&#8217;t want to have
+to handle it in every single function yourself.</p>
+<p>URL processors are especially helpful when combined with blueprints. We
+will handle both application specific URL processors here as well as
+blueprint specifics.</p>
+<div class="section" id="internationalized-application-urls">
+<h2>Internationalized Application URLs<a class="headerlink" href="#internationalized-application-urls" title="Permalink to this headline">¶</a></h2>
+<p>Consider an application like this:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">Flask</span><span class="p">,</span> <span class="n">g</span>
+
+<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="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/&lt;lang_code&gt;/&#39;</span><span class="p">)</span>
+<span class="k">def</span> <span class="nf">index</span><span class="p">(</span><span class="n">lang_code</span><span class="p">):</span>
+ <span class="n">g</span><span class="o">.</span><span class="n">lang_code</span> <span class="o">=</span> <span class="n">lang_code</span>
+ <span class="o">...</span>
+
+<span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/&lt;lang_code&gt;/about&#39;</span><span class="p">)</span>
+<span class="k">def</span> <span class="nf">about</span><span class="p">(</span><span class="n">lang_code</span><span class="p">):</span>
+ <span class="n">g</span><span class="o">.</span><span class="n">lang_code</span> <span class="o">=</span> <span class="n">lang_code</span>
+ <span class="o">...</span>
+</pre></div>
+</div>
+<p>This is an awful lot of repetition as you have to handle the language code
+setting on the <a class="reference internal" href="../api.html#flask.g" title="flask.g"><tt class="xref py py-data docutils literal"><span class="pre">g</span></tt></a> object yourself in every single function.
+Sure, a decorator could be used to simplify this, but if you want to
+generate URLs from one function to another you would have to still provide
+the language code explicitly which can be annoying.</p>
+<p>For the latter, this is where <a class="reference internal" href="../api.html#flask.Flask.url_defaults" title="flask.Flask.url_defaults"><tt class="xref py py-func docutils literal"><span class="pre">url_defaults()</span></tt></a> functions
+come in. They can automatically inject values into a call for
+<a class="reference internal" href="../api.html#flask.url_for" title="flask.url_for"><tt class="xref py py-func docutils literal"><span class="pre">url_for()</span></tt></a> automatically. The code below checks if the
+language code is not yet in the dictionary of URL values and if the
+endpoint wants a value named <tt class="docutils literal"><span class="pre">'lang_code'</span></tt>:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="nd">@app.url_defaults</span>
+<span class="k">def</span> <span class="nf">add_language_code</span><span class="p">(</span><span class="n">endpoint</span><span class="p">,</span> <span class="n">values</span><span class="p">):</span>
+ <span class="k">if</span> <span class="s">&#39;lang_code&#39;</span> <span class="ow">in</span> <span class="n">values</span> <span class="ow">or</span> <span class="ow">not</span> <span class="n">g</span><span class="o">.</span><span class="n">lang_code</span><span class="p">:</span>
+ <span class="k">return</span>
+ <span class="k">if</span> <span class="n">app</span><span class="o">.</span><span class="n">url_map</span><span class="o">.</span><span class="n">is_endpoint_expecting</span><span class="p">(</span><span class="n">endpoint</span><span class="p">,</span> <span class="s">&#39;lang_code&#39;</span><span class="p">):</span>
+ <span class="n">values</span><span class="p">[</span><span class="s">&#39;lang_code&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">g</span><span class="o">.</span><span class="n">lang_code</span>
+</pre></div>
+</div>
+<p>The method <a class="reference external" href="http://werkzeug.pocoo.org/docs/routing/#werkzeug.routing.Map.is_endpoint_expecting" title="(in Werkzeug v0.7)"><tt class="xref py py-meth docutils literal"><span class="pre">is_endpoint_expecting()</span></tt></a> of the URL
+map can be used to figure out if it would make sense to provide a language
+code for the given endpoint.</p>
+<p>The reverse of that function are
+<a class="reference internal" href="../api.html#flask.Flask.url_value_preprocessor" title="flask.Flask.url_value_preprocessor"><tt class="xref py py-meth docutils literal"><span class="pre">url_value_preprocessor()</span></tt></a>s. They are executed right
+after the request was matched and can execute code based on the URL
+values. The idea is that they pull information out of the values
+dictionary and put it somewhere else:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="nd">@app.url_value_preprocessor</span>
+<span class="k">def</span> <span class="nf">pull_lang_code</span><span class="p">(</span><span class="n">endpoint</span><span class="p">,</span> <span class="n">values</span><span class="p">):</span>
+ <span class="n">g</span><span class="o">.</span><span class="n">lang_code</span> <span class="o">=</span> <span class="n">values</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s">&#39;lang_code&#39;</span><span class="p">,</span> <span class="bp">None</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>That way you no longer have to do the <cite>lang_code</cite> assigment to
+<a class="reference internal" href="../api.html#flask.g" title="flask.g"><tt class="xref py py-data docutils literal"><span class="pre">g</span></tt></a> in every function. You can further improve that by
+writing your own decorator that prefixes URLs with the language code, but
+the more beautiful solution is using a blueprint. Once the
+<tt class="docutils literal"><span class="pre">'lang_code'</span></tt> is popped from the values dictionary and it will no longer
+be forwarded to the view function reducing the code to this:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">Flask</span><span class="p">,</span> <span class="n">g</span>
+
+<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="nd">@app.url_defaults</span>
+<span class="k">def</span> <span class="nf">add_language_code</span><span class="p">(</span><span class="n">endpoint</span><span class="p">,</span> <span class="n">values</span><span class="p">):</span>
+ <span class="k">if</span> <span class="s">&#39;lang_code&#39;</span> <span class="ow">in</span> <span class="n">values</span> <span class="ow">or</span> <span class="ow">not</span> <span class="n">g</span><span class="o">.</span><span class="n">lang_code</span><span class="p">:</span>
+ <span class="k">return</span>
+ <span class="k">if</span> <span class="n">app</span><span class="o">.</span><span class="n">url_map</span><span class="o">.</span><span class="n">is_endpoint_expecting</span><span class="p">(</span><span class="n">endpoint</span><span class="p">,</span> <span class="s">&#39;lang_code&#39;</span><span class="p">):</span>
+ <span class="n">values</span><span class="p">[</span><span class="s">&#39;lang_code&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">g</span><span class="o">.</span><span class="n">lang_code</span>
+
+<span class="nd">@app.url_value_preprocessor</span>
+<span class="k">def</span> <span class="nf">pull_lang_code</span><span class="p">(</span><span class="n">endpoint</span><span class="p">,</span> <span class="n">values</span><span class="p">):</span>
+ <span class="n">g</span><span class="o">.</span><span class="n">lang_code</span> <span class="o">=</span> <span class="n">values</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s">&#39;lang_code&#39;</span><span class="p">,</span> <span class="bp">None</span><span class="p">)</span>
+
+<span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/&lt;lang_code&gt;/&#39;</span><span class="p">)</span>
+<span class="k">def</span> <span class="nf">index</span><span class="p">():</span>
+ <span class="o">...</span>
+
+<span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/&lt;lang_code&gt;/about&#39;</span><span class="p">)</span>
+<span class="k">def</span> <span class="nf">about</span><span class="p">():</span>
+ <span class="o">...</span>
+</pre></div>
+</div>
+</div>
+<div class="section" id="internationalized-blueprint-urls">
+<h2>Internationalized Blueprint URLs<a class="headerlink" href="#internationalized-blueprint-urls" title="Permalink to this headline">¶</a></h2>
+<p>Because blueprints can automatically prefix all URLs with a common string
+it&#8217;s easy to automatically do that for every function. Furthermore
+blueprints can have per-blueprint URL processors which removes a whole lot
+of logic from the <a class="reference internal" href="../api.html#flask.Flask.url_defaults" title="flask.Flask.url_defaults"><tt class="xref py py-meth docutils literal"><span class="pre">url_defaults()</span></tt></a> function because it no
+longer has to check if the URL is really interested in a <tt class="docutils literal"><span class="pre">'lang_code'</span></tt>
+parameter:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">Blueprint</span><span class="p">,</span> <span class="n">g</span>
+
+<span class="n">bp</span> <span class="o">=</span> <span class="n">Blueprint</span><span class="p">(</span><span class="s">&#39;frontend&#39;</span><span class="p">,</span> <span class="n">__name__</span><span class="p">,</span> <span class="n">url_prefix</span><span class="o">=</span><span class="s">&#39;/&lt;lang_code&gt;&#39;</span><span class="p">)</span>
+
+<span class="nd">@bp.url_defaults</span>
+<span class="k">def</span> <span class="nf">add_language_code</span><span class="p">(</span><span class="n">endpoint</span><span class="p">,</span> <span class="n">values</span><span class="p">):</span>
+ <span class="n">values</span><span class="o">.</span><span class="n">setdefault</span><span class="p">(</span><span class="s">&#39;lang_code&#39;</span><span class="p">,</span> <span class="n">g</span><span class="o">.</span><span class="n">lang_code</span><span class="p">)</span>
+
+<span class="nd">@bp.url_value_preprocessor</span>
+<span class="k">def</span> <span class="nf">pull_lang_code</span><span class="p">(</span><span class="n">endpoint</span><span class="p">,</span> <span class="n">values</span><span class="p">):</span>
+ <span class="n">g</span><span class="o">.</span><span class="n">lang_code</span> <span class="o">=</span> <span class="n">values</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s">&#39;lang_code&#39;</span><span class="p">)</span>
+
+<span class="nd">@bp.route</span><span class="p">(</span><span class="s">&#39;/&#39;</span><span class="p">)</span>
+<span class="k">def</span> <span class="nf">index</span><span class="p">():</span>
+ <span class="o">...</span>
+
+<span class="nd">@bp.route</span><span class="p">(</span><span class="s">&#39;/about&#39;</span><span class="p">)</span>
+<span class="k">def</span> <span class="nf">about</span><span class="p">():</span>
+ <span class="o">...</span>
+</pre></div>
+</div>
+</div>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="../index.html">
+ <img class="logo" src="../_static/flask.png" alt="Logo"/>
+</a></p>
+ <h3><a href="../index.html">Table Of Contents</a></h3>
+ <ul>
+<li><a class="reference internal" href="#">Using URL Processors</a><ul>
+<li><a class="reference internal" href="#internationalized-application-urls">Internationalized Application URLs</a></li>
+<li><a class="reference internal" href="#internationalized-blueprint-urls">Internationalized Blueprint URLs</a></li>
+</ul>
+</li>
+</ul>
+<h3>Related Topics</h3>
+<ul>
+ <li><a href="../index.html">Documentation overview</a><ul>
+ <li><a href="index.html">Patterns for Flask</a><ul>
+ <li>Previous: <a href="appdispatch.html" title="previous chapter">Application Dispatching</a></li>
+ <li>Next: <a href="distribute.html" title="next chapter">Deploying with Distribute</a></li>
+ </ul></li>
+ </ul></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="../_sources/patterns/urlprocessors.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/patterns/viewdecorators.html b/app/static/doc/flask-docs/patterns/viewdecorators.html
new file mode 100644
index 0000000..9a10276
--- /dev/null
+++ b/app/static/doc/flask-docs/patterns/viewdecorators.html
@@ -0,0 +1,274 @@
+
+<!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>View Decorators &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="../index.html" />
+ <link rel="up" title="Patterns for Flask" href="index.html" />
+ <link rel="next" title="Form Validation with WTForms" href="wtforms.html" />
+ <link rel="prev" title="Caching" href="caching.html" />
+
+
+ <link rel="apple-touch-icon" href="../_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="../_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <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="wtforms.html" title="Form Validation with WTForms"
+ accesskey="N">next</a> |</li>
+ <li class="right" >
+ <a href="caching.html" title="Caching"
+ accesskey="P">previous</a> |</li>
+ <li><a href="../index.html">Flask 0.8 documentation</a> &raquo;</li>
+ <li><a href="index.html" accesskey="U">Patterns for Flask</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="view-decorators">
+<h1>View Decorators<a class="headerlink" href="#view-decorators" title="Permalink to this headline">¶</a></h1>
+<p>Python has a really interesting feature called function decorators. This
+allow some really neat things for web applications. Because each view in
+Flask is a function decorators can be used to inject additional
+functionality to one or more functions. The <a class="reference internal" href="../api.html#flask.Flask.route" title="flask.Flask.route"><tt class="xref py py-meth docutils literal"><span class="pre">route()</span></tt></a>
+decorator is the one you probably used already. But there are use cases
+for implementing your own decorator. For instance, imagine you have a
+view that should only be used by people that are logged in to. If a user
+goes to the site and is not logged in, they should be redirected to the
+login page. This is a good example of a use case where a decorator is an
+excellent solution.</p>
+<div class="section" id="login-required-decorator">
+<h2>Login Required Decorator<a class="headerlink" href="#login-required-decorator" title="Permalink to this headline">¶</a></h2>
+<p>So let&#8217;s implement such a decorator. A decorator is a function that
+returns a function. Pretty simple actually. The only thing you have to
+keep in mind when implementing something like this is to update the
+<cite>__name__</cite>, <cite>__module__</cite> and some other attributes of a function. This is
+often forgotten, but you don&#8217;t have to do that by hand, there is a
+function for that that is used like a decorator (<a class="reference external" href="http://docs.python.org/dev/library/functools.html#functools.wraps" title="(in Python v3.3)"><tt class="xref py py-func docutils literal"><span class="pre">functools.wraps()</span></tt></a>).</p>
+<p>This example assumes that the login page is called <tt class="docutils literal"><span class="pre">'login'</span></tt> and that
+the current user is stored as <cite>g.user</cite> and <cite>None</cite> if there is no-one
+logged in:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">functools</span> <span class="kn">import</span> <span class="n">wraps</span>
+<span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">g</span><span class="p">,</span> <span class="n">request</span><span class="p">,</span> <span class="n">redirect</span><span class="p">,</span> <span class="n">url_for</span>
+
+<span class="k">def</span> <span class="nf">login_required</span><span class="p">(</span><span class="n">f</span><span class="p">):</span>
+ <span class="nd">@wraps</span><span class="p">(</span><span class="n">f</span><span class="p">)</span>
+ <span class="k">def</span> <span class="nf">decorated_function</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
+ <span class="k">if</span> <span class="n">g</span><span class="o">.</span><span class="n">user</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+ <span class="k">return</span> <span class="n">redirect</span><span class="p">(</span><span class="n">url_for</span><span class="p">(</span><span class="s">&#39;login&#39;</span><span class="p">,</span> <span class="nb">next</span><span class="o">=</span><span class="n">request</span><span class="o">.</span><span class="n">url</span><span class="p">))</span>
+ <span class="k">return</span> <span class="n">f</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
+ <span class="k">return</span> <span class="n">decorated_function</span>
+</pre></div>
+</div>
+<p>So how would you use that decorator now? Apply it as innermost decorator
+to a view function. When applying further decorators, always remember
+that the <a class="reference internal" href="../api.html#flask.Flask.route" title="flask.Flask.route"><tt class="xref py py-meth docutils literal"><span class="pre">route()</span></tt></a> decorator is the outermost:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/secret_page&#39;</span><span class="p">)</span>
+<span class="nd">@login_required</span>
+<span class="k">def</span> <span class="nf">secret_page</span><span class="p">():</span>
+ <span class="k">pass</span>
+</pre></div>
+</div>
+</div>
+<div class="section" id="caching-decorator">
+<h2>Caching Decorator<a class="headerlink" href="#caching-decorator" title="Permalink to this headline">¶</a></h2>
+<p>Imagine you have a view function that does an expensive calculation and
+because of that you would like to cache the generated results for a
+certain amount of time. A decorator would be nice for that. We&#8217;re
+assuming you have set up a cache like mentioned in <a class="reference internal" href="caching.html#caching-pattern"><em>Caching</em></a>.</p>
+<p>Here an example cache function. It generates the cache key from a
+specific prefix (actually a format string) and the current path of the
+request. Notice that we are using a function that first creates the
+decorator that then decorates the function. Sounds awful? Unfortunately
+it is a little bit more complex, but the code should still be
+straightforward to read.</p>
+<p>The decorated function will then work as follows</p>
+<ol class="arabic simple">
+<li>get the unique cache key for the current request base on the current
+path.</li>
+<li>get the value for that key from the cache. If the cache returned
+something we will return that value.</li>
+<li>otherwise the original function is called and the return value is
+stored in the cache for the timeout provided (by default 5 minutes).</li>
+</ol>
+<p>Here the code:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">functools</span> <span class="kn">import</span> <span class="n">wraps</span>
+<span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">request</span>
+
+<span class="k">def</span> <span class="nf">cached</span><span class="p">(</span><span class="n">timeout</span><span class="o">=</span><span class="mi">5</span> <span class="o">*</span> <span class="mi">60</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s">&#39;view/</span><span class="si">%s</span><span class="s">&#39;</span><span class="p">):</span>
+ <span class="k">def</span> <span class="nf">decorator</span><span class="p">(</span><span class="n">f</span><span class="p">):</span>
+ <span class="nd">@wraps</span><span class="p">(</span><span class="n">f</span><span class="p">)</span>
+ <span class="k">def</span> <span class="nf">decorated_function</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
+ <span class="n">cache_key</span> <span class="o">=</span> <span class="n">key</span> <span class="o">%</span> <span class="n">request</span><span class="o">.</span><span class="n">path</span>
+ <span class="n">rv</span> <span class="o">=</span> <span class="n">cache</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">cache_key</span><span class="p">)</span>
+ <span class="k">if</span> <span class="n">rv</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+ <span class="k">return</span> <span class="n">rv</span>
+ <span class="n">rv</span> <span class="o">=</span> <span class="n">f</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
+ <span class="n">cache</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="n">cache_key</span><span class="p">,</span> <span class="n">rv</span><span class="p">,</span> <span class="n">timeout</span><span class="o">=</span><span class="n">timeout</span><span class="p">)</span>
+ <span class="k">return</span> <span class="n">rv</span>
+ <span class="k">return</span> <span class="n">decorated_function</span>
+ <span class="k">return</span> <span class="n">decorator</span>
+</pre></div>
+</div>
+<p>Notice that this assumes an instantiated <cite>cache</cite> object is available, see
+<a class="reference internal" href="caching.html#caching-pattern"><em>Caching</em></a> for more information.</p>
+</div>
+<div class="section" id="templating-decorator">
+<h2>Templating Decorator<a class="headerlink" href="#templating-decorator" title="Permalink to this headline">¶</a></h2>
+<p>A common pattern invented by the TurboGears guys a while back is a
+templating decorator. The idea of that decorator is that you return a
+dictionary with the values passed to the template from the view function
+and the template is automatically rendered. With that, the following
+three examples do exactly the same:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/&#39;</span><span class="p">)</span>
+<span class="k">def</span> <span class="nf">index</span><span class="p">():</span>
+ <span class="k">return</span> <span class="n">render_template</span><span class="p">(</span><span class="s">&#39;index.html&#39;</span><span class="p">,</span> <span class="n">value</span><span class="o">=</span><span class="mi">42</span><span class="p">)</span>
+
+<span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/&#39;</span><span class="p">)</span>
+<span class="nd">@templated</span><span class="p">(</span><span class="s">&#39;index.html&#39;</span><span class="p">)</span>
+<span class="k">def</span> <span class="nf">index</span><span class="p">():</span>
+ <span class="k">return</span> <span class="nb">dict</span><span class="p">(</span><span class="n">value</span><span class="o">=</span><span class="mi">42</span><span class="p">)</span>
+
+<span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/&#39;</span><span class="p">)</span>
+<span class="nd">@templated</span><span class="p">()</span>
+<span class="k">def</span> <span class="nf">index</span><span class="p">():</span>
+ <span class="k">return</span> <span class="nb">dict</span><span class="p">(</span><span class="n">value</span><span class="o">=</span><span class="mi">42</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>As you can see, if no template name is provided it will use the endpoint
+of the URL map with dots converted to slashes + <tt class="docutils literal"><span class="pre">'.html'</span></tt>. Otherwise
+the provided template name is used. When the decorated function returns,
+the dictionary returned is passed to the template rendering function. If
+<cite>None</cite> is returned, an empty dictionary is assumed, if something else than
+a dictionary is returned we return it from the function unchanged. That
+way you can still use the redirect function or return simple strings.</p>
+<p>Here the code for that decorator:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">functools</span> <span class="kn">import</span> <span class="n">wraps</span>
+<span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">request</span>
+
+<span class="k">def</span> <span class="nf">templated</span><span class="p">(</span><span class="n">template</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+ <span class="k">def</span> <span class="nf">decorator</span><span class="p">(</span><span class="n">f</span><span class="p">):</span>
+ <span class="nd">@wraps</span><span class="p">(</span><span class="n">f</span><span class="p">)</span>
+ <span class="k">def</span> <span class="nf">decorated_function</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
+ <span class="n">template_name</span> <span class="o">=</span> <span class="n">template</span>
+ <span class="k">if</span> <span class="n">template_name</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+ <span class="n">template_name</span> <span class="o">=</span> <span class="n">request</span><span class="o">.</span><span class="n">endpoint</span> \
+ <span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="s">&#39;.&#39;</span><span class="p">,</span> <span class="s">&#39;/&#39;</span><span class="p">)</span> <span class="o">+</span> <span class="s">&#39;.html&#39;</span>
+ <span class="n">ctx</span> <span class="o">=</span> <span class="n">f</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
+ <span class="k">if</span> <span class="n">ctx</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+ <span class="n">ctx</span> <span class="o">=</span> <span class="p">{}</span>
+ <span class="k">elif</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">ctx</span><span class="p">,</span> <span class="nb">dict</span><span class="p">):</span>
+ <span class="k">return</span> <span class="n">ctx</span>
+ <span class="k">return</span> <span class="n">render_template</span><span class="p">(</span><span class="n">template_name</span><span class="p">,</span> <span class="o">**</span><span class="n">ctx</span><span class="p">)</span>
+ <span class="k">return</span> <span class="n">decorated_function</span>
+ <span class="k">return</span> <span class="n">decorator</span>
+</pre></div>
+</div>
+</div>
+<div class="section" id="endpoint-decorator">
+<h2>Endpoint Decorator<a class="headerlink" href="#endpoint-decorator" title="Permalink to this headline">¶</a></h2>
+<p>When you want to use the werkzeug routing system for more flexibility you
+need to map the endpoint as defined in the <a class="reference external" href="http://werkzeug.pocoo.org/docs/routing/#werkzeug.routing.Rule" title="(in Werkzeug v0.7)"><tt class="xref py py-class docutils literal"><span class="pre">Rule</span></tt></a>
+to a view function. This is possible with this decorator. For example:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">Flask</span>
+<span class="kn">from</span> <span class="nn">werkzeug.routing</span> <span class="kn">import</span> <span class="n">Rule</span>
+
+<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">app</span><span class="o">.</span><span class="n">url_map</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">Rule</span><span class="p">(</span><span class="s">&#39;/&#39;</span><span class="p">,</span> <span class="n">endpoint</span><span class="o">=</span><span class="s">&#39;index&#39;</span><span class="p">))</span>
+
+<span class="nd">@app.endpoint</span><span class="p">(</span><span class="s">&#39;index&#39;</span><span class="p">)</span>
+<span class="k">def</span> <span class="nf">my_index</span><span class="p">():</span>
+ <span class="k">return</span> <span class="s">&quot;Hello world&quot;</span>
+</pre></div>
+</div>
+</div>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="../index.html">
+ <img class="logo" src="../_static/flask.png" alt="Logo"/>
+</a></p>
+ <h3><a href="../index.html">Table Of Contents</a></h3>
+ <ul>
+<li><a class="reference internal" href="#">View Decorators</a><ul>
+<li><a class="reference internal" href="#login-required-decorator">Login Required Decorator</a></li>
+<li><a class="reference internal" href="#caching-decorator">Caching Decorator</a></li>
+<li><a class="reference internal" href="#templating-decorator">Templating Decorator</a></li>
+<li><a class="reference internal" href="#endpoint-decorator">Endpoint Decorator</a></li>
+</ul>
+</li>
+</ul>
+<h3>Related Topics</h3>
+<ul>
+ <li><a href="../index.html">Documentation overview</a><ul>
+ <li><a href="index.html">Patterns for Flask</a><ul>
+ <li>Previous: <a href="caching.html" title="previous chapter">Caching</a></li>
+ <li>Next: <a href="wtforms.html" title="next chapter">Form Validation with WTForms</a></li>
+ </ul></li>
+ </ul></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="../_sources/patterns/viewdecorators.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/patterns/wtforms.html b/app/static/doc/flask-docs/patterns/wtforms.html
new file mode 100644
index 0000000..f998f2e
--- /dev/null
+++ b/app/static/doc/flask-docs/patterns/wtforms.html
@@ -0,0 +1,224 @@
+
+<!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>Form Validation with WTForms &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="../index.html" />
+ <link rel="up" title="Patterns for Flask" href="index.html" />
+ <link rel="next" title="Template Inheritance" href="templateinheritance.html" />
+ <link rel="prev" title="View Decorators" href="viewdecorators.html" />
+
+
+ <link rel="apple-touch-icon" href="../_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="../_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <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="templateinheritance.html" title="Template Inheritance"
+ accesskey="N">next</a> |</li>
+ <li class="right" >
+ <a href="viewdecorators.html" title="View Decorators"
+ accesskey="P">previous</a> |</li>
+ <li><a href="../index.html">Flask 0.8 documentation</a> &raquo;</li>
+ <li><a href="index.html" accesskey="U">Patterns for Flask</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="form-validation-with-wtforms">
+<h1>Form Validation with WTForms<a class="headerlink" href="#form-validation-with-wtforms" title="Permalink to this headline">¶</a></h1>
+<p>When you have to work with form data submitted by a browser view code
+quickly becomes very hard to read. There are libraries out there designed
+to make this process easier to manage. One of them is <a class="reference external" href="http://wtforms.simplecodes.com/">WTForms</a> which we
+will handle here. If you find yourself in the situation of having many
+forms, you might want to give it a try.</p>
+<p>When you are working with WTForms you have to define your forms as classes
+first. I recommend breaking up the application into multiple modules
+(<a class="reference internal" href="packages.html#larger-applications"><em>Larger Applications</em></a>) for that and adding a separate module for the
+forms.</p>
+<div class="admonition-getting-most-of-wtforms-with-an-extension admonition ">
+<p class="first admonition-title">Getting most of WTForms with an Extension</p>
+<p class="last">The <a class="reference external" href="http://packages.python.org/Flask-WTF/">Flask-WTF</a> extension expands on this pattern and adds a few
+handful little helpers that make working with forms and Flask more
+fun. You can get it from <a class="reference external" href="http://pypi.python.org/pypi/Flask-WTF">PyPI</a>.</p>
+</div>
+<div class="section" id="the-forms">
+<h2>The Forms<a class="headerlink" href="#the-forms" title="Permalink to this headline">¶</a></h2>
+<p>This is an example form for a typical registration page:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">wtforms</span> <span class="kn">import</span> <span class="n">Form</span><span class="p">,</span> <span class="n">BooleanField</span><span class="p">,</span> <span class="n">TextField</span><span class="p">,</span> <span class="n">validators</span>
+
+<span class="k">class</span> <span class="nc">RegistrationForm</span><span class="p">(</span><span class="n">Form</span><span class="p">):</span>
+ <span class="n">username</span> <span class="o">=</span> <span class="n">TextField</span><span class="p">(</span><span class="s">&#39;Username&#39;</span><span class="p">,</span> <span class="p">[</span><span class="n">validators</span><span class="o">.</span><span class="n">Length</span><span class="p">(</span><span class="nb">min</span><span class="o">=</span><span class="mi">4</span><span class="p">,</span> <span class="nb">max</span><span class="o">=</span><span class="mi">25</span><span class="p">)])</span>
+ <span class="n">email</span> <span class="o">=</span> <span class="n">TextField</span><span class="p">(</span><span class="s">&#39;Email Address&#39;</span><span class="p">,</span> <span class="p">[</span><span class="n">validators</span><span class="o">.</span><span class="n">Length</span><span class="p">(</span><span class="nb">min</span><span class="o">=</span><span class="mi">6</span><span class="p">,</span> <span class="nb">max</span><span class="o">=</span><span class="mi">35</span><span class="p">)])</span>
+ <span class="n">password</span> <span class="o">=</span> <span class="n">PasswordField</span><span class="p">(</span><span class="s">&#39;New Password&#39;</span><span class="p">,</span> <span class="p">[</span>
+ <span class="n">validators</span><span class="o">.</span><span class="n">Required</span><span class="p">(),</span>
+ <span class="n">validators</span><span class="o">.</span><span class="n">EqualTo</span><span class="p">(</span><span class="s">&#39;confirm&#39;</span><span class="p">,</span> <span class="n">message</span><span class="o">=</span><span class="s">&#39;Passwords must match&#39;</span><span class="p">)</span>
+ <span class="p">])</span>
+ <span class="n">confirm</span> <span class="o">=</span> <span class="n">PasswordField</span><span class="p">(</span><span class="s">&#39;Repeat Password&#39;</span><span class="p">)</span>
+ <span class="n">accept_tos</span> <span class="o">=</span> <span class="n">BooleanField</span><span class="p">(</span><span class="s">&#39;I accept the TOS&#39;</span><span class="p">,</span> <span class="p">[</span><span class="n">validators</span><span class="o">.</span><span class="n">Required</span><span class="p">()])</span>
+</pre></div>
+</div>
+</div>
+<div class="section" id="in-the-view">
+<h2>In the View<a class="headerlink" href="#in-the-view" title="Permalink to this headline">¶</a></h2>
+<p>In the view function, the usage of this form looks like this:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/register&#39;</span><span class="p">,</span> <span class="n">methods</span><span class="o">=</span><span class="p">[</span><span class="s">&#39;GET&#39;</span><span class="p">,</span> <span class="s">&#39;POST&#39;</span><span class="p">])</span>
+<span class="k">def</span> <span class="nf">register</span><span class="p">():</span>
+ <span class="n">form</span> <span class="o">=</span> <span class="n">RegistrationForm</span><span class="p">(</span><span class="n">request</span><span class="o">.</span><span class="n">form</span><span class="p">)</span>
+ <span class="k">if</span> <span class="n">request</span><span class="o">.</span><span class="n">method</span> <span class="o">==</span> <span class="s">&#39;POST&#39;</span> <span class="ow">and</span> <span class="n">form</span><span class="o">.</span><span class="n">validate</span><span class="p">():</span>
+ <span class="n">user</span> <span class="o">=</span> <span class="n">User</span><span class="p">(</span><span class="n">form</span><span class="o">.</span><span class="n">username</span><span class="o">.</span><span class="n">data</span><span class="p">,</span> <span class="n">form</span><span class="o">.</span><span class="n">email</span><span class="o">.</span><span class="n">data</span><span class="p">,</span>
+ <span class="n">form</span><span class="o">.</span><span class="n">password</span><span class="o">.</span><span class="n">data</span><span class="p">)</span>
+ <span class="n">db_session</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">user</span><span class="p">)</span>
+ <span class="n">flash</span><span class="p">(</span><span class="s">&#39;Thanks for registering&#39;</span><span class="p">)</span>
+ <span class="k">return</span> <span class="n">redirect</span><span class="p">(</span><span class="n">url_for</span><span class="p">(</span><span class="s">&#39;login&#39;</span><span class="p">))</span>
+ <span class="k">return</span> <span class="n">render_template</span><span class="p">(</span><span class="s">&#39;register.html&#39;</span><span class="p">,</span> <span class="n">form</span><span class="o">=</span><span class="n">form</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>Notice that we are implying that the view is using SQLAlchemy here
+(<a class="reference internal" href="sqlalchemy.html#sqlalchemy-pattern"><em>SQLAlchemy in Flask</em></a>) but this is no requirement of course. Adapt
+the code as necessary.</p>
+<p>Things to remember:</p>
+<ol class="arabic simple">
+<li>create the form from the request <tt class="xref py py-attr docutils literal"><span class="pre">form</span></tt> value if
+the data is submitted via the HTTP <cite>POST</cite> method and
+<tt class="xref py py-attr docutils literal"><span class="pre">args</span></tt> if the data is submitted as <cite>GET</cite>.</li>
+<li>to validate the data, call the <tt class="xref py py-func docutils literal"><span class="pre">validate()</span></tt>
+method which will return <cite>True</cite> if the data validates, <cite>False</cite>
+otherwise.</li>
+<li>to access individual values from the form, access <cite>form.&lt;NAME&gt;.data</cite>.</li>
+</ol>
+</div>
+<div class="section" id="forms-in-templates">
+<h2>Forms in Templates<a class="headerlink" href="#forms-in-templates" title="Permalink to this headline">¶</a></h2>
+<p>Now to the template side. When you pass the form to the templates you can
+easily render them there. Look at the following example template to see
+how easy this is. WTForms does half the form generation for us already.
+To make it even nicer, we can write a macro that renders a field with
+label and a list of errors if there are any.</p>
+<p>Here&#8217;s an example <cite>_formhelpers.html</cite> template with such a macro:</p>
+<div class="highlight-html+jinja"><div class="highlight"><pre><span class="cp">{%</span> <span class="k">macro</span> <span class="nv">render_field</span><span class="o">(</span><span class="nv">field</span><span class="o">)</span> <span class="cp">%}</span>
+ <span class="nt">&lt;dt&gt;</span><span class="cp">{{</span> <span class="nv">field.label</span> <span class="cp">}}</span>
+ <span class="nt">&lt;dd&gt;</span><span class="cp">{{</span> <span class="nv">field</span><span class="o">(**</span><span class="nv">kwargs</span><span class="o">)|</span><span class="nf">safe</span> <span class="cp">}}</span>
+ <span class="cp">{%</span> <span class="k">if</span> <span class="nv">field.errors</span> <span class="cp">%}</span>
+ <span class="nt">&lt;ul</span> <span class="na">class=</span><span class="s">&quot;errors&quot;</span><span class="nt">&gt;</span>
+ <span class="cp">{%</span> <span class="k">for</span> <span class="nv">error</span> <span class="k">in</span> <span class="nv">field.errors</span> <span class="cp">%}</span><span class="nt">&lt;li&gt;</span><span class="cp">{{</span> <span class="nv">error</span> <span class="cp">}}{%</span> <span class="k">endfor</span> <span class="cp">%}</span>
+ <span class="nt">&lt;/ul&gt;</span>
+ <span class="cp">{%</span> <span class="k">endif</span> <span class="cp">%}</span>
+ <span class="nt">&lt;/dd&gt;</span>
+<span class="cp">{%</span> <span class="k">endmacro</span> <span class="cp">%}</span>
+</pre></div>
+</div>
+<p>This macro accepts a couple of keyword arguments that are forwarded to
+WTForm&#8217;s field function that renders the field for us. The keyword
+arguments will be inserted as HTML attributes. So for example you can
+call <tt class="docutils literal"><span class="pre">render_field(form.username,</span> <span class="pre">class='username')</span></tt> to add a class to
+the input element. Note that WTForms returns standard Python unicode
+strings, so we have to tell Jinja2 that this data is already HTML escaped
+with the <cite>|safe</cite> filter.</p>
+<p>Here the <cite>register.html</cite> template for the function we used above which
+takes advantage of the <cite>_formhelpers.html</cite> template:</p>
+<div class="highlight-html+jinja"><div class="highlight"><pre><span class="cp">{%</span> <span class="k">from</span> <span class="s2">&quot;_formhelpers.html&quot;</span> <span class="k">import</span> <span class="nv">render_field</span> <span class="cp">%}</span>
+<span class="nt">&lt;form</span> <span class="na">method=</span><span class="s">&quot;post&quot;</span> <span class="na">action=</span><span class="s">&quot;/register&quot;</span><span class="nt">&gt;</span>
+ <span class="nt">&lt;dl&gt;</span>
+ <span class="cp">{{</span> <span class="nv">render_field</span><span class="o">(</span><span class="nv">form.username</span><span class="o">)</span> <span class="cp">}}</span>
+ <span class="cp">{{</span> <span class="nv">render_field</span><span class="o">(</span><span class="nv">form.email</span><span class="o">)</span> <span class="cp">}}</span>
+ <span class="cp">{{</span> <span class="nv">render_field</span><span class="o">(</span><span class="nv">form.password</span><span class="o">)</span> <span class="cp">}}</span>
+ <span class="cp">{{</span> <span class="nv">render_field</span><span class="o">(</span><span class="nv">form.confirm</span><span class="o">)</span> <span class="cp">}}</span>
+ <span class="cp">{{</span> <span class="nv">render_field</span><span class="o">(</span><span class="nv">form.accept_tos</span><span class="o">)</span> <span class="cp">}}</span>
+ <span class="nt">&lt;/dl&gt;</span>
+ <span class="nt">&lt;p&gt;&lt;input</span> <span class="na">type=</span><span class="s">submit</span> <span class="na">value=</span><span class="s">Register</span><span class="nt">&gt;</span>
+<span class="nt">&lt;/form&gt;</span>
+</pre></div>
+</div>
+<p>For more information about WTForms, head over to the <a class="reference external" href="http://wtforms.simplecodes.com/">WTForms
+website</a>.</p>
+</div>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="../index.html">
+ <img class="logo" src="../_static/flask.png" alt="Logo"/>
+</a></p>
+ <h3><a href="../index.html">Table Of Contents</a></h3>
+ <ul>
+<li><a class="reference internal" href="#">Form Validation with WTForms</a><ul>
+<li><a class="reference internal" href="#the-forms">The Forms</a></li>
+<li><a class="reference internal" href="#in-the-view">In the View</a></li>
+<li><a class="reference internal" href="#forms-in-templates">Forms in Templates</a></li>
+</ul>
+</li>
+</ul>
+<h3>Related Topics</h3>
+<ul>
+ <li><a href="../index.html">Documentation overview</a><ul>
+ <li><a href="index.html">Patterns for Flask</a><ul>
+ <li>Previous: <a href="viewdecorators.html" title="previous chapter">View Decorators</a></li>
+ <li>Next: <a href="templateinheritance.html" title="next chapter">Template Inheritance</a></li>
+ </ul></li>
+ </ul></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="../_sources/patterns/wtforms.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/quickstart.html b/app/static/doc/flask-docs/quickstart.html
new file mode 100644
index 0000000..4a26798
--- /dev/null
+++ b/app/static/doc/flask-docs/quickstart.html
@@ -0,0 +1,875 @@
+
+<!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>Quickstart &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="index.html" />
+ <link rel="next" title="Tutorial" href="tutorial/index.html" />
+ <link rel="prev" title="Installation" href="installation.html" />
+
+
+ <link rel="apple-touch-icon" href="_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <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="tutorial/index.html" title="Tutorial"
+ accesskey="N">next</a> |</li>
+ <li class="right" >
+ <a href="installation.html" title="Installation"
+ accesskey="P">previous</a> |</li>
+ <li><a href="index.html">Flask 0.8 documentation</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="quickstart">
+<span id="id1"></span><h1>Quickstart<a class="headerlink" href="#quickstart" title="Permalink to this headline">¶</a></h1>
+<p>Eager to get started? This page gives a good introduction in how to get
+started with Flask. This assumes you already have Flask installed. If
+you do not, head over to the <a class="reference internal" href="installation.html#installation"><em>Installation</em></a> section.</p>
+<div class="section" id="a-minimal-application">
+<h2>A Minimal Application<a class="headerlink" href="#a-minimal-application" title="Permalink to this headline">¶</a></h2>
+<p>A minimal Flask application looks something like this:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">Flask</span>
+<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="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/&#39;</span><span class="p">)</span>
+<span class="k">def</span> <span class="nf">hello_world</span><span class="p">():</span>
+ <span class="k">return</span> <span class="s">&#39;Hello World!&#39;</span>
+
+<span class="k">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">&#39;__main__&#39;</span><span class="p">:</span>
+ <span class="n">app</span><span class="o">.</span><span class="n">run</span><span class="p">()</span>
+</pre></div>
+</div>
+<p>Just save it as <cite>hello.py</cite> or something similar and run it with your
+Python interpreter. Make sure to not call your application <cite>flask.py</cite>
+because this would conflict with Flask itself.</p>
+<div class="highlight-python"><pre>$ python hello.py
+ * Running on http://127.0.0.1:5000/</pre>
+</div>
+<p>Head over to <a class="reference external" href="http://127.0.0.1:5000/">http://127.0.0.1:5000/</a>, you should
+see your hello world greeting.</p>
+<p>So what did that code do?</p>
+<ol class="arabic simple">
+<li>First we imported the <a class="reference internal" href="api.html#flask.Flask" title="flask.Flask"><tt class="xref py py-class docutils literal"><span class="pre">Flask</span></tt></a> class. An instance of this
+class will be our WSGI application. The first argument is the name of
+the application&#8217;s module. If you are using a single module (like here)
+you should use <cite>__name__</cite> because depending on if it&#8217;s started as
+application or imported as module the name will be different
+(<tt class="docutils literal"><span class="pre">'__main__'</span></tt> versus the actual import name). For more information
+on that, have a look at the <a class="reference internal" href="api.html#flask.Flask" title="flask.Flask"><tt class="xref py py-class docutils literal"><span class="pre">Flask</span></tt></a> documentation.</li>
+<li>Next we create an instance of it. We pass it the name of the module /
+package. This is needed so that Flask knows where it should look for
+templates, static files and so on.</li>
+<li>Then we use the <a class="reference internal" href="api.html#flask.Flask.route" title="flask.Flask.route"><tt class="xref py py-meth docutils literal"><span class="pre">route()</span></tt></a> decorator to tell Flask
+what URL should trigger our function.</li>
+<li>The function then has a name which is also used to generate URLs to
+that particular function, and returns the message we want to display in
+the user&#8217;s browser.</li>
+<li>Finally we use the <a class="reference internal" href="api.html#flask.Flask.run" title="flask.Flask.run"><tt class="xref py py-meth docutils literal"><span class="pre">run()</span></tt></a> function to run the
+local server with our application. The <tt class="docutils literal"><span class="pre">if</span> <span class="pre">__name__</span> <span class="pre">==</span> <span class="pre">'__main__':</span></tt>
+makes sure the server only runs if the script is executed directly from
+the Python interpreter and not used as imported module.</li>
+</ol>
+<p>To stop the server, hit control-C.</p>
+<div class="admonition-externally-visible-server admonition " id="public-server">
+<p class="first admonition-title">Externally Visible Server</p>
+<p>If you run the server you will notice that the server is only available
+from your own computer, not from any other in the network. This is the
+default because in debugging mode a user of the application can execute
+arbitrary Python code on your computer. If you have <cite>debug</cite> disabled
+or trust the users on your network, you can make the server publicly
+available.</p>
+<p>Just change the call of the <a class="reference internal" href="api.html#flask.Flask.run" title="flask.Flask.run"><tt class="xref py py-meth docutils literal"><span class="pre">run()</span></tt></a> method to look
+like this:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="n">app</span><span class="o">.</span><span class="n">run</span><span class="p">(</span><span class="n">host</span><span class="o">=</span><span class="s">&#39;0.0.0.0&#39;</span><span class="p">)</span>
+</pre></div>
+</div>
+<p class="last">This tells your operating system to listen on a public IP.</p>
+</div>
+</div>
+<div class="section" id="debug-mode">
+<h2>Debug Mode<a class="headerlink" href="#debug-mode" title="Permalink to this headline">¶</a></h2>
+<p>The <a class="reference internal" href="api.html#flask.Flask.run" title="flask.Flask.run"><tt class="xref py py-meth docutils literal"><span class="pre">run()</span></tt></a> method is nice to start a local
+development server, but you would have to restart it manually after each
+change you do to code. That is not very nice and Flask can do better. If
+you enable the debug support the server will reload itself on code changes
+and also provide you with a helpful debugger if things go wrong.</p>
+<p>There are two ways to enable debugging. Either set that flag on the
+application object:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="n">app</span><span class="o">.</span><span class="n">debug</span> <span class="o">=</span> <span class="bp">True</span>
+<span class="n">app</span><span class="o">.</span><span class="n">run</span><span class="p">()</span>
+</pre></div>
+</div>
+<p>Or pass it to run:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="n">app</span><span class="o">.</span><span class="n">run</span><span class="p">(</span><span class="n">debug</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>Both will have exactly the same effect.</p>
+<div class="admonition-attention admonition ">
+<p class="first admonition-title">Attention</p>
+<p class="last">Even though the interactive debugger does not work in forking environments
+(which makes it nearly impossible to use on production servers), it still
+allows the execution of arbitrary code. That makes it a major security
+risk and therefore it <strong>must never be used on production machines</strong>.</p>
+</div>
+<p>Screenshot of the debugger in action:</p>
+<img alt="screenshot of debugger in action" class="screenshot align-center" src="_images/debugger5.png" />
+<div class="admonition-working-with-other-debuggers admonition ">
+<p class="first admonition-title">Working With Other Debuggers</p>
+<p class="last">Debuggers interfere with each other. If you are using another debugger
+(e.g. PyDev or IntelliJ), you may need to set <tt class="docutils literal"><span class="pre">app.debug</span> <span class="pre">=</span> <span class="pre">False</span></tt>.</p>
+</div>
+</div>
+<div class="section" id="routing">
+<h2>Routing<a class="headerlink" href="#routing" title="Permalink to this headline">¶</a></h2>
+<p>Modern web applications have beautiful URLs. This helps people remember
+the URLs which is especially handy for applications that are used from
+mobile devices with slower network connections. If the user can directly
+go to the desired page without having to hit the index page it is more
+likely they will like the page and come back next time.</p>
+<p>As you have seen above, the <a class="reference internal" href="api.html#flask.Flask.route" title="flask.Flask.route"><tt class="xref py py-meth docutils literal"><span class="pre">route()</span></tt></a> decorator is used
+to bind a function to a URL. Here are some basic examples:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/&#39;</span><span class="p">)</span>
+<span class="k">def</span> <span class="nf">index</span><span class="p">():</span>
+ <span class="k">return</span> <span class="s">&#39;Index Page&#39;</span>
+
+<span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/hello&#39;</span><span class="p">)</span>
+<span class="k">def</span> <span class="nf">hello</span><span class="p">():</span>
+ <span class="k">return</span> <span class="s">&#39;Hello World&#39;</span>
+</pre></div>
+</div>
+<p>But there is more to it! You can make certain parts of the URL dynamic
+and attach multiple rules to a function.</p>
+<div class="section" id="variable-rules">
+<h3>Variable Rules<a class="headerlink" href="#variable-rules" title="Permalink to this headline">¶</a></h3>
+<p>To add variable parts to a URL you can mark these special sections as
+<tt class="docutils literal"><span class="pre">&lt;variable_name&gt;</span></tt>. Such a part is then passed as keyword argument to
+your function. Optionally a converter can be specified by specifying a
+rule with <tt class="docutils literal"><span class="pre">&lt;converter:variable_name&gt;</span></tt>. Here are some nice examples:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/user/&lt;username&gt;&#39;</span><span class="p">)</span>
+<span class="k">def</span> <span class="nf">show_user_profile</span><span class="p">(</span><span class="n">username</span><span class="p">):</span>
+ <span class="c"># show the user profile for that user</span>
+ <span class="k">pass</span>
+
+<span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/post/&lt;int:post_id&gt;&#39;</span><span class="p">)</span>
+<span class="k">def</span> <span class="nf">show_post</span><span class="p">(</span><span class="n">post_id</span><span class="p">):</span>
+ <span class="c"># show the post with the given id, the id is an integer</span>
+ <span class="k">pass</span>
+</pre></div>
+</div>
+<p>The following converters exist:</p>
+<table border="1" class="docutils">
+<colgroup>
+<col width="20%" />
+<col width="80%" />
+</colgroup>
+<tbody valign="top">
+<tr class="row-odd"><td><cite>int</cite></td>
+<td>accepts integers</td>
+</tr>
+<tr class="row-even"><td><cite>float</cite></td>
+<td>like <cite>int</cite> but for floating point values</td>
+</tr>
+<tr class="row-odd"><td><cite>path</cite></td>
+<td>like the default but also accepts slashes</td>
+</tr>
+</tbody>
+</table>
+<div class="admonition-unique-urls-redirection-behaviour admonition ">
+<p class="first admonition-title">Unique URLs / Redirection Behaviour</p>
+<p>Flask&#8217;s URL rules are based on Werkzeug&#8217;s routing module. The idea
+behind that module is to ensure nice looking and also unique URLs based
+on behaviour Apache and earlier servers coined.</p>
+<p>Take these two rules:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/projects/&#39;</span><span class="p">)</span>
+<span class="k">def</span> <span class="nf">projects</span><span class="p">():</span>
+ <span class="k">pass</span>
+
+<span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/about&#39;</span><span class="p">)</span>
+<span class="k">def</span> <span class="nf">about</span><span class="p">():</span>
+ <span class="k">pass</span>
+</pre></div>
+</div>
+<p>They look rather similar, the difference is the trailing slash in the
+URL <em>definition</em>. In the first case, the canonical URL for the
+<cite>projects</cite> endpoint has a trailing slash. It&#8217;s similar to a folder in
+that sense. Accessing it without a trailing slash will cause Flask to
+redirect to the canonical URL with the trailing slash.</p>
+<p>However in the second case the URL is defined without a slash so it
+behaves similar to a file and accessing the URL with a trailing slash
+will be a 404 error.</p>
+<p class="last">Why is this? This allows relative URLs to continue working if users
+access the page when they forget a trailing slash. This behaviour is
+also consistent with how Apache and other servers work. Also, the URLs
+will stay unique which helps search engines not indexing the same page
+twice.</p>
+</div>
+</div>
+<div class="section" id="url-building">
+<span id="id2"></span><h3>URL Building<a class="headerlink" href="#url-building" title="Permalink to this headline">¶</a></h3>
+<p>If it can match URLs, can it also generate them? Of course it can. To
+build a URL to a specific function you can use the <a class="reference internal" href="api.html#flask.url_for" title="flask.url_for"><tt class="xref py py-func docutils literal"><span class="pre">url_for()</span></tt></a>
+function. It accepts the name of the function as first argument and a
+number of keyword arguments, each corresponding to the variable part of
+the URL rule. Unknown variable parts are appended to the URL as query
+parameter. Here are some examples:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">Flask</span><span class="p">,</span> <span class="n">url_for</span>
+<span class="gp">&gt;&gt;&gt; </span><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="gp">&gt;&gt;&gt; </span><span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/&#39;</span><span class="p">)</span>
+<span class="gp">... </span><span class="k">def</span> <span class="nf">index</span><span class="p">():</span> <span class="k">pass</span>
+<span class="gp">...</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/login&#39;</span><span class="p">)</span>
+<span class="gp">... </span><span class="k">def</span> <span class="nf">login</span><span class="p">():</span> <span class="k">pass</span>
+<span class="gp">...</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/user/&lt;username&gt;&#39;</span><span class="p">)</span>
+<span class="gp">... </span><span class="k">def</span> <span class="nf">profile</span><span class="p">(</span><span class="n">username</span><span class="p">):</span> <span class="k">pass</span>
+<span class="gp">...</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="k">with</span> <span class="n">app</span><span class="o">.</span><span class="n">test_request_context</span><span class="p">():</span>
+<span class="gp">... </span> <span class="k">print</span> <span class="n">url_for</span><span class="p">(</span><span class="s">&#39;index&#39;</span><span class="p">)</span>
+<span class="gp">... </span> <span class="k">print</span> <span class="n">url_for</span><span class="p">(</span><span class="s">&#39;login&#39;</span><span class="p">)</span>
+<span class="gp">... </span> <span class="k">print</span> <span class="n">url_for</span><span class="p">(</span><span class="s">&#39;login&#39;</span><span class="p">,</span> <span class="nb">next</span><span class="o">=</span><span class="s">&#39;/&#39;</span><span class="p">)</span>
+<span class="gp">... </span> <span class="k">print</span> <span class="n">url_for</span><span class="p">(</span><span class="s">&#39;profile&#39;</span><span class="p">,</span> <span class="n">username</span><span class="o">=</span><span class="s">&#39;John Doe&#39;</span><span class="p">)</span>
+<span class="gp">...</span>
+<span class="go">/</span>
+<span class="go">/login</span>
+<span class="go">/login?next=/</span>
+<span class="go">/user/John%20Doe</span>
+</pre></div>
+</div>
+<p>(This also uses the <a class="reference internal" href="api.html#flask.Flask.test_request_context" title="flask.Flask.test_request_context"><tt class="xref py py-meth docutils literal"><span class="pre">test_request_context()</span></tt></a> method
+explained below. It basically tells Flask to think we are handling a
+request even though we are not, we are in an interactive Python shell.
+Have a look at the explanation below. <a class="reference internal" href="#context-locals"><em>Context Locals</em></a>).</p>
+<p>Why would you want to build URLs instead of hardcoding them in your
+templates? There are three good reasons for this:</p>
+<ol class="arabic simple">
+<li>reversing is often more descriptive than hardcoding the URLs. Also and
+more importantly you can change URLs in one go without having to change
+the URLs all over the place.</li>
+<li>URL building will handle escaping of special characters and Unicode
+data transparently for you, you don&#8217;t have to deal with that.</li>
+<li>If your application is placed outside the URL root (so say in
+<tt class="docutils literal"><span class="pre">/myapplication</span></tt> instead of <tt class="docutils literal"><span class="pre">/</span></tt>), <a class="reference internal" href="api.html#flask.url_for" title="flask.url_for"><tt class="xref py py-func docutils literal"><span class="pre">url_for()</span></tt></a> will
+handle that properly for you.</li>
+</ol>
+</div>
+<div class="section" id="http-methods">
+<h3>HTTP Methods<a class="headerlink" href="#http-methods" title="Permalink to this headline">¶</a></h3>
+<p>HTTP (the protocol web applications are speaking) knows different methods
+to access URLs. By default a route only answers to <cite>GET</cite> requests, but
+that can be changed by providing the <cite>methods</cite> argument to the
+<a class="reference internal" href="api.html#flask.Flask.route" title="flask.Flask.route"><tt class="xref py py-meth docutils literal"><span class="pre">route()</span></tt></a> decorator. Here are some examples:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/login&#39;</span><span class="p">,</span> <span class="n">methods</span><span class="o">=</span><span class="p">[</span><span class="s">&#39;GET&#39;</span><span class="p">,</span> <span class="s">&#39;POST&#39;</span><span class="p">])</span>
+<span class="k">def</span> <span class="nf">login</span><span class="p">():</span>
+ <span class="k">if</span> <span class="n">request</span><span class="o">.</span><span class="n">method</span> <span class="o">==</span> <span class="s">&#39;POST&#39;</span><span class="p">:</span>
+ <span class="n">do_the_login</span><span class="p">()</span>
+ <span class="k">else</span><span class="p">:</span>
+ <span class="n">show_the_login_form</span><span class="p">()</span>
+</pre></div>
+</div>
+<p>If <cite>GET</cite> is present, <cite>HEAD</cite> will be added automatically for you. You
+don&#8217;t have to deal with that. It will also make sure that <cite>HEAD</cite> requests
+are handled like the <a class="reference external" href="http://www.ietf.org/rfc/rfc2068.txt">HTTP RFC</a> (the document describing the HTTP
+protocol) demands, so you can completely ignore that part of the HTTP
+specification. Likewise as of Flask 0.6, <cite>OPTIONS</cite> is implemented for you
+as well automatically.</p>
+<p>You have no idea what an HTTP method is? Worry not, here is a quick
+introduction to HTTP methods and why they matter:</p>
+<p>The HTTP method (also often called &#8220;the verb&#8221;) tells the server what the
+clients wants to <em>do</em> with the requested page. The following methods are
+very common:</p>
+<dl class="docutils">
+<dt><cite>GET</cite></dt>
+<dd>The browser tells the server to just <em>get</em> the information stored on
+that page and send it. This is probably the most common method.</dd>
+<dt><cite>HEAD</cite></dt>
+<dd>The browser tells the server to get the information, but it is only
+interested in the <em>headers</em>, not the content of the page. An
+application is supposed to handle that as if a <cite>GET</cite> request was
+received but to not deliver the actual content. In Flask you don&#8217;t
+have to deal with that at all, the underlying Werkzeug library handles
+that for you.</dd>
+<dt><cite>POST</cite></dt>
+<dd>The browser tells the server that it wants to <em>post</em> some new
+information to that URL and that the server must ensure the data is
+stored and only stored once. This is how HTML forms are usually
+transmitting data to the server.</dd>
+<dt><cite>PUT</cite></dt>
+<dd>Similar to <cite>POST</cite> but the server might trigger the store procedure
+multiple times by overwriting the old values more than once. Now you
+might be asking why is this useful, but there are some good reasons
+to do it this way. Consider that the connection gets lost during
+transmission: in this situation a system between the browser and the
+server might receive the request safely a second time without breaking
+things. With <cite>POST</cite> that would not be possible because it must only
+be triggered once.</dd>
+<dt><cite>DELETE</cite></dt>
+<dd>Remove the information at the given location.</dd>
+<dt><cite>OPTIONS</cite></dt>
+<dd>Provides a quick way for a client to figure out which methods are
+supported by this URL. Starting with Flask 0.6, this is implemented
+for you automatically.</dd>
+</dl>
+<p>Now the interesting part is that in HTML4 and XHTML1, the only methods a
+form can submit to the server are <cite>GET</cite> and <cite>POST</cite>. But with JavaScript
+and future HTML standards you can use the other methods as well. Furthermore
+HTTP has become quite popular lately and browsers are no longer the only
+clients that are using HTTP. For instance, many revision control system
+use it.</p>
+</div>
+</div>
+<div class="section" id="static-files">
+<h2>Static Files<a class="headerlink" href="#static-files" title="Permalink to this headline">¶</a></h2>
+<p>Dynamic web applications need static files as well. That&#8217;s usually where
+the CSS and JavaScript files are coming from. Ideally your web server is
+configured to serve them for you, but during development Flask can do that
+as well. Just create a folder called <cite>static</cite> in your package or next to
+your module and it will be available at <cite>/static</cite> on the application.</p>
+<p>To generate URLs to that part of the URL, use the special <tt class="docutils literal"><span class="pre">'static'</span></tt> URL
+name:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="n">url_for</span><span class="p">(</span><span class="s">&#39;static&#39;</span><span class="p">,</span> <span class="n">filename</span><span class="o">=</span><span class="s">&#39;style.css&#39;</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>The file has to be stored on the filesystem as <tt class="docutils literal"><span class="pre">static/style.css</span></tt>.</p>
+</div>
+<div class="section" id="rendering-templates">
+<h2>Rendering Templates<a class="headerlink" href="#rendering-templates" title="Permalink to this headline">¶</a></h2>
+<p>Generating HTML from within Python is not fun, and actually pretty
+cumbersome because you have to do the HTML escaping on your own to keep
+the application secure. Because of that Flask configures the <a class="reference external" href="http://jinja.pocoo.org/2/">Jinja2</a> template engine for you automatically.</p>
+<p>To render a template you can use the <a class="reference internal" href="api.html#flask.render_template" title="flask.render_template"><tt class="xref py py-func docutils literal"><span class="pre">render_template()</span></tt></a>
+method. All you have to do is to provide the name of the template and the
+variables you want to pass to the template engine as keyword arguments.
+Here&#8217;s a simple example of how to render a template:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">render_template</span>
+
+<span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/hello/&#39;</span><span class="p">)</span>
+<span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/hello/&lt;name&gt;&#39;</span><span class="p">)</span>
+<span class="k">def</span> <span class="nf">hello</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+ <span class="k">return</span> <span class="n">render_template</span><span class="p">(</span><span class="s">&#39;hello.html&#39;</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="n">name</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>Flask will look for templates in the <cite>templates</cite> folder. So if your
+application is a module, that folder is next to that module, if it&#8217;s a
+package it&#8217;s actually inside your package:</p>
+<p><strong>Case 1</strong>: a module:</p>
+<div class="highlight-python"><pre>/application.py
+/templates
+ /hello.html</pre>
+</div>
+<p><strong>Case 2</strong>: a package:</p>
+<div class="highlight-python"><pre>/application
+ /__init__.py
+ /templates
+ /hello.html</pre>
+</div>
+<p>For templates you can use the full power of Jinja2 templates. Head over
+to the the official <a class="reference external" href="http://jinja.pocoo.org/2/documentation/templates">Jinja2 Template Documentation</a> for more information.</p>
+<p>Here is an example template:</p>
+<div class="highlight-html+jinja"><div class="highlight"><pre><span class="cp">&lt;!doctype html&gt;</span>
+<span class="nt">&lt;title&gt;</span>Hello from Flask<span class="nt">&lt;/title&gt;</span>
+<span class="cp">{%</span> <span class="k">if</span> <span class="nv">name</span> <span class="cp">%}</span>
+ <span class="nt">&lt;h1&gt;</span>Hello <span class="cp">{{</span> <span class="nv">name</span> <span class="cp">}}</span>!<span class="nt">&lt;/h1&gt;</span>
+<span class="cp">{%</span> <span class="k">else</span> <span class="cp">%}</span>
+ <span class="nt">&lt;h1&gt;</span>Hello World!<span class="nt">&lt;/h1&gt;</span>
+<span class="cp">{%</span> <span class="k">endif</span> <span class="cp">%}</span>
+</pre></div>
+</div>
+<p>Inside templates you also have access to the <a class="reference internal" href="api.html#flask.request" title="flask.request"><tt class="xref py py-class docutils literal"><span class="pre">request</span></tt></a>,
+<a class="reference internal" href="api.html#flask.session" title="flask.session"><tt class="xref py py-class docutils literal"><span class="pre">session</span></tt></a> and <a class="reference internal" href="api.html#flask.g" title="flask.g"><tt class="xref py py-class docutils literal"><span class="pre">g</span></tt></a> <a class="footnote-reference" href="#id4" id="id3">[1]</a> objects
+as well as the <a class="reference internal" href="api.html#flask.get_flashed_messages" title="flask.get_flashed_messages"><tt class="xref py py-func docutils literal"><span class="pre">get_flashed_messages()</span></tt></a> function.</p>
+<p>Templates are especially useful if inheritance is used. If you want to
+know how that works, head over to the <a class="reference internal" href="patterns/templateinheritance.html#template-inheritance"><em>Template Inheritance</em></a> pattern
+documentation. Basically template inheritance makes it possible to keep
+certain elements on each page (like header, navigation and footer).</p>
+<p>Automatic escaping is enabled, so if name contains HTML it will be escaped
+automatically. If you can trust a variable and you know that it will be
+safe HTML (because for example it came from a module that converts wiki
+markup to HTML) you can mark it as safe by using the
+<tt class="xref py py-class docutils literal"><span class="pre">Markup</span></tt> class or by using the <tt class="docutils literal"><span class="pre">|safe</span></tt> filter in the
+template. Head over to the Jinja 2 documentation for more examples.</p>
+<p>Here is a basic introduction to how the <tt class="xref py py-class docutils literal"><span class="pre">Markup</span></tt> class works:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">Markup</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">Markup</span><span class="p">(</span><span class="s">&#39;&lt;strong&gt;Hello </span><span class="si">%s</span><span class="s">!&lt;/strong&gt;&#39;</span><span class="p">)</span> <span class="o">%</span> <span class="s">&#39;&lt;blink&gt;hacker&lt;/blink&gt;&#39;</span>
+<span class="go">Markup(u&#39;&lt;strong&gt;Hello &amp;lt;blink&amp;gt;hacker&amp;lt;/blink&amp;gt;!&lt;/strong&gt;&#39;)</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">Markup</span><span class="o">.</span><span class="n">escape</span><span class="p">(</span><span class="s">&#39;&lt;blink&gt;hacker&lt;/blink&gt;&#39;</span><span class="p">)</span>
+<span class="go">Markup(u&#39;&amp;lt;blink&amp;gt;hacker&amp;lt;/blink&amp;gt;&#39;)</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">Markup</span><span class="p">(</span><span class="s">&#39;&lt;em&gt;Marked up&lt;/em&gt; &amp;raquo; HTML&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">striptags</span><span class="p">()</span>
+<span class="go">u&#39;Marked up \xbb HTML&#39;</span>
+</pre></div>
+</div>
+<p class="versionchanged">
+<span class="versionmodified">Changed in version 0.5.</span></p>
+<table class="docutils footnote" frame="void" id="id4" rules="none">
+<colgroup><col class="label" /><col /></colgroup>
+<tbody valign="top">
+<tr><td class="label"><a class="fn-backref" href="#id3">[1]</a></td><td>Unsure what that <a class="reference internal" href="api.html#flask.g" title="flask.g"><tt class="xref py py-class docutils literal"><span class="pre">g</span></tt></a> object is? It&#8217;s something in which
+you can store information for your own needs, check the documentation of
+that object (<a class="reference internal" href="api.html#flask.g" title="flask.g"><tt class="xref py py-class docutils literal"><span class="pre">g</span></tt></a>) and the <a class="reference internal" href="patterns/sqlite3.html#sqlite3"><em>Using SQLite 3 with Flask</em></a> for more
+information.</td></tr>
+</tbody>
+</table>
+</div>
+<div class="section" id="accessing-request-data">
+<h2>Accessing Request Data<a class="headerlink" href="#accessing-request-data" title="Permalink to this headline">¶</a></h2>
+<p>For web applications it&#8217;s crucial to react to the data a client sent to
+the server. In Flask this information is provided by the global
+<a class="reference internal" href="api.html#flask.request" title="flask.request"><tt class="xref py py-class docutils literal"><span class="pre">request</span></tt></a> object. If you have some experience with Python
+you might be wondering how that object can be global and how Flask
+manages to still be threadsafe. The answer are context locals:</p>
+<div class="section" id="context-locals">
+<span id="id5"></span><h3>Context Locals<a class="headerlink" href="#context-locals" title="Permalink to this headline">¶</a></h3>
+<div class="admonition-insider-information admonition ">
+<p class="first admonition-title">Insider Information</p>
+<p class="last">If you want to understand how that works and how you can implement
+tests with context locals, read this section, otherwise just skip it.</p>
+</div>
+<p>Certain objects in Flask are global objects, but not of the usual kind.
+These objects are actually proxies to objects that are local to a specific
+context. What a mouthful. But that is actually quite easy to understand.</p>
+<p>Imagine the context being the handling thread. A request comes in and the
+webserver decides to spawn a new thread (or something else, the
+underlying object is capable of dealing with other concurrency systems
+than threads as well). When Flask starts its internal request handling it
+figures out that the current thread is the active context and binds the
+current application and the WSGI environments to that context (thread).
+It does that in an intelligent way that one application can invoke another
+application without breaking.</p>
+<p>So what does this mean to you? Basically you can completely ignore that
+this is the case unless you are doing something like unittesting. You
+will notice that code that depends on a request object will suddenly break
+because there is no request object. The solution is creating a request
+object yourself and binding it to the context. The easiest solution for
+unittesting is by using the <a class="reference internal" href="api.html#flask.Flask.test_request_context" title="flask.Flask.test_request_context"><tt class="xref py py-meth docutils literal"><span class="pre">test_request_context()</span></tt></a>
+context manager. In combination with the <cite>with</cite> statement it will bind a
+test request so that you can interact with it. Here is an example:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">request</span>
+
+<span class="k">with</span> <span class="n">app</span><span class="o">.</span><span class="n">test_request_context</span><span class="p">(</span><span class="s">&#39;/hello&#39;</span><span class="p">,</span> <span class="n">method</span><span class="o">=</span><span class="s">&#39;POST&#39;</span><span class="p">):</span>
+ <span class="c"># now you can do something with the request until the</span>
+ <span class="c"># end of the with block, such as basic assertions:</span>
+ <span class="k">assert</span> <span class="n">request</span><span class="o">.</span><span class="n">path</span> <span class="o">==</span> <span class="s">&#39;/hello&#39;</span>
+ <span class="k">assert</span> <span class="n">request</span><span class="o">.</span><span class="n">method</span> <span class="o">==</span> <span class="s">&#39;POST&#39;</span>
+</pre></div>
+</div>
+<p>The other possibility is passing a whole WSGI environment to the
+<a class="reference internal" href="api.html#flask.Flask.request_context" title="flask.Flask.request_context"><tt class="xref py py-meth docutils literal"><span class="pre">request_context()</span></tt></a> method:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">request</span>
+
+<span class="k">with</span> <span class="n">app</span><span class="o">.</span><span class="n">request_context</span><span class="p">(</span><span class="n">environ</span><span class="p">):</span>
+ <span class="k">assert</span> <span class="n">request</span><span class="o">.</span><span class="n">method</span> <span class="o">==</span> <span class="s">&#39;POST&#39;</span>
+</pre></div>
+</div>
+</div>
+<div class="section" id="the-request-object">
+<h3>The Request Object<a class="headerlink" href="#the-request-object" title="Permalink to this headline">¶</a></h3>
+<p>The request object is documented in the API section and we will not cover
+it here in detail (see <a class="reference internal" href="api.html#flask.request" title="flask.request"><tt class="xref py py-class docutils literal"><span class="pre">request</span></tt></a>). Here is a broad overview of
+some of the most common operations. First of all you have to import it from
+the <cite>flask</cite> module:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">request</span>
+</pre></div>
+</div>
+<p>The current request method is available by using the
+<tt class="xref py py-attr docutils literal"><span class="pre">method</span></tt> attribute. To access form data (data
+transmitted in a <cite>POST</cite> or <cite>PUT</cite> request) you can use the
+<tt class="xref py py-attr docutils literal"><span class="pre">form</span></tt> attribute. Here is a full example of the two
+attributes mentioned above:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/login&#39;</span><span class="p">,</span> <span class="n">methods</span><span class="o">=</span><span class="p">[</span><span class="s">&#39;POST&#39;</span><span class="p">,</span> <span class="s">&#39;GET&#39;</span><span class="p">])</span>
+<span class="k">def</span> <span class="nf">login</span><span class="p">():</span>
+ <span class="n">error</span> <span class="o">=</span> <span class="bp">None</span>
+ <span class="k">if</span> <span class="n">request</span><span class="o">.</span><span class="n">method</span> <span class="o">==</span> <span class="s">&#39;POST&#39;</span><span class="p">:</span>
+ <span class="k">if</span> <span class="n">valid_login</span><span class="p">(</span><span class="n">request</span><span class="o">.</span><span class="n">form</span><span class="p">[</span><span class="s">&#39;username&#39;</span><span class="p">],</span>
+ <span class="n">request</span><span class="o">.</span><span class="n">form</span><span class="p">[</span><span class="s">&#39;password&#39;</span><span class="p">]):</span>
+ <span class="k">return</span> <span class="n">log_the_user_in</span><span class="p">(</span><span class="n">request</span><span class="o">.</span><span class="n">form</span><span class="p">[</span><span class="s">&#39;username&#39;</span><span class="p">])</span>
+ <span class="k">else</span><span class="p">:</span>
+ <span class="n">error</span> <span class="o">=</span> <span class="s">&#39;Invalid username/password&#39;</span>
+ <span class="c"># this is executed if the request method was GET or the</span>
+ <span class="c"># credentials were invalid</span>
+</pre></div>
+</div>
+<p>What happens if the key does not exist in the <cite>form</cite> attribute? In that
+case a special <a class="reference external" href="http://docs.python.org/dev/library/exceptions.html#KeyError" title="(in Python v3.3)"><tt class="xref py py-exc docutils literal"><span class="pre">KeyError</span></tt></a> is raised. You can catch it like a
+standard <a class="reference external" href="http://docs.python.org/dev/library/exceptions.html#KeyError" title="(in Python v3.3)"><tt class="xref py py-exc docutils literal"><span class="pre">KeyError</span></tt></a> but if you don&#8217;t do that, a HTTP 400 Bad Request
+error page is shown instead. So for many situations you don&#8217;t have to
+deal with that problem.</p>
+<p>To access parameters submitted in the URL (<tt class="docutils literal"><span class="pre">?key=value</span></tt>) you can use the
+<tt class="xref py py-attr docutils literal"><span class="pre">args</span></tt> attribute:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="n">searchword</span> <span class="o">=</span> <span class="n">request</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;q&#39;</span><span class="p">,</span> <span class="s">&#39;&#39;</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>We recommend accessing URL parameters with <cite>get</cite> or by catching the
+<cite>KeyError</cite> because users might change the URL and presenting them a 400
+bad request page in that case is not user friendly.</p>
+<p>For a full list of methods and attributes of the request object, head over
+to the <a class="reference internal" href="api.html#flask.request" title="flask.request"><tt class="xref py py-class docutils literal"><span class="pre">request</span></tt></a> documentation.</p>
+</div>
+<div class="section" id="file-uploads">
+<h3>File Uploads<a class="headerlink" href="#file-uploads" title="Permalink to this headline">¶</a></h3>
+<p>You can handle uploaded files with Flask easily. Just make sure not to
+forget to set the <tt class="docutils literal"><span class="pre">enctype=&quot;multipart/form-data&quot;</span></tt> attribute on your HTML
+form, otherwise the browser will not transmit your files at all.</p>
+<p>Uploaded files are stored in memory or at a temporary location on the
+filesystem. You can access those files by looking at the
+<tt class="xref py py-attr docutils literal"><span class="pre">files</span></tt> attribute on the request object. Each
+uploaded file is stored in that dictionary. It behaves just like a
+standard Python <tt class="xref py py-class docutils literal"><span class="pre">file</span></tt> object, but it also has a
+<a class="reference external" href="http://werkzeug.pocoo.org/docs/datastructures/#werkzeug.datastructures.FileStorage.save" title="(in Werkzeug v0.7)"><tt class="xref py py-meth docutils literal"><span class="pre">save()</span></tt></a> method that allows you to store that
+file on the filesystem of the server. Here is a simple example showing how
+that works:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">request</span>
+
+<span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/upload&#39;</span><span class="p">,</span> <span class="n">methods</span><span class="o">=</span><span class="p">[</span><span class="s">&#39;GET&#39;</span><span class="p">,</span> <span class="s">&#39;POST&#39;</span><span class="p">])</span>
+<span class="k">def</span> <span class="nf">upload_file</span><span class="p">():</span>
+ <span class="k">if</span> <span class="n">request</span><span class="o">.</span><span class="n">method</span> <span class="o">==</span> <span class="s">&#39;POST&#39;</span><span class="p">:</span>
+ <span class="n">f</span> <span class="o">=</span> <span class="n">request</span><span class="o">.</span><span class="n">files</span><span class="p">[</span><span class="s">&#39;the_file&#39;</span><span class="p">]</span>
+ <span class="n">f</span><span class="o">.</span><span class="n">save</span><span class="p">(</span><span class="s">&#39;/var/www/uploads/uploaded_file.txt&#39;</span><span class="p">)</span>
+ <span class="o">...</span>
+</pre></div>
+</div>
+<p>If you want to know how the file was named on the client before it was
+uploaded to your application, you can access the
+<a class="reference external" href="http://werkzeug.pocoo.org/docs/datastructures/#werkzeug.datastructures.FileStorage.filename" title="(in Werkzeug v0.7)"><tt class="xref py py-attr docutils literal"><span class="pre">filename</span></tt></a> attribute. However please keep in
+mind that this value can be forged so never ever trust that value. If you
+want to use the filename of the client to store the file on the server,
+pass it through the <a class="reference external" href="http://werkzeug.pocoo.org/docs/utils/#werkzeug.utils.secure_filename" title="(in Werkzeug v0.7)"><tt class="xref py py-func docutils literal"><span class="pre">secure_filename()</span></tt></a> function that
+Werkzeug provides for you:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">request</span>
+<span class="kn">from</span> <span class="nn">werkzeug</span> <span class="kn">import</span> <span class="n">secure_filename</span>
+
+<span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/upload&#39;</span><span class="p">,</span> <span class="n">methods</span><span class="o">=</span><span class="p">[</span><span class="s">&#39;GET&#39;</span><span class="p">,</span> <span class="s">&#39;POST&#39;</span><span class="p">])</span>
+<span class="k">def</span> <span class="nf">upload_file</span><span class="p">():</span>
+ <span class="k">if</span> <span class="n">request</span><span class="o">.</span><span class="n">method</span> <span class="o">==</span> <span class="s">&#39;POST&#39;</span><span class="p">:</span>
+ <span class="n">f</span> <span class="o">=</span> <span class="n">request</span><span class="o">.</span><span class="n">files</span><span class="p">[</span><span class="s">&#39;the_file&#39;</span><span class="p">]</span>
+ <span class="n">f</span><span class="o">.</span><span class="n">save</span><span class="p">(</span><span class="s">&#39;/var/www/uploads/&#39;</span> <span class="o">+</span> <span class="n">secure_filename</span><span class="p">(</span><span class="n">f</span><span class="o">.</span><span class="n">filename</span><span class="p">))</span>
+ <span class="o">...</span>
+</pre></div>
+</div>
+<p>For some better examples, checkout the <a class="reference internal" href="patterns/fileuploads.html#uploading-files"><em>Uploading Files</em></a> pattern.</p>
+</div>
+<div class="section" id="cookies">
+<h3>Cookies<a class="headerlink" href="#cookies" title="Permalink to this headline">¶</a></h3>
+<p>To access cookies you can use the <a class="reference internal" href="api.html#flask.Request.cookies" title="flask.Request.cookies"><tt class="xref py py-attr docutils literal"><span class="pre">cookies</span></tt></a>
+attribute. To set cookies you can use the
+<a class="reference internal" href="api.html#flask.Response.set_cookie" title="flask.Response.set_cookie"><tt class="xref py py-attr docutils literal"><span class="pre">set_cookie</span></tt></a> method of response objects. The
+<a class="reference internal" href="api.html#flask.Request.cookies" title="flask.Request.cookies"><tt class="xref py py-attr docutils literal"><span class="pre">cookies</span></tt></a> attribute of request objects is a
+dictionary with all the cookies the client transmits. If you want to use
+sessions, do not use the cookies directly but instead use the
+<a class="reference internal" href="#sessions"><em>Sessions</em></a> in Flask that add some security on top of cookies for you.</p>
+<p>Reading cookies:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">request</span>
+
+<span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/&#39;</span><span class="p">)</span>
+<span class="k">def</span> <span class="nf">index</span><span class="p">():</span>
+ <span class="n">username</span> <span class="o">=</span> <span class="n">request</span><span class="o">.</span><span class="n">cookies</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;username&#39;</span><span class="p">)</span>
+ <span class="c"># use cookies.get(key) instead of cookies[key] to not get a</span>
+ <span class="c"># KeyError if the cookie is missing.</span>
+</pre></div>
+</div>
+<p>Storing cookies:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">make_response</span>
+
+<span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/&#39;</span><span class="p">)</span>
+<span class="k">def</span> <span class="nf">index</span><span class="p">():</span>
+ <span class="n">resp</span> <span class="o">=</span> <span class="n">make_response</span><span class="p">(</span><span class="n">render_template</span><span class="p">(</span><span class="o">...</span><span class="p">))</span>
+ <span class="n">resp</span><span class="o">.</span><span class="n">set_cookie</span><span class="p">(</span><span class="s">&#39;username&#39;</span><span class="p">,</span> <span class="s">&#39;the username&#39;</span><span class="p">)</span>
+ <span class="k">return</span> <span class="n">resp</span>
+</pre></div>
+</div>
+<p>Note that cookies are set on response objects. Since you normally you
+just return strings from the view functions Flask will convert them into
+response objects for you. If you explicitly want to do that you can use
+the <a class="reference internal" href="api.html#flask.make_response" title="flask.make_response"><tt class="xref py py-meth docutils literal"><span class="pre">make_response()</span></tt></a> function and then modify it.</p>
+<p>Sometimes you might want to set a cookie at a point where the response
+object does not exist yet. This is possible by utilizing the
+<a class="reference internal" href="patterns/deferredcallbacks.html#deferred-callbacks"><em>Deferred Request Callbacks</em></a> pattern.</p>
+<p>For this also see <a class="reference internal" href="#about-responses"><em>About Responses</em></a>.</p>
+</div>
+</div>
+<div class="section" id="redirects-and-errors">
+<h2>Redirects and Errors<a class="headerlink" href="#redirects-and-errors" title="Permalink to this headline">¶</a></h2>
+<p>To redirect a user to somewhere else you can use the
+<a class="reference internal" href="api.html#flask.redirect" title="flask.redirect"><tt class="xref py py-func docutils literal"><span class="pre">redirect()</span></tt></a> function. To abort a request early with an error
+code use the <a class="reference internal" href="api.html#flask.abort" title="flask.abort"><tt class="xref py py-func docutils literal"><span class="pre">abort()</span></tt></a> function. Here an example how this works:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">abort</span><span class="p">,</span> <span class="n">redirect</span><span class="p">,</span> <span class="n">url_for</span>
+
+<span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/&#39;</span><span class="p">)</span>
+<span class="k">def</span> <span class="nf">index</span><span class="p">():</span>
+ <span class="k">return</span> <span class="n">redirect</span><span class="p">(</span><span class="n">url_for</span><span class="p">(</span><span class="s">&#39;login&#39;</span><span class="p">))</span>
+
+<span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/login&#39;</span><span class="p">)</span>
+<span class="k">def</span> <span class="nf">login</span><span class="p">():</span>
+ <span class="n">abort</span><span class="p">(</span><span class="mi">401</span><span class="p">)</span>
+ <span class="n">this_is_never_executed</span><span class="p">()</span>
+</pre></div>
+</div>
+<p>This is a rather pointless example because a user will be redirected from
+the index to a page they cannot access (401 means access denied) but it
+shows how that works.</p>
+<p>By default a black and white error page is shown for each error code. If
+you want to customize the error page, you can use the
+<a class="reference internal" href="api.html#flask.Flask.errorhandler" title="flask.Flask.errorhandler"><tt class="xref py py-meth docutils literal"><span class="pre">errorhandler()</span></tt></a> decorator:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">render_template</span>
+
+<span class="nd">@app.errorhandler</span><span class="p">(</span><span class="mi">404</span><span class="p">)</span>
+<span class="k">def</span> <span class="nf">page_not_found</span><span class="p">(</span><span class="n">error</span><span class="p">):</span>
+ <span class="k">return</span> <span class="n">render_template</span><span class="p">(</span><span class="s">&#39;page_not_found.html&#39;</span><span class="p">),</span> <span class="mi">404</span>
+</pre></div>
+</div>
+<p>Note the <tt class="docutils literal"><span class="pre">404</span></tt> after the <a class="reference internal" href="api.html#flask.render_template" title="flask.render_template"><tt class="xref py py-func docutils literal"><span class="pre">render_template()</span></tt></a> call. This
+tells Flask that the status code of that page should be 404 which means
+not found. By default 200 is assumed which translates to: all went well.</p>
+</div>
+<div class="section" id="about-responses">
+<span id="id6"></span><h2>About Responses<a class="headerlink" href="#about-responses" title="Permalink to this headline">¶</a></h2>
+<p>The return value from a view function is automatically converted into a
+response object for you. If the return value is a string it&#8217;s converted
+into a response object with the string as response body, an <tt class="docutils literal"><span class="pre">200</span> <span class="pre">OK</span></tt>
+error code and a <tt class="docutils literal"><span class="pre">text/html</span></tt> mimetype. The logic that Flask applies to
+converting return values into response objects is as follows:</p>
+<ol class="arabic simple">
+<li>If a response object of the correct type is returned it&#8217;s directly
+returned from the view.</li>
+<li>If it&#8217;s a string, a response object is created with that data and the
+default parameters.</li>
+<li>If a tuple is returned the response object is created by passing the
+tuple as arguments to the response object&#8217;s constructor.</li>
+<li>If neither of that works, Flask will assume the return value is a
+valid WSGI application and converts that into a response object.</li>
+</ol>
+<p>If you want to get hold of the resulting response object inside the view
+you can use the <a class="reference internal" href="api.html#flask.make_response" title="flask.make_response"><tt class="xref py py-func docutils literal"><span class="pre">make_response()</span></tt></a> function.</p>
+<p>Imagine you have a view like this:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="nd">@app.errorhandler</span><span class="p">(</span><span class="mi">404</span><span class="p">)</span>
+<span class="k">def</span> <span class="nf">not_found</span><span class="p">(</span><span class="n">error</span><span class="p">):</span>
+ <span class="k">return</span> <span class="n">render_template</span><span class="p">(</span><span class="s">&#39;error.html&#39;</span><span class="p">),</span> <span class="mi">404</span>
+</pre></div>
+</div>
+<p>You just need to wrap the return expression with
+<a class="reference internal" href="api.html#flask.make_response" title="flask.make_response"><tt class="xref py py-func docutils literal"><span class="pre">make_response()</span></tt></a> and get the result object to modify it, then
+return it:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="nd">@app.errorhandler</span><span class="p">(</span><span class="mi">404</span><span class="p">)</span>
+<span class="k">def</span> <span class="nf">not_found</span><span class="p">(</span><span class="n">error</span><span class="p">):</span>
+ <span class="n">resp</span> <span class="o">=</span> <span class="n">make_response</span><span class="p">(</span><span class="n">render_template</span><span class="p">(</span><span class="s">&#39;error.html&#39;</span><span class="p">),</span> <span class="mi">404</span><span class="p">)</span>
+ <span class="n">resp</span><span class="o">.</span><span class="n">headers</span><span class="p">[</span><span class="s">&#39;X-Something&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&#39;A value&#39;</span>
+ <span class="k">return</span> <span class="n">resp</span>
+</pre></div>
+</div>
+</div>
+<div class="section" id="sessions">
+<span id="id7"></span><h2>Sessions<a class="headerlink" href="#sessions" title="Permalink to this headline">¶</a></h2>
+<p>Besides the request object there is also a second object called
+<a class="reference internal" href="api.html#flask.session" title="flask.session"><tt class="xref py py-class docutils literal"><span class="pre">session</span></tt></a> that allows you to store information specific to a
+user from one request to the next. This is implemented on top of cookies
+for you and signs the cookies cryptographically. What this means is that
+the user could look at the contents of your cookie but not modify it,
+unless they know the secret key used for signing.</p>
+<p>In order to use sessions you have to set a secret key. Here is how
+sessions work:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">Flask</span><span class="p">,</span> <span class="n">session</span><span class="p">,</span> <span class="n">redirect</span><span class="p">,</span> <span class="n">url_for</span><span class="p">,</span> <span class="n">escape</span><span class="p">,</span> <span class="n">request</span>
+
+<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="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/&#39;</span><span class="p">)</span>
+<span class="k">def</span> <span class="nf">index</span><span class="p">():</span>
+ <span class="k">if</span> <span class="s">&#39;username&#39;</span> <span class="ow">in</span> <span class="n">session</span><span class="p">:</span>
+ <span class="k">return</span> <span class="s">&#39;Logged in as </span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> <span class="n">escape</span><span class="p">(</span><span class="n">session</span><span class="p">[</span><span class="s">&#39;username&#39;</span><span class="p">])</span>
+ <span class="k">return</span> <span class="s">&#39;You are not logged in&#39;</span>
+
+<span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/login&#39;</span><span class="p">,</span> <span class="n">methods</span><span class="o">=</span><span class="p">[</span><span class="s">&#39;GET&#39;</span><span class="p">,</span> <span class="s">&#39;POST&#39;</span><span class="p">])</span>
+<span class="k">def</span> <span class="nf">login</span><span class="p">():</span>
+ <span class="k">if</span> <span class="n">request</span><span class="o">.</span><span class="n">method</span> <span class="o">==</span> <span class="s">&#39;POST&#39;</span><span class="p">:</span>
+ <span class="n">session</span><span class="p">[</span><span class="s">&#39;username&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">request</span><span class="o">.</span><span class="n">form</span><span class="p">[</span><span class="s">&#39;username&#39;</span><span class="p">]</span>
+ <span class="k">return</span> <span class="n">redirect</span><span class="p">(</span><span class="n">url_for</span><span class="p">(</span><span class="s">&#39;index&#39;</span><span class="p">))</span>
+ <span class="k">return</span> <span class="s">&#39;&#39;&#39;</span>
+<span class="s"> &lt;form action=&quot;&quot; method=&quot;post&quot;&gt;</span>
+<span class="s"> &lt;p&gt;&lt;input type=text name=username&gt;</span>
+<span class="s"> &lt;p&gt;&lt;input type=submit value=Login&gt;</span>
+<span class="s"> &lt;/form&gt;</span>
+<span class="s"> &#39;&#39;&#39;</span>
+
+<span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/logout&#39;</span><span class="p">)</span>
+<span class="k">def</span> <span class="nf">logout</span><span class="p">():</span>
+ <span class="c"># remove the username from the session if its there</span>
+ <span class="n">session</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s">&#39;username&#39;</span><span class="p">,</span> <span class="bp">None</span><span class="p">)</span>
+ <span class="k">return</span> <span class="n">redirect</span><span class="p">(</span><span class="n">url_for</span><span class="p">(</span><span class="s">&#39;index&#39;</span><span class="p">))</span>
+
+<span class="c"># set the secret key. keep this really secret:</span>
+<span class="n">app</span><span class="o">.</span><span class="n">secret_key</span> <span class="o">=</span> <span class="s">&#39;A0Zr98j/3yX R~XHH!jmN]LWX/,?RT&#39;</span>
+</pre></div>
+</div>
+<p>The here mentioned <a class="reference internal" href="api.html#flask.escape" title="flask.escape"><tt class="xref py py-func docutils literal"><span class="pre">escape()</span></tt></a> does escaping for you if you are
+not using the template engine (like in this example).</p>
+<div class="admonition-how-to-generate-good-secret-keys admonition ">
+<p class="first admonition-title">How to generate good secret keys</p>
+<p>The problem with random is that it&#8217;s hard to judge what random is. And
+a secret key should be as random as possible. Your operating system
+has ways to generate pretty random stuff based on a cryptographic
+random generator which can be used to get such a key:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">os</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">os</span><span class="o">.</span><span class="n">urandom</span><span class="p">(</span><span class="mi">24</span><span class="p">)</span>
+<span class="go">&#39;\xfd{H\xe5&lt;\x95\xf9\xe3\x96.5\xd1\x01O&lt;!\xd5\xa2\xa0\x9fR&quot;\xa1\xa8&#39;</span>
+</pre></div>
+</div>
+<p class="last">Just take that thing and copy/paste it into your code and you&#8217;re done.</p>
+</div>
+</div>
+<div class="section" id="message-flashing">
+<h2>Message Flashing<a class="headerlink" href="#message-flashing" title="Permalink to this headline">¶</a></h2>
+<p>Good applications and user interfaces are all about feedback. If the user
+does not get enough feedback they will probably end up hating the
+application. Flask provides a really simple way to give feedback to a
+user with the flashing system. The flashing system basically makes it
+possible to record a message at the end of a request and access it next
+request and only next request. This is usually combined with a layout
+template that does this.</p>
+<p>To flash a message use the <a class="reference internal" href="api.html#flask.flash" title="flask.flash"><tt class="xref py py-func docutils literal"><span class="pre">flash()</span></tt></a> method, to get hold of the
+messages you can use <a class="reference internal" href="api.html#flask.get_flashed_messages" title="flask.get_flashed_messages"><tt class="xref py py-func docutils literal"><span class="pre">get_flashed_messages()</span></tt></a> which is also
+available in the templates. Check out the <a class="reference internal" href="patterns/flashing.html#message-flashing-pattern"><em>Message Flashing</em></a>
+for a full example.</p>
+</div>
+<div class="section" id="logging">
+<h2>Logging<a class="headerlink" href="#logging" title="Permalink to this headline">¶</a></h2>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.3.</span></p>
+<p>Sometimes you might be in a situation where you deal with data that
+should be correct, but actually is not. For example you may have some client
+side code that sends an HTTP request to the server but it&#8217;s obviously
+malformed. This might be caused by a user tempering with the data, or the
+client code failing. Most of the time, it&#8217;s okay to reply with <tt class="docutils literal"><span class="pre">400</span> <span class="pre">Bad</span>
+<span class="pre">Request</span></tt> in that situation, but sometimes that won&#8217;t do and the code has
+to continue working.</p>
+<p>You may still want to log that something fishy happened. This is where
+loggers come in handy. As of Flask 0.3 a logger is preconfigured for you
+to use.</p>
+<p>Here are some example log calls:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="n">app</span><span class="o">.</span><span class="n">logger</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s">&#39;A value for debugging&#39;</span><span class="p">)</span>
+<span class="n">app</span><span class="o">.</span><span class="n">logger</span><span class="o">.</span><span class="n">warning</span><span class="p">(</span><span class="s">&#39;A warning occurred (</span><span class="si">%d</span><span class="s"> apples)&#39;</span><span class="p">,</span> <span class="mi">42</span><span class="p">)</span>
+<span class="n">app</span><span class="o">.</span><span class="n">logger</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s">&#39;An error occurred&#39;</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>The attached <a class="reference internal" href="api.html#flask.Flask.logger" title="flask.Flask.logger"><tt class="xref py py-attr docutils literal"><span class="pre">logger</span></tt></a> is a standard logging
+<a class="reference external" href="http://docs.python.org/dev/library/logging.html#logging.Logger" title="(in Python v3.3)"><tt class="xref py py-class docutils literal"><span class="pre">Logger</span></tt></a>, so head over to the official <a class="reference external" href="http://docs.python.org/library/logging.html">logging
+documentation</a> for more
+information.</p>
+</div>
+<div class="section" id="hooking-in-wsgi-middlewares">
+<h2>Hooking in WSGI Middlewares<a class="headerlink" href="#hooking-in-wsgi-middlewares" title="Permalink to this headline">¶</a></h2>
+<p>If you want to add a WSGI middleware to your application you can wrap the
+internal WSGI application. For example if you want to use one of the
+middlewares from the Werkzeug package to work around bugs in lighttpd, you
+can do it like this:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">werkzeug.contrib.fixers</span> <span class="kn">import</span> <span class="n">LighttpdCGIRootFix</span>
+<span class="n">app</span><span class="o">.</span><span class="n">wsgi_app</span> <span class="o">=</span> <span class="n">LighttpdCGIRootFix</span><span class="p">(</span><span class="n">app</span><span class="o">.</span><span class="n">wsgi_app</span><span class="p">)</span>
+</pre></div>
+</div>
+</div>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="index.html">
+ <img class="logo" src="_static/flask.png" alt="Logo"/>
+</a></p>
+ <h3><a href="index.html">Table Of Contents</a></h3>
+ <ul>
+<li><a class="reference internal" href="#">Quickstart</a><ul>
+<li><a class="reference internal" href="#a-minimal-application">A Minimal Application</a></li>
+<li><a class="reference internal" href="#debug-mode">Debug Mode</a></li>
+<li><a class="reference internal" href="#routing">Routing</a><ul>
+<li><a class="reference internal" href="#variable-rules">Variable Rules</a></li>
+<li><a class="reference internal" href="#url-building">URL Building</a></li>
+<li><a class="reference internal" href="#http-methods">HTTP Methods</a></li>
+</ul>
+</li>
+<li><a class="reference internal" href="#static-files">Static Files</a></li>
+<li><a class="reference internal" href="#rendering-templates">Rendering Templates</a></li>
+<li><a class="reference internal" href="#accessing-request-data">Accessing Request Data</a><ul>
+<li><a class="reference internal" href="#context-locals">Context Locals</a></li>
+<li><a class="reference internal" href="#the-request-object">The Request Object</a></li>
+<li><a class="reference internal" href="#file-uploads">File Uploads</a></li>
+<li><a class="reference internal" href="#cookies">Cookies</a></li>
+</ul>
+</li>
+<li><a class="reference internal" href="#redirects-and-errors">Redirects and Errors</a></li>
+<li><a class="reference internal" href="#about-responses">About Responses</a></li>
+<li><a class="reference internal" href="#sessions">Sessions</a></li>
+<li><a class="reference internal" href="#message-flashing">Message Flashing</a></li>
+<li><a class="reference internal" href="#logging">Logging</a></li>
+<li><a class="reference internal" href="#hooking-in-wsgi-middlewares">Hooking in WSGI Middlewares</a></li>
+</ul>
+</li>
+</ul>
+<h3>Related Topics</h3>
+<ul>
+ <li><a href="index.html">Documentation overview</a><ul>
+ <li>Previous: <a href="installation.html" title="previous chapter">Installation</a></li>
+ <li>Next: <a href="tutorial/index.html" title="next chapter">Tutorial</a></li>
+ </ul></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="_sources/quickstart.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/reqcontext.html b/app/static/doc/flask-docs/reqcontext.html
new file mode 100644
index 0000000..a250254
--- /dev/null
+++ b/app/static/doc/flask-docs/reqcontext.html
@@ -0,0 +1,330 @@
+
+<!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>The Request Context &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="index.html" />
+ <link rel="next" title="Modular Applications with Blueprints" href="blueprints.html" />
+ <link rel="prev" title="Pluggable Views" href="views.html" />
+
+
+ <link rel="apple-touch-icon" href="_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <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="blueprints.html" title="Modular Applications with Blueprints"
+ accesskey="N">next</a> |</li>
+ <li class="right" >
+ <a href="views.html" title="Pluggable Views"
+ accesskey="P">previous</a> |</li>
+ <li><a href="index.html">Flask 0.8 documentation</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="the-request-context">
+<span id="request-context"></span><h1>The Request Context<a class="headerlink" href="#the-request-context" title="Permalink to this headline">¶</a></h1>
+<p>This document describes the behavior in Flask 0.7 which is mostly in line
+with the old behavior but has some small, subtle differences.</p>
+<p>One of the design ideas behind Flask is that there are two different
+“states” in which code is executed. The application setup state in which
+the application implicitly is on the module level. It starts when the
+<tt class="xref py py-class docutils literal"><span class="pre">Flask</span></tt> object is instantiated, and it implicitly ends when the
+first request comes in. While the application is in this state a few
+assumptions are true:</p>
+<ul class="simple">
+<li>the programmer can modify the application object safely.</li>
+<li>no request handling happened so far</li>
+<li>you have to have a reference to the application object in order to
+modify it, there is no magic proxy that can give you a reference to
+the application object you&#8217;re currently creating or modifying.</li>
+</ul>
+<p>On the contrast, during request handling, a couple of other rules exist:</p>
+<ul class="simple">
+<li>while a request is active, the context local objects
+(<a class="reference internal" href="api.html#flask.request" title="flask.request"><tt class="xref py py-data docutils literal"><span class="pre">flask.request</span></tt></a> and others) point to the current request.</li>
+<li>any code can get hold of these objects at any time.</li>
+</ul>
+<p>The magic that makes this works is internally referred in Flask as the
+“request context”.</p>
+<div class="section" id="diving-into-context-locals">
+<h2>Diving into Context Locals<a class="headerlink" href="#diving-into-context-locals" title="Permalink to this headline">¶</a></h2>
+<p>Say you have a utility function that returns the URL the user should be
+redirected to. Imagine it would always redirect to the URL&#8217;s <tt class="docutils literal"><span class="pre">next</span></tt>
+parameter or the HTTP referrer or the index page:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">request</span><span class="p">,</span> <span class="n">url_for</span>
+
+<span class="k">def</span> <span class="nf">redirect_url</span><span class="p">():</span>
+ <span class="k">return</span> <span class="n">request</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;next&#39;</span><span class="p">)</span> <span class="ow">or</span> \
+ <span class="n">request</span><span class="o">.</span><span class="n">referrer</span> <span class="ow">or</span> \
+ <span class="n">url_for</span><span class="p">(</span><span class="s">&#39;index&#39;</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>As you can see, it accesses the request object. If you try to run this
+from a plain Python shell, this is the exception you will see:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">redirect_url</span><span class="p">()</span>
+<span class="gt">Traceback (most recent call last):</span>
+ File <span class="nb">&quot;&lt;stdin&gt;&quot;</span>, line <span class="m">1</span>, in <span class="n">&lt;module&gt;</span>
+<span class="gr">AttributeError</span>: <span class="n">&#39;NoneType&#39; object has no attribute &#39;request&#39;</span>
+</pre></div>
+</div>
+<p>That makes a lot of sense because we currently do not have a request we
+could access. So we have to make a request and bind it to the current
+context. The <a class="reference internal" href="api.html#flask.Flask.test_request_context" title="flask.Flask.test_request_context"><tt class="xref py py-attr docutils literal"><span class="pre">test_request_context</span></tt></a> method can create
+us a <a class="reference internal" href="api.html#flask.ctx.RequestContext" title="flask.ctx.RequestContext"><tt class="xref py py-class docutils literal"><span class="pre">RequestContext</span></tt></a>:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">ctx</span> <span class="o">=</span> <span class="n">app</span><span class="o">.</span><span class="n">test_request_context</span><span class="p">(</span><span class="s">&#39;/?next=http://example.com/&#39;</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>This context can be used in two ways. Either with the <cite>with</cite> statement
+or by calling the <a class="reference internal" href="api.html#flask.ctx.RequestContext.push" title="flask.ctx.RequestContext.push"><tt class="xref py py-meth docutils literal"><span class="pre">push()</span></tt></a> and
+<a class="reference internal" href="api.html#flask.ctx.RequestContext.pop" title="flask.ctx.RequestContext.pop"><tt class="xref py py-meth docutils literal"><span class="pre">pop()</span></tt></a> methods:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">ctx</span><span class="o">.</span><span class="n">push</span><span class="p">()</span>
+</pre></div>
+</div>
+<p>From that point onwards you can work with the request object:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">redirect_url</span><span class="p">()</span>
+<span class="go">u&#39;http://example.com/&#39;</span>
+</pre></div>
+</div>
+<p>Until you call <cite>pop</cite>:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">ctx</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span>
+</pre></div>
+</div>
+<p>Because the request context is internally maintained as a stack you can
+push and pop multiple times. This is very handy to implement things like
+internal redirects.</p>
+<p>For more information of how to utilize the request context from the
+interactive Python shell, head over to the <a class="reference internal" href="shell.html#shell"><em>Working with the Shell</em></a> chapter.</p>
+</div>
+<div class="section" id="how-the-context-works">
+<h2>How the Context Works<a class="headerlink" href="#how-the-context-works" title="Permalink to this headline">¶</a></h2>
+<p>If you look into how the Flask WSGI application internally works, you will
+find a piece of code that looks very much like this:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">def</span> <span class="nf">wsgi_app</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">environ</span><span class="p">):</span>
+ <span class="k">with</span> <span class="bp">self</span><span class="o">.</span><span class="n">request_context</span><span class="p">(</span><span class="n">environ</span><span class="p">):</span>
+ <span class="k">try</span><span class="p">:</span>
+ <span class="n">response</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">full_dispatch_request</span><span class="p">()</span>
+ <span class="k">except</span> <span class="ne">Exception</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span>
+ <span class="n">response</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">make_response</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">handle_exception</span><span class="p">(</span><span class="n">e</span><span class="p">))</span>
+ <span class="k">return</span> <span class="n">response</span><span class="p">(</span><span class="n">environ</span><span class="p">,</span> <span class="n">start_response</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>The method <tt class="xref py py-meth docutils literal"><span class="pre">request_context()</span></tt> returns a new
+<a class="reference internal" href="api.html#flask.ctx.RequestContext" title="flask.ctx.RequestContext"><tt class="xref py py-class docutils literal"><span class="pre">RequestContext</span></tt></a> object and uses it in combination with
+the <cite>with</cite> statement to bind the context. Everything that is called from
+the same thread from this point onwards until the end of the <cite>with</cite>
+statement will have access to the request globals (<a class="reference internal" href="api.html#flask.request" title="flask.request"><tt class="xref py py-data docutils literal"><span class="pre">flask.request</span></tt></a>
+and others).</p>
+<p>The request context internally works like a stack: The topmost level on
+the stack is the current active request.
+<a class="reference internal" href="api.html#flask.ctx.RequestContext.push" title="flask.ctx.RequestContext.push"><tt class="xref py py-meth docutils literal"><span class="pre">push()</span></tt></a> adds the context to the stack on
+the very top, <a class="reference internal" href="api.html#flask.ctx.RequestContext.pop" title="flask.ctx.RequestContext.pop"><tt class="xref py py-meth docutils literal"><span class="pre">pop()</span></tt></a> removes it from the
+stack again. On popping the application&#8217;s
+<a class="reference internal" href="api.html#flask.Flask.teardown_request" title="flask.Flask.teardown_request"><tt class="xref py py-func docutils literal"><span class="pre">teardown_request()</span></tt></a> functions are also executed.</p>
+</div>
+<div class="section" id="callbacks-and-errors">
+<span id="id1"></span><h2>Callbacks and Errors<a class="headerlink" href="#callbacks-and-errors" title="Permalink to this headline">¶</a></h2>
+<p>What happens if an error occurs in Flask during request processing? This
+particular behavior changed in 0.7 because we wanted to make it easier to
+understand what is actually happening. The new behavior is quite simple:</p>
+<ol class="arabic simple">
+<li>Before each request, <a class="reference internal" href="api.html#flask.Flask.before_request" title="flask.Flask.before_request"><tt class="xref py py-meth docutils literal"><span class="pre">before_request()</span></tt></a> functions are
+executed. If one of these functions return a response, the other
+functions are no longer called. In any case however the return value
+is treated as a replacement for the view&#8217;s return value.</li>
+<li>If the <a class="reference internal" href="api.html#flask.Flask.before_request" title="flask.Flask.before_request"><tt class="xref py py-meth docutils literal"><span class="pre">before_request()</span></tt></a> functions did not return a
+response, the regular request handling kicks in and the view function
+that was matched has the chance to return a response.</li>
+<li>The return value of the view is then converted into an actual response
+object and handed over to the <a class="reference internal" href="api.html#flask.Flask.after_request" title="flask.Flask.after_request"><tt class="xref py py-meth docutils literal"><span class="pre">after_request()</span></tt></a>
+functions which have the chance to replace it or modify it in place.</li>
+<li>At the end of the request the <a class="reference internal" href="api.html#flask.Flask.teardown_request" title="flask.Flask.teardown_request"><tt class="xref py py-meth docutils literal"><span class="pre">teardown_request()</span></tt></a>
+functions are executed. This always happens, even in case of an
+unhandled exception down the road or if a before-request handler was
+not executed yet or at all (for example in test environments sometimes
+you might want to not execute before-request callbacks).</li>
+</ol>
+<p>Now what happens on errors? In production mode if an exception is not
+caught, the 500 internal server handler is called. In development mode
+however the exception is not further processed and bubbles up to the WSGI
+server. That way things like the interactive debugger can provide helpful
+debug information.</p>
+<p>An important change in 0.7 is that the internal server error is now no
+longer post processed by the after request callbacks and after request
+callbacks are no longer guaranteed to be executed. This way the internal
+dispatching code looks cleaner and is easier to customize and understand.</p>
+<p>The new teardown functions are supposed to be used as a replacement for
+things that absolutely need to happen at the end of request.</p>
+</div>
+<div class="section" id="teardown-callbacks">
+<h2>Teardown Callbacks<a class="headerlink" href="#teardown-callbacks" title="Permalink to this headline">¶</a></h2>
+<p>The teardown callbacks are special callbacks in that they are executed at
+at different point. Strictly speaking they are independent of the actual
+request handling as they are bound to the lifecycle of the
+<a class="reference internal" href="api.html#flask.ctx.RequestContext" title="flask.ctx.RequestContext"><tt class="xref py py-class docutils literal"><span class="pre">RequestContext</span></tt></a> object. When the request context is
+popped, the <a class="reference internal" href="api.html#flask.Flask.teardown_request" title="flask.Flask.teardown_request"><tt class="xref py py-meth docutils literal"><span class="pre">teardown_request()</span></tt></a> functions are called.</p>
+<p>This is important to know if the life of the request context is prolonged
+by using the test client in a with statement or when using the request
+context from the command line:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">with</span> <span class="n">app</span><span class="o">.</span><span class="n">test_client</span><span class="p">()</span> <span class="k">as</span> <span class="n">client</span><span class="p">:</span>
+ <span class="n">resp</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;/foo&#39;</span><span class="p">)</span>
+ <span class="c"># the teardown functions are still not called at that point</span>
+ <span class="c"># even though the response ended and you have the response</span>
+ <span class="c"># object in your hand</span>
+
+<span class="c"># only when the code reaches this point the teardown functions</span>
+<span class="c"># are called. Alternatively the same thing happens if another</span>
+<span class="c"># request was triggered from the test client</span>
+</pre></div>
+</div>
+<p>It&#8217;s easy to see the behavior from the command line:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><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="gp">&gt;&gt;&gt; </span><span class="nd">@app.teardown_request</span>
+<span class="gp">... </span><span class="k">def</span> <span class="nf">teardown_request</span><span class="p">(</span><span class="n">exception</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+<span class="gp">... </span> <span class="k">print</span> <span class="s">&#39;this runs after request&#39;</span>
+<span class="gp">...</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">ctx</span> <span class="o">=</span> <span class="n">app</span><span class="o">.</span><span class="n">test_request_context</span><span class="p">()</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">ctx</span><span class="o">.</span><span class="n">push</span><span class="p">()</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">ctx</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span>
+<span class="go">this runs after request</span>
+<span class="go">&gt;&gt;&gt;</span>
+</pre></div>
+</div>
+<p>Keep in mind that teardown callbacks are always executed, even if
+before-request callbacks were not executed yet but an exception happened.
+Certain parts of the test system might also temporarily create a request
+context without calling the before-request handlers. Make sure to write
+your teardown-request handlers in a way that they will never fail.</p>
+</div>
+<div class="section" id="notes-on-proxies">
+<span id="id2"></span><h2>Notes On Proxies<a class="headerlink" href="#notes-on-proxies" title="Permalink to this headline">¶</a></h2>
+<p>Some of the objects provided by Flask are proxies to other objects. The
+reason behind this is that these proxies are shared between threads and
+they have to dispatch to the actual object bound to a thread behind the
+scenes as necessary.</p>
+<p>Most of the time you don&#8217;t have to care about that, but there are some
+exceptions where it is good to know that this object is an actual proxy:</p>
+<ul class="simple">
+<li>The proxy objects do not fake their inherited types, so if you want to
+perform actual instance checks, you have to do that on the instance
+that is being proxied (see <cite>_get_current_object</cite> below).</li>
+<li>if the object reference is important (so for example for sending
+<a class="reference internal" href="signals.html#signals"><em>Signals</em></a>)</li>
+</ul>
+<p>If you need to get access to the underlying object that is proxied, you
+can use the <a class="reference external" href="http://werkzeug.pocoo.org/docs/local/#werkzeug.local.LocalProxy._get_current_object" title="(in Werkzeug v0.7)"><tt class="xref py py-meth docutils literal"><span class="pre">_get_current_object()</span></tt></a> method:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="n">app</span> <span class="o">=</span> <span class="n">current_app</span><span class="o">.</span><span class="n">_get_current_object</span><span class="p">()</span>
+<span class="n">my_signal</span><span class="o">.</span><span class="n">send</span><span class="p">(</span><span class="n">app</span><span class="p">)</span>
+</pre></div>
+</div>
+</div>
+<div class="section" id="context-preservation-on-error">
+<h2>Context Preservation on Error<a class="headerlink" href="#context-preservation-on-error" title="Permalink to this headline">¶</a></h2>
+<p>If an error occurs or not, at the end of the request the request context
+is popped and all data associated with it is destroyed. During
+development however that can be problematic as you might want to have the
+information around for a longer time in case an exception occurred. In
+Flask 0.6 and earlier in debug mode, if an exception occurred, the
+request context was not popped so that the interactive debugger can still
+provide you with important information.</p>
+<p>Starting with Flask 0.7 you have finer control over that behavior by
+setting the <tt class="docutils literal"><span class="pre">PRESERVE_CONTEXT_ON_EXCEPTION</span></tt> configuration variable. By
+default it&#8217;s linked to the setting of <tt class="docutils literal"><span class="pre">DEBUG</span></tt>. If the application is in
+debug mode the context is preserved, in production mode it&#8217;s not.</p>
+<p>Do not force activate <tt class="docutils literal"><span class="pre">PRESERVE_CONTEXT_ON_EXCEPTION</span></tt> in production mode
+as it will cause your application to leak memory on exceptions. However
+it can be useful during development to get the same error preserving
+behavior as in development mode when attempting to debug an error that
+only occurs under production settings.</p>
+</div>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="index.html">
+ <img class="logo" src="_static/flask.png" alt="Logo"/>
+</a></p>
+ <h3><a href="index.html">Table Of Contents</a></h3>
+ <ul>
+<li><a class="reference internal" href="#">The Request Context</a><ul>
+<li><a class="reference internal" href="#diving-into-context-locals">Diving into Context Locals</a></li>
+<li><a class="reference internal" href="#how-the-context-works">How the Context Works</a></li>
+<li><a class="reference internal" href="#callbacks-and-errors">Callbacks and Errors</a></li>
+<li><a class="reference internal" href="#teardown-callbacks">Teardown Callbacks</a></li>
+<li><a class="reference internal" href="#notes-on-proxies">Notes On Proxies</a></li>
+<li><a class="reference internal" href="#context-preservation-on-error">Context Preservation on Error</a></li>
+</ul>
+</li>
+</ul>
+<h3>Related Topics</h3>
+<ul>
+ <li><a href="index.html">Documentation overview</a><ul>
+ <li>Previous: <a href="views.html" title="previous chapter">Pluggable Views</a></li>
+ <li>Next: <a href="blueprints.html" title="next chapter">Modular Applications with Blueprints</a></li>
+ </ul></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="_sources/reqcontext.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/search.html b/app/static/doc/flask-docs/search.html
new file mode 100644
index 0000000..4294a7c
--- /dev/null
+++ b/app/static/doc/flask-docs/search.html
@@ -0,0 +1,101 @@
+
+<!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>Search &mdash; Flask 0.8 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.8',
+ 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>
+ <script type="text/javascript" src="_static/searchtools.js"></script>
+ <link rel="top" title="Flask 0.8 documentation" href="index.html" />
+ <script type="text/javascript">
+ jQuery(function() { Search.loadIndex("searchindex.js"); });
+ </script>
+
+
+
+ <link rel="apple-touch-icon" href="_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+
+ </head>
+ <body>
+ <div class="related">
+ <h3>Navigation</h3>
+ <ul>
+ <li class="right" style="margin-right: 10px">
+ <a href="genindex.html" title="General Index"
+ accesskey="I">index</a></li>
+ <li><a href="index.html">Flask 0.8 documentation</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <h1 id="search-documentation">Search</h1>
+ <div id="fallback" class="admonition warning">
+ <script type="text/javascript">$('#fallback').hide();</script>
+ <p>
+ Please activate JavaScript to enable the search
+ functionality.
+ </p>
+ </div>
+ <p>
+ From here you can search these documents. Enter your search
+ words into the box below and click "search". Note that the search
+ function will automatically search for all of the words. Pages
+ containing fewer words won't appear in the result list.
+ </p>
+ <form action="" method="get">
+ <input type="text" name="q" value="" />
+ <input type="submit" value="search" />
+ <span id="search-progress" style="padding-left: 10px"></span>
+ </form>
+
+ <div id="search-results">
+
+ </div>
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="index.html">
+ <img class="logo" src="_static/flask.png" alt="Logo"/>
+</a></p><h3>Related Topics</h3>
+<ul>
+ <li><a href="index.html">Documentation overview</a><ul>
+ </ul></li>
+</ul>
+ </div>
+ </div>
+ <div class="clearer"></div>
+ </div>
+ <div class="footer">
+ &copy; Copyright 2010, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/searchindex.js b/app/static/doc/flask-docs/searchindex.js
new file mode 100644
index 0000000..66630ba
--- /dev/null
+++ b/app/static/doc/flask-docs/searchindex.js
@@ -0,0 +1 @@
+Search.setIndex({objects:{"":{flask:[3,0,1]},"flask.Response":{headers:[3,3,1],status_code:[3,3,1],data:[3,3,1],mimetype:[3,3,1],set_cookie:[3,2,1]},"flask.sessions.SessionMixin":{"new":[3,3,1],permanent:[3,3,1],modified:[3,3,1]},flask:{render_template_string:[3,1,1],Flask:[3,4,1],escape:[3,1,1],request_tearing_down:[3,5,1],send_from_directory:[3,1,1],abort:[3,1,1],get_flashed_messages:[3,1,1],Config:[3,4,1],render_template:[3,1,1],redirect:[3,1,1],flash:[3,1,1],current_app:[3,5,1],json:[3,5,1],Response:[3,4,1],request_started:[3,5,1],Blueprint:[3,4,1],signals_available:[3,5,1],get_template_attribute:[3,1,1],"_request_ctx_stack":[3,5,1],Markup:[3,4,1],Request:[3,4,1],safe_join:[3,1,1],template_rendered:[3,5,1],got_request_exception:[3,5,1],url_for:[3,1,1],g:[3,5,1],make_response:[3,1,1],jsonify:[3,1,1],request:[3,4,1],session:[3,4,1],request_finished:[3,5,1],send_file:[3,1,1],has_request_context:[3,1,1]},"flask.flask":{ext:[3,5,1]},"flask.Request":{view_args:[3,3,1],url_root:[3,3,1],stream:[3,3,1],cookies:[3,3,1],module:[3,3,1],files:[3,3,1],base_url:[3,3,1],json:[3,3,1],values:[3,3,1],method:[3,3,1],blueprint:[3,3,1],form:[3,3,1],args:[3,3,1],url_rule:[3,3,1],path:[3,3,1],data:[3,3,1],max_content_length:[3,3,1],endpoint:[3,3,1],url:[3,3,1],on_json_loading_failed:[3,2,1],headers:[3,3,1],environ:[3,3,1],script_root:[3,3,1],is_xhr:[3,3,1],routing_exception:[3,3,1]},"flask.views":{MethodView:[3,4,1],View:[3,4,1]},"flask.sessions.SecureCookieSessionInterface":{session_class:[3,3,1]},"flask.sessions":{SessionMixin:[3,4,1],SecureCookieSessionInterface:[3,4,1],SessionInterface:[3,4,1],NullSession:[3,4,1]},"flask.views.View":{dispatch_request:[3,2,1],decorators:[3,3,1],methods:[3,3,1],as_view:[3,6,1]},"flask.sessions.SessionInterface":{get_cookie_httponly:[3,2,1],save_session:[3,2,1],get_cookie_path:[3,2,1],open_session:[3,2,1],get_expiration_time:[3,2,1],get_cookie_secure:[3,2,1],get_cookie_domain:[3,2,1],null_session_class:[3,3,1],make_null_session:[3,2,1],is_null_session:[3,2,1]},"flask.blueprints.BlueprintSetupState":{blueprint:[3,3,1],url_prefix:[3,3,1],first_registration:[3,3,1],app:[3,3,1],url_defaults:[3,3,1],subdomain:[3,3,1],add_url_rule:[3,2,1],options:[3,3,1]},"flask.signals.Namespace":{signal:[3,2,1]},"flask.ctx":{RequestContext:[3,4,1]},"flask.Flask":{inject_url_defaults:[3,2,1],url_map:[3,3,1],error_handler_spec:[3,3,1],testing:[3,3,1],enable_modules:[3,3,1],jinja_loader:[3,3,1],propagate_exceptions:[3,3,1],before_request_funcs:[3,3,1],open_session:[3,2,1],preprocess_request:[3,2,1],before_request:[3,2,1],logger_name:[3,3,1],register_error_handler:[3,2,1],wsgi_app:[3,2,1],after_request_funcs:[3,3,1],test_request_context:[3,2,1],url_value_preprocessor:[3,2,1],make_config:[3,2,1],create_jinja_environment:[3,2,1],url_defaults:[3,2,1],debug:[3,3,1],handle_http_exception:[3,2,1],send_static_file:[3,2,1],permanent_session_lifetime:[3,3,1],before_first_request_funcs:[3,3,1],select_jinja_autoescape:[3,2,1],save_session:[3,2,1],request_class:[3,3,1],instance_path:[3,3,1],test_client:[3,2,1],response_class:[3,3,1],handle_user_exception:[3,2,1],teardown_request_funcs:[3,3,1],logger:[3,3,1],url_value_preprocessors:[3,3,1],config:[3,3,1],session_interface:[3,3,1],trap_http_exception:[3,2,1],use_x_sendfile:[3,3,1],jinja_options:[3,3,1],process_response:[3,2,1],run:[3,2,1],context_processor:[3,2,1],before_first_request:[3,2,1],do_teardown_request:[3,2,1],log_exception:[3,2,1],errorhandler:[3,2,1],create_global_jinja_loader:[3,2,1],debug_log_format:[3,3,1],full_dispatch_request:[3,2,1],default_config:[3,3,1],template_context_processors:[3,3,1],preserve_context_on_exception:[3,3,1],create_url_adapter:[3,2,1],template_filter:[3,2,1],make_null_session:[3,2,1],url_rule_class:[3,3,1],init_jinja_globals:[3,2,1],auto_find_instance_path:[3,2,1],name:[3,3,1],blueprints:[3,3,1],endpoint:[3,2,1],register_blueprint:[3,2,1],make_default_options_response:[3,2,1],update_template_context:[3,2,1],dispatch_request:[3,2,1],make_response:[3,2,1],route:[3,2,1],open_instance_resource:[3,2,1],handle_exception:[3,2,1],session_cookie_name:[3,3,1],after_request:[3,2,1],view_functions:[3,3,1],got_first_request:[3,3,1],extensions:[3,3,1],secret_key:[3,3,1],url_default_functions:[3,3,1],request_context:[3,2,1],has_static_folder:[3,3,1],open_resource:[3,2,1],jinja_env:[3,3,1],add_url_rule:[3,2,1],test_client_class:[3,3,1],teardown_request:[3,2,1],register_module:[3,2,1]},"flask.Markup":{striptags:[3,2,1],unescape:[3,2,1],escape:[3,6,1]},"flask.testing":{FlaskClient:[3,4,1]},"flask.session":{"new":[3,3,1],permanent:[3,3,1],modified:[3,3,1]},"flask.Blueprint":{after_app_request:[3,2,1],record_once:[3,2,1],before_request:[3,2,1],url_value_preprocessor:[3,2,1],url_defaults:[3,2,1],before_app_request:[3,2,1],send_static_file:[3,2,1],app_context_processor:[3,2,1],teardown_app_request:[3,2,1],jinja_loader:[3,3,1],errorhandler:[3,2,1],app_url_defaults:[3,2,1],context_processor:[3,2,1],app_url_value_preprocessor:[3,2,1],app_errorhandler:[3,2,1],make_setup_state:[3,2,1],endpoint:[3,2,1],before_app_first_request:[3,2,1],route:[3,2,1],register:[3,2,1],record:[3,2,1],has_static_folder:[3,3,1],open_resource:[3,2,1],add_url_rule:[3,2,1],after_request:[3,2,1],teardown_request:[3,2,1]},"flask.signals":{Namespace:[3,4,1]},"flask.Config":{from_envvar:[3,2,1],from_object:[3,2,1],from_pyfile:[3,2,1]},"flask.blueprints":{BlueprintSetupState:[3,4,1]},"flask.ctx.RequestContext":{match_request:[3,2,1],push:[3,2,1],pop:[3,2,1]},"flask.testing.FlaskClient":{session_transaction:[3,2,1]}},terms:{besid:[49,15,60,7,1],get_object:20,untrust:3,rakija:51,four:[41,63,42,32],fcgi:[52,39],prefix:[47,48,49,51,3,53,56,41,26,8,44,30,31],database_uri:31,ronach:50,upsid:[21,63],session_cookie_nam:[3,31],hate:[1,43,44],gae:51,forget:[1,55,51],subdomaindispatch:48,whatwg:5,under:[50,3,21,5,40,6,31],spec:5,merchant:50,everi:[47,17,43,31,21,56,3,7,8,28,10,12],risk:[45,1],mysessioninterfac:3,my_list:41,url_default:[56,3],upstream:17,log_respons:23,appar:5,look:[1,4,42,6,7,11,12,13,14,15,21,23,24,26,27,28,29,30,64,35,18,20,38,39,43,44,45,46,47,48,49,51,52,55,3,62],httpwriter:41,upload:[64,15,38,1,36,51,3,28,45,2],correct:[64,35,1,51,60,39,40,3,55,43,28,0,10],solid:[16,36],vector:45,get_templ:59,typecheck:3,listview:20,cache_kei:53,"29th":51,schnap:51,naiv:43,direct:[40,3,7,59,50],horn:50,xf9:1,second:[47,17,35,1,4,23,3,60,8,44,28,49,31,32],provide_automatic_opt:3,show_entri:[33,61,32],even:[1,60,5,3,61,14,17,24,23,19,57,27,31,35,36,48,47,41,49,50,51,55,6,45],dialogu:[15,38,17],msysgit:21,hide:36,eventlet:22,ruthless:5,lighti:39,rerais:3,launch:3,aacbe2:16,view_arg:3,"new":[9,1,60,5,6,8,11,13,14,15,17,21,23,27,28,31,32,33,35,36,20,43,64,38,48,49,51,3],ever:1,xhtml1:[1,5],metadata:63,direct_passthrough:3,behavior:[14,15,38,51,3,60,21,6,7,45,31],do_teardown_request:3,xfd:1,here:[9,1,4,42,57,7,8,10,12,13,14,15,24,21,23,19,26,27,28,30,31,32,33,60,35,18,38,41,43,44,64,47,48,51,52,53,55,56,3,58,59,61,45,63],met:[14,50],tornado:[52,22],debugg:[3,6,31,1,18],download_fil:3,path:[47,48,0,1,2,51,3,31,53,60,21,39,49,40,57,7,26,28,25,10,12],interpret:[64,48,35,1,4,39,55,8,49,31],errorlog:40,precis:10,datetim:[3,31],mitsuhiko:49,permit:[14,50],generali:21,contextmanag:23,golden:[15,38,8],schemaless:19,bashrc:28,unix:[35,21,39,22,40,3,8,49,62],txt:[28,1],register_api:20,close_connect:14,create_global_jinja_load:3,lwx:1,describ:[15,6,1],would:[1,3,4,57,7,11,12,13,14,17,23,26,28,29,30,34,35,18,20,43,64,47,48,50,51,53,56,6,60,61,45],uwsgi_modifier1:62,harddriv:35,call:[9,1,2,4,42,6,7,8,10,11,12,13,14,16,18,19,20,21,23,24,25,26,27,28,29,30,31,34,35,36,37,39,40,43,45,64,47,48,51,53,55,56,3,58,59,60,62,63],python26:49,recommend:[14,15,47,27,35,1,36,41,3,21,23,34,8,49,43,31,63,13],care:[14,3,6,59,8,45,63],type:[64,41,35,1,24,3,5,19,6,61,26,27,44,28,63,45,42,13],tell:[35,1,18,55,60,21,39,61,40,3,7,42,8,44,49,10,62,27],fastcgi:[15,62,38,39,52],url_adapt:3,unescap:3,relat:[9,2,36,57,8,10,63],url_rul:[30,3],notic:[64,1,50,20,55,53,60,21,5,23,3,26,27,30],warn:[35,1,36,51,21,3],static_fold:[47,3],jmn:1,pkg_resourc:[],herebi:50,unpack:51,must:[14,27,49,1,50,37,3,21,5,19,41,26,8,10,31,42,13],join:[28,31,3,0,59],restor:21,setup:[13,2,60,3,14,15,21,22,25,31,33,34,35,18,37,64,38,49,51,52,55,6,58],work:[1,2,3,60,5,6,7,8,11,13,14,15,16,17,18,21,22,23,25,26,27,28,30,31,32,34,36,20,38,39,40,43,64,47,48,49,51,52,53,54,55,57,61,45,63],backend_app:48,wors:7,socket:[39,5],root:[64,0,1,51,60,39,3,7,26,49,62,31,32],overrid:[47,17,35,18,51,21,42,3,31],defer:[15,38,1,2,3,29],vodka:3,give:[14,60,0,1,20,3,51,27,5,40,6,7,39,8,44,10,13],autodetect:[31,51],smtp:35,indic:[3,50],cautiou:13,caution:[3,5],unavail:[3,34],want:[0,1,3,4,6,7,8,9,10,12,13,14,15,17,18,20,21,22,23,19,25,27,28,29,31,32,33,34,35,36,37,39,40,43,44,64,47,48,49,50,51,53,55,56,57,58,59,60,62,63],attract:36,read_fil:8,enc:8,end:[14,15,38,1,2,51,3,60,21,5,6,7,39,43,44,29,45,57,63,13],"20doe":1,ordinari:[45,3],off:[40,7],classifi:14,proxyfix:22,mochikit:3,answer:[1,36,5,24,3,26,59],config:[14,64,47,60,13,18,40,31,51,21,39,19,3,25,28,12,32],updat:[20,53,21,3,31,59],faq:[15,38,5],mongokit:[15,38,2,19],application_root:[3,31,51],timedelta:[3,31],after:[1,4,3,11,12,14,15,21,23,28,29,30,34,35,40,43,38,41,51,55,56,6,60,45,63],befor:[1,3,60,5,6,10,11,12,13,14,15,16,21,23,26,28,29,30,31,64,34,35,36,46,38,57,58,63],wrong:[14,40,1],beauti:[56,1],demonstr:60,allowed_fil:28,handl:[9,1,3,60,5,57,7,14,15,21,22,23,24,26,27,28,29,31,35,36,64,38,48,51,56,6,63],attempt:[3,6,57,5],third:[14,7],classmethod:3,bootstrap:[28,64],credenti:[35,60,9,1,44],greet:1,think:[1,36],get_friend:45,scoped_sess:63,"18th":51,environ:[14,64,48,49,1,18,51,3,52,21,39,22,40,6,25,11,31,59],enter:[64,49,5],exclus:8,first:[0,1,2,4,42,6,7,8,10,12,14,15,20,21,23,19,25,26,27,28,30,31,34,18,37,38,39,40,41,43,45,64,47,48,49,51,53,55,3,60,62,63],order:[48,9,1,36,20,3,51,21,39,22,23,40,6,7,26,60,57,32],origin:[47,17,49,53,60,3],behav:[14,1,19,21,24,3,58,30],frontend:[3,56,48,12],feedback:[51,17,1,44],softwar:[14,50,21,36,8],consent:50,over:[1,5,3,7,8,13,15,18,21,23,19,27,31,35,36,40,51,55,6,59,61,45,63],fall:[23,30,48,3],becaus:[9,1,3,60,5,6,7,11,13,14,17,18,21,22,23,24,25,26,28,31,32,34,35,36,39,40,45,64,47,49,51,53,55,56,57,59,62,63],jpeg:28,veri:[1,4,5,6,7,8,10,12,13,14,17,24,21,23,19,26,27,28,29,31,60,35,36,20,39,42,64,47,48,3,45,63],privileg:[40,49],affect:[14,3,21],jumpload:28,dosomethingwith:[3,13],flexibl:[53,3,63,20],streamlin:21,gentl:[28,43,2],fit:[50,36],fix:[21,51],christoph:50,fetchal:[57,32],"_extern":3,persist:39,easier:[34,2,21,5,6,55,27,28,31],allow_subdomain_redirect:3,"__definesetter__":45,them:[1,2,4,5,57,10,11,13,24,21,22,23,19,27,28,29,31,32,34,35,36,39,40,43,64,48,51,55,3,45,63],thei:[9,1,2,4,5,6,7,8,11,13,14,17,21,22,23,24,26,32,40,41,44,64,47,48,51,53,55,56,3,58,45,63],safe:[14,1,3,60,21,23,40,6,61,26,27,43,13],"break":[14,17,49,1,3,60,21,39,43,41,27,45,59],jinja2:[46,15,47,17,49,1,36,51,27,3,7,8,61,45,59,13],interrupt:50,blink:[3,1],app_url_default:3,choic:36,changelog:[15,38,51],bonu:[15,16,54,38,33],create_jinja_load:[21,51],localstack:3,timeout:[3,53,4,51],each:[51,48,49,1,37,3,53,20,55,19,6,7,59,43,60,45,11,57,63],debug:[15,38,35,1,18,51,3,52,21,39,23,6,55,43,31,59],went:[1,36,26],request_start:[23,3],side:[14,48,35,1,18,3,41,7,26,27,28,49,45],mean:[1,5,3,61,8,13,15,17,24,21,22,19,26,30,34,36,20,38,47,49,50,7],enorm:59,appengin:51,logo:50,unbound:[21,51],network:[35,1,22],goe:[14,41,53,55,58,30],crucial:[14,1],content:[14,15,38,1,2,37,5,43,3,59,26,8,45,31,42],rewrit:[62,25,39,22],laid:41,lowercase_with_underscor:41,adapt:[14,36,51,20,21,3,27],got:[23,24,3,26],"9em":16,listconvert:3,make_app:48,situat:[34,35,1,36,5,3,27,44,29,31],shareddatamiddlewar:28,free:[9,13],standard:[15,38,41,0,1,51,5,23,40,3,7,55,27,49,13],post_id:[3,1],build_onli:28,special_exception_handl:3,reconfigur:31,traceback:[35,51,6,39,3,31],preprocess_request:[3,34,57,60],filter:[15,47,41,1,38,3,7,27,61,63,13],bookmark:0,ish:9,isn:7,auto_find_instance_path:3,subtl:6,confus:[5,51],user_lang:29,render:[15,47,48,49,1,50,20,53,51,21,38,42,23,3,7,26,27,44,32,59,13],db_fd:60,independ:[14,6,31,60,3],hook:[64,15,38,17,1,20,55,3,45,12],instruct:[15,38,40],alreadi:[64,1,36,53,60,23,3,7,26,8,28,61,12,63,27],primari:37,badrequest:[31,3,21],trap_bad_request_key_error:[],easili:[14,64,47,34,1,18,20,4,51,23,7,27,60,29,45,31,59],top:[14,47,41,9,1,3,5,22,43,40,6,7,26,8,45,31,32],sometim:[47,48,1,36,3,60,19,6,29,59,13],downsid:[47,17,12,57,10,31,30,63],necessarili:[10,3],too:[41,49,36,19,3,7,8],similarli:47,debug_log_format:3,logged_in:[61,32],john:1,listen:[48,35,1,51,22,23,3,32],consol:[34,51],namespac:[14,23,3,5],tool:[64,36,21,55,22,40,26,31],lighttpd:[52,62,1,39],took:36,task:[58,7,36,22],cdata:26,template_fold:[47,3],happili:28,target:[3,9],keyword:[47,41,1,23,3,27],provid:[1,3,4,5,6,7,10,11,13,14,17,21,22,23,24,30,31,60,35,36,20,44,64,47,48,49,50,51,53,55,56,57,58],tree:36,project:[14,50,47,17,49,1,36,21,22,41,30,31],matter:1,minut:[53,4],fashion:20,ran:60,modern:[31,1,36],mind:[14,34,17,1,36,20,3,40,60,55,22,23,24,6,7,53,45,41,30,31,57],inject_us:13,raw:57,increment:37,"__main__":[1,18,60,39,40,25,62],seen:[19,1],seem:[60,35,39],incompat:[21,5,51],wsgiscriptalia:40,wsgicontain:22,latter:[56,60],url_value_processor:3,instance_path:[3,31],transmit:[28,45,3,1,8],anatomi:[14,15,38],simplifi:[14,47,51,54,21,23,56,57,26],shall:[3,50],usernam:[47,41,1,18,3,60,13,57,61,27,44,28,30,45,32],object:[1,2,3,4,6,7,10,11,12,13,14,15,18,21,22,23,19,26,28,29,30,31,34,35,36,20,38,40,41,43,47,48,51,52,53,56,57,60,59,61,45,63],what:[1,4,5,6,7,8,13,14,15,17,18,21,23,24,26,28,29,30,31,34,35,36,20,38,40,43,64,47,49,52,55,3,60,45],regular:[47,41,20,3,51,21,23,6,60,8,31],mouth:1,letter:[41,31,8],bsd:[14,50],coin:1,unorthodox:36,prematur:39,tradit:[3,7],simplic:36,don:[1,60,6,7,8,11,12,14,17,18,21,26,28,30,32,34,35,36,20,39,40,45,49,51,53,55,56,3,62,63],with_categori:[3,44],dom:[26,5],doc:[3,39],flow:21,doe:[1,4,5,3,7,8,11,13,14,15,17,19,26,27,28,29,31,34,36,20,38,39,40,42,43,44,64,47,48,49,50,51,53,55,60,45,63],dummi:3,bracket:3,request_context:[3,6,1],left:[16,3],passwordfield:27,came:[3,1],introspect:[3,31,60],tequila:60,random:[23,3,60,1],syntax:[13,51,5,61,7,45],template_filt:[3,13],facto:0,query_properti:63,involv:[17,35,60,51],absolut:[14,47,41,3,21,40,6,8,31],exactli:[14,64,1,53,5,23,3,28,31,63],layout:[15,38,41,1,33,42,24,3,61,26,43,44],menu:49,run_simpl:[3,48],configur:[0,1,2,60,5,6,7,8,9,12,13,14,15,36,21,19,25,31,32,35,18,39,40,45,64,38,48,51,52,3,62,63],apach:[64,15,38,1,52,39,40,25],theme:[14,51],busi:50,init_helloworld:14,"__call__":[3,30,48,22],folder:[9,1,3,7,10,14,15,16,21,26,28,31,33,18,37,38,40,43,46,47,49,51,55,61,64],nonetyp:6,likewis:[3,31,1],watch:[64,40,62,25,39],obscur:5,report:[60,35,26,51],reconstruct:3,parachut:3,bar:[28,41,2,3],emb:[8,5],dispatch_request:[3,20],sacrific:[],excel:[23,53],method:[1,4,6,61,8,10,15,17,21,23,19,25,26,27,28,31,32,34,35,18,20,44,38,41,49,51,56,3,60,63],twice:[17,21,1],bad:[17,1,51,3,54,41,7,43,31],customproxyfix:22,told:[45,21],first_registr:3,respond:[47,32],victim:45,"0x104f965d0":[],serve_forev:22,result:[34,1,51,3,53,4,5,19,48,57,26,63],respons:[14,15,38,34,35,1,51,3,60,21,23,24,6,29,45,11,59],fail:[14,35,1,3,60,21,24,6,57,26,31],import_str:30,fluffi:45,best:[14,15,38,17,55,19,31],subject:35,awar:[40,3],said:[5,20],hopefulli:36,databas:[9,2,60,57,7,8,10,11,14,15,18,19,20,21,24,28,32,33,34,35,36,37,46,38,51,3,58,63],wikipedia:[45,0],figur:[64,48,35,1,36,39,23,56,3,7,30],outstand:7,response_class:[3,34,60],sysloghandl:35,awai:7,irc:[14,17],approach:[14,64,48,36,60,57,43,30,31,63],attribut:[41,1,20,3,31,53,60,5,23,19,6,61,27,45,12,13],inabl:[13,51],accord:40,never:[41,35,1,18,3,23,40,6,7,26,28,30,11,57,45],extend:[47,17,55,21,42,24,58,26,44,61],extens:[14,15,47,17,13,2,51,3,21,38,55,23,19,36,41,7,27,28,58,31,63],html4:[3,1,5],preprocessor:3,wtf:27,upfront:[14,64,30,34],functool:53,subfold:[3,21],"_cider":3,accident:5,expos:[47,51,20,60,3,7,59],gettempdir:28,howev:[0,1,60,5,6,7,8,9,11,12,13,14,17,18,21,23,29,30,31,34,36,20,39,64,47,50,3,45],trap_http_except:[3,31],against:[41,36,60,3,7,32],und:8,logic:[47,41,1,51,56,3,29,11],login:[33,1,2,53,60,27,61,43,44,32],browser:[34,0,1,18,5,3,26,27,45,31,59],do_something_with:3,col:61,serversid:64,con:63,compromis:36,asctim:35,url_root:3,kwd:3,ez_setup:49,loader:[3,21,51],exemplari:50,shortcut:[31,3,0],diff:21,guid:[14,15,38,39,40,5,62],assum:[14,64,48,49,1,20,55,53,21,5,3,39,8,28],summar:5,wsgi_app:[6,1,22,3,7,28],speak:[14,6,1],liabil:50,chrome:51,after_request_callback:29,three:[41,35,1,50,53,60,3,7,13],been:[11,21,5],wsgiprocessgroup:40,trigger:[64,34,6,1,51,3,60,21,57,26,45],unsubscrib:23,interest:[15,38,17,35,1,36,53,21,56,3,28,32,31,13],basic:[9,1,2,4,42,3,61,8,12,14,15,21,24,26,28,31,34,35,20,38,39,44,45,64,47,49,50,54,55,59,62,63],"__doc__":[14,55],hesit:17,quickli:[47,49,3,26,27,31,63],life:6,xbb:[3,1],declare_namespac:[],suppress:3,worker:[5,22],uncommon:[45,59],ani:[1,60,5,6,7,14,17,21,23,19,25,26,27,29,30,31,34,35,18,39,40,45,47,48,49,50,51,3,61,62],cheroke:[62,39],child:[40,61,42,2],upload_fold:[28,3],init_db:[60,19,57,10,11,63],ugli:5,blazingli:19,gnu:39,servic:[45,50,22],properti:[3,47,41,49],can:[0,1,3,4,5,6,7,8,9,10,11,12,13,14,17,18,24,21,22,23,19,25,26,27,28,29,30,31,32,33,34,35,36,20,39,40,41,42,43,44,45,64,47,48,49,50,51,52,53,55,56,57,58,59,60,61,62,63],calcul:[3,53,4,26,39],neat:[53,32],publicli:[1,18],as_view:[3,20],aid:[14,3,51],appus:64,after_request:[14,51,3,60,21,6,29,11],spawn:1,opt:[21,13,51],view_funct:3,sessionmixin:3,systemexit:40,open_sess:3,toolkit:[15,49],remember_languag:29,kwarg:[30,3,53,27],sever:[52,47,5],mako:7,file_handl:35,filestorag:3,incorrectli:51,perform:[17,13,54,3,60,19,6,25],suggest:[14,50],make:[9,1,3,4,5,6,7,8,11,12,13,14,17,24,21,23,19,25,26,27,28,29,31,34,35,36,20,39,40,43,44,45,64,47,49,50,51,55,56,57,60,59,61,62,63],format:[64,15,38,41,35,3,53,57,26,8,0,45,32],"j\u00e4germeist":51,init_app:[14,15,38],complex:[17,35,18,36,53,60,21,55,3,7,8,45],split:[48,23,3,7,30,63],add_language_cod:56,complet:[15,35,1,4,10,31],mongodb_port:19,pick:[23,40,3,35,36],create_engin:63,hand:[14,64,34,13,20,53,51,21,39,19,6,7,27,28,31,32],codebas:[17,36],rais:[1,20,51,21,19,3,28,11,31],unicorn:22,kid:5,kept:[3,41],scenario:55,thu:[14,13],min:27,inherit:[15,38,1,2,5,6,7,42,61,31],contact:17,thi:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,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,53,55,56,57,58,59,60,61,62,63,64],endif:[61,1,27,44],programm:[6,43,5],everyth:[33,16,41,35,54,3,60,6,7,26,43,28,45,32],setformatt:35,unchang:[28,53,3],protocol:[62,7,1,8],just:[1,60,57,7,8,10,14,16,17,18,19,20,21,24,25,26,28,29,30,31,64,34,35,36,37,39,40,41,43,44,45,46,47,48,49,51,52,55,3,61,62,63],pathdispatch:48,human:[14,35],nowadai:8,yet:[14,48,18,1,36,3,60,5,40,56,6,7,55,43,49,29],languag:[14,29,56,7,36],previous:[24,21,51],xmlhttprequest:3,requestcontext:[3,34,6],easi:[36,64,17,1,2,37,54,21,5,56,6,7,26,27,48,57,32],interfer:1,had:[28,17,21],get_template_attribut:[3,51],lang_cod:56,spread:21,els:[14,33,16,17,35,1,36,20,53,41,56,48,7,8,44,61,57,32],save:[0,1,36,39,23,19,3,8,28,35],explanatori:55,session_cookie_secur:[3,31],sanit:9,applic:[0,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,43,44,45,46,47,48,49,51,52,53,54,55,56,57,58,59,60,62,63,64],assig:56,quicktim:5,mayb:[49,36],preserv:[15,38,6,51],disposit:[45,3],background:[15,16,38,44],shadow:41,add_entri:[61,32],daemon:40,to_python:3,specif:[1,5,3,7,8,13,15,21,22,23,26,28,30,31,34,38,48,49,50,51,53,56,45],arbitrari:[41,1,51,21,3,7,45],manual:[39,63,21,1,2],instanci:[3,48,20],install_requir:[14,55],sqlite3_databas:14,unnecessari:21,teardown_request:[14,34,51,3,60,21,6,57,11,63],underli:[17,6,1,36,21,3],www:[14,64,1,39,40,3],right:[16,35,50,23,56,3,26,28,49,30,11,45],old:[14,0,1,51,4,21,24,6,8,28],deal:[17,35,1,43,3,8,28,31],negat:41,"_db":57,intern:[15,38,48,1,36,51,3,21,55,24,6,8,30,31,45],flatten:3,pain:[3,5],indirect:50,successfulli:[23,3,44,32],transmiss:1,autocommit:63,total:[45,8],ico:0,bottom:[43,16,26,18],get_current_us:3,swfupload:28,jinja_load:3,suffici:[40,3],unit:[3,21],detect_user_languag:29,condit:[40,3,21,50,51],foo:[14,41,6,60,21,3,58,31],localhost:[48,22,19,3,26,45,31,63],core:[15,38,35,36,23,7],plu:3,sensibl:3,bold:16,insecur:36,import_nam:[30,3],about_pag:20,popular:[39,64,9,1,5,22,26,62,31],promot:50,repositori:[64,49],post:[1,20,3,60,21,6,61,27,44,28,45,32],"super":42,chapter:[34,6,36,55,3,43],obj:[45,3],slightli:[40,49,44],surround:3,simul:60,memcachedcach:4,commit:[21,19,57,10,63,32],curiou:[7,36],response_wrapp:3,"float":[3,1],this_is_a_very_long:41,bound:[14,13,3,60,21,23,6],two:[1,4,42,3,7,13,14,15,17,20,22,19,25,26,60,37,43,64,47,41,49,6,45],down:[64,34,3,60,21,23,6,29,11],inject_url_default:3,formerli:[7,55],wrap:[1,53,5,3,7,30,13],bool:3,storag:5,git:[49,21,51],fabric:[64,15,38,2,55,31],wai:[0,1,3,4,5,6,7,8,9,12,13,14,17,18,21,23,19,25,28,29,31,34,36,20,43,44,64,47,49,50,51,52,53,56,57,58,60,45,63],frustrat:[17,35,13],support:[0,1,4,5,3,7,8,9,10,14,17,20,21,22,23,25,26,31,33,36,37,40,47,48,49,51,52,55,58,59],happi:17,avail:[14,46,47,34,35,1,18,51,3,52,53,60,5,23,48,7,55,61,11,31,13],width:16,reli:[23,21,39],editor:[15,38,8],lage:36,fork:[15,38,17,1,36,22],showus:20,head:[15,47,35,1,36,51,3,55,18,5,19,6,42,27,49,31,63,13],creation:[48,51,55,40,43,12],form:[15,38,50,35,1,36,20,60,5,3,7,26,27,44,28,61,45,2,32],sendfil:[3,31],forg:[28,1,22],test_empty_db:60,back:[64,17,1,3,53,21,23,24,34,26,48,30,59,32],"31st":51,"0x104f6ad10":[],sqlalchemi:[15,38,9,8,2,55,19,3,27,35,63],iri_to_uri:3,"true":[14,64,48,1,18,41,3,60,55,23,19,6,57,8,44,28,43,32,31,63,27],preview:51,bugfix:51,maximum:[28,19,41,55],until:[34,1,36,51,3,6,26],fundament:48,temper:1,featur:[33,41,51,53,21,5,19,3,7,55,28],semicolon:49,patchfil:21,hardcod:[3,31,1,26],"abstract":[14,48,2,36,7,63],uri:[62,39,8],calvado:51,exist:[1,60,5,3,11,13,14,17,21,23,24,28,29,31,36,37,43,64,48,49,6,58,45],ship:[14,57,55,50,22],face:[49,45,35],check:[1,60,3,61,10,14,15,18,21,28,32,33,35,36,39,43,64,47,41,49,56,6],inde:60,vista:49,register_modul:3,author_email:14,formatexcept:35,tip:36,refactor:[51,21,20],sysv:39,test:[14,15,16,34,1,33,3,31,51,21,38,23,19,6,7,60,54,12,63,64],webob:7,unlimit:28,runtim:[31,3,21,5,51],notif:23,intend:[14,47,48,13,60,23,3],relas:51,notepad:8,session_interfac:3,scale:[15,38,17],intent:[47,20],consid:[14,15,47,17,9,1,20,60,38,5,40,56,3],sql:[2,37,3,19,57,7,10,63,32],entrust:36,receiv:[45,3,1,51],faster:[28,26,5],furthermor:[64,17,1,50,56,7,26],anywher:[29,45,36],getjson:26,pathnam:[3,35],time:[1,4,5,6,7,10,12,14,16,21,22,23,29,31,34,35,36,20,64,47,41,49,51,53,3,60,45,59],push:[34,6,51,3,45,31],backward:[49,51,21,55,3,5],my_dict:41,concept:[14,15,47,13,36,21,38,56,7,45,31,64],make_null_sess:3,ron:50,skip:[3,21,1],global:[15,38,17,1,3,21,23,40,6,26,13],focus:[15,38],invent:53,osi:14,subclass:[17,35,36,20,51,19,3,7,28,31,63],"3em":16,"_perman":3,millisecond:35,decid:[14,17,1,51,3,7,26],hold:[3,6,31,1],depend:[1,2,60,57,7,13,14,15,17,21,24,31,34,36,38,39,40,41,43,64,47,48,49,51,52,55,3,58],flask:[0,1,2,3,4,5,6,7,8,11,12,13,14,15,17,18,24,21,22,23,19,25,26,27,28,29,30,31,32,33,34,35,36,20,38,39,41,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64],render_field:27,flash:[15,16,18,1,2,51,21,38,5,3,61,27,44,28,32],before_first_request:[3,51],rightmost:47,decis:[15,38,7,36],isinst:[53,41],sourc:[64,33,47,35,50,36,60,21,22,40,3,8,49,11,31],a_kei:60,string:[1,4,3,7,8,13,20,23,26,27,30,32,60,35,18,37,41,53,56,57,63,59],"_request_ctx_stack":[14,3],x9fr:1,context_processor:[3,13],artwork:[15,38,50],word:[41,60],exact:[17,39],cool:3,administr:60,level:[14,47,48,35,36,41,60,22,6,45,11],tear:[23,34,3],"12th":51,leftov:51,brother:24,get_my_item:4,item:[41,4,55,23,3,61,59],greenlet:[17,7,22],cooki:[1,51,60,3,8,29,45,31],div:[61,42,5],defaultx:60,attachment_filenam:3,declarative_bas:63,prevent:[45,21,55],xhh:1,slower:1,htm:[21,13,51],a0zr98j:1,sign:[3,41,9,1,32],cost:3,group1:40,run:[1,2,4,6,7,12,13,14,17,21,22,19,25,26,28,31,34,35,18,39,40,43,45,64,48,49,51,52,55,3,60,62],port:[36,22,40,3,26,31],ioloop:22,appear:[23,7,5],has_static_fold:3,repli:1,favour:[24,7,8],current:[1,2,5,3,7,11,13,14,21,23,19,57,29,30,34,36,39,64,47,49,51,53,6],sinc:[1,36,20,21,5,3,7,39,31,59],blueprint_nam:47,teardown_request_func:3,redirect:[14,15,47,48,0,1,18,51,3,53,60,38,6,7,27,44,28,32],deriv:50,gener:[1,60,5,3,13,15,21,26,27,28,31,34,20,38,43,47,41,50,51,53,55,56,58,59,45,63],"0x104e3d590":[],hairi:31,slow:4,modif:[3,50,54],send_fil:[3,21,51],address:[35,8,18,22,27,45],skeleton:[15,38,60,61,42],along:[18,5,39,58,55,62,11],"0x104bb5650":[],box:[33,10,35,26],max_content_length:[28,3,31,51],model_sav:23,make_respons:[3,6,1,51],rethink:21,bot:36,errorhandl:[24,3,21,1],"__repr__":[19,63],user_view:20,overriden:3,weird:45,commonli:[3,26,55],ourselv:59,novic:24,semant:[21,5],regardless:[3,51],wiki_pag:3,modul:[1,4,6,7,11,14,17,21,19,27,30,31,34,35,18,60,39,40,41,43,46,47,48,51,55,3,58,62,63],prefer:[62,7,63,8],fake:[3,34,6,7],instal:[1,2,60,3,10,13,14,15,21,23,19,26,28,31,39,40,64,38,49,51,52,55,58,62],url_default_funct:3,mobil:1,codenam:51,market:5,memori:[14,1,3,4,6,28,31,59],long_descript:[14,55],call_after_request_callback:29,current_app:[23,6,12,3],record_onc:3,everybodi:[34,17,55],necesari:3,live:[15,38,3,31,49],handler:[14,35,2,51,3,31,21,57,23,24,6,25,30,12,45],msg:[3,35],black:[24,1],checkout:[14,49,1],unsaf:3,configmodul:31,incident:50,peopl:[14,17,1,36,53,21,5,24,7,45,63],claus:50,prototyp:3,effort:63,easiest:[34,49,1,4,42,31],content_typ:3,fly:[3,13,59],graphic:5,judg:1,uniqu:[17,0,1,53,23,3,7,63],cat:45,zhao:50,whatev:[3,50],umlaut:8,purpos:[50,17,36,8],problemat:[14,6,22],underestim:36,favourit:[64,60],stream:[15,38,2,40,3,7,59],backslash:[41,51],levelnam:[3,35],topic:[14,45,43],critic:35,abort:[47,1,18,51,5,23,24,3,28,32],immutabledict:3,"2px":16,unfortun:[31,53,21,45,36],occur:[1,51,3,23,6,11,32],methodview:[3,20],alwai:[14,41,0,36,3,53,39,57,23,40,56,6,7,55,8,28,25,62,31,45,58],peek_path_info:48,multipl:[14,47,48,35,1,20,3,31,4,21,43,6,7,27,52,49,12,63],filename_or_fp:3,myapplic:[3,48,31,1],charset:[3,8,51],write:[39,48,0,27,36,20,3,21,5,22,23,56,6,7,26,8,49,35,30,31,32],anyon:[55,50],xhtml:[15,38,13,51,21,5,3],testingconfig:31,tbodi:5,that_returns_an_object_with_an_attribut:41,map:[2,51,53,20,56,3,30,63],product:[15,38,48,35,1,18,50,52,21,6,49,31],proc:39,max:[39,27],dive:[15,38,6,5],namespace_packag:[],relev:[21,3,0],mac:49,xzf:64,mixin:[3,41],is_xhr:3,date:[3,49,5,51],implicit_sequence_convers:3,underscor:41,data:[9,1,60,5,3,8,15,17,21,23,19,26,27,28,31,35,36,39,38,50,51,55,6,59,45,63],grow:11,man:39,practic:[14,15,38,2,29,31],"6th":51,goal:[36,5],quot:[45,41,60,5],explicit:[15,38,0,13,21,7,31],inform:[1,2,6,7,10,11,13,15,21,19,25,26,27,28,32,35,18,20,39,40,41,64,38,48,49,51,53,55,56,3,45,63],"switch":[14,36,18,51,60,39,31],combin:[64,17,1,2,3,44,56,6,57,60,48,30,45],callabl:[62,3,7],untest:60,tfoot:5,talk:8,securecookiesessioninterfac:3,shelltool:34,fafafa:16,still:[1,4,5,3,7,13,14,21,29,30,33,34,35,36,60,43,48,53,55,56,6,58,45],pointer:3,process_respons:[3,34,60],dynam:[14,48,1,26],entiti:[3,13,26],group:[40,11,43,5],thank:[64,3,7,27],how:[0,1,3,4,5,6,7,10,11,12,13,14,15,21,23,19,26,27,28,30,31,32,60,35,36,20,38,39,43,44,64,47,48,49,54,52,53,55,57,58,59,45,63],endautoescap:13,instantli:60,platform:14,window:[15,38,35,51,21,3,26,49,45,31],pythonpath:40,mail:[15,38,35,51],main:[46,34,36,20,60,3,48,63],get_cookie_httponli:3,non:[41,5,22,40,3,8,31],env:[64,40,49],encod:[15,38,41,3,26,8],supersed:5,initi:[14,15,47,34,49,18,2,3,60,38,57,10,11,64],half:27,recap:64,now:[0,1,3,4,6,7,10,11,14,16,18,21,23,26,27,28,29,32,60,35,36,43,64,49,51,53,54,57,61,45,59],introduct:[1,2,21,43,28,13],term:[30,17,36,5],searchpath:[47,21],name:[9,1,4,5,3,7,0,10,12,13,14,15,17,19,20,21,23,24,26,27,28,30,31,60,35,37,38,39,44,64,47,41,49,50,51,53,55,56,61,45,63],opera:5,perspect:20,drop:[46,34,35,18,37,51,57,26,31,63],separ:[64,47,17,35,18,40,3,39,41,19,48,25,26,27,49,62,31,63],license_fil:41,x13:31,attributeerror:[6,21,51],compil:40,domain:[3,31,48,0,42],replac:[41,49,13,20,3,55,53,21,5,40,6,61,26,29],individu:[60,3,31,27,20],continu:[14,46,16,41,9,1,18,37,51,21,55,3,61,10,11,32],ensur:[14,64,1,60,21,43,19,3,7,26,8,61,45,11],contrib:[4,1,22],redistribut:50,handle_http_except:3,year:[41,26],happen:[14,35,1,36,3,60,21,23,24,6,7,8,29,25,45],turbogear:53,secretview:3,hacker:[28,45,3,1],shown:[60,1,32],accomplish:[30,13],"3rd":45,space:[41,49],profit:[21,50],yourappl:[14,64,47,35,40,3,31,39,22,19,57,25,55,43,30,12,62,63],as_attach:3,item_count:41,profil:[45,1,59],acccess:3,internet:[14,24,5],ironi:28,app_errorhandl:3,uwsgi:[15,62,38,39,52],integr:[17,13,51,21,22,23,19,3],unfriendli:64,earlier:[1,51,21,55,6,58,26,10,31],state:[3,45,6,5],runtimeerror:[3,21,51],million:45,xhtml5:5,ajax:[15,38,26,2],orm:[19,63,8],mime:5,theori:50,org:50,"byte":[45,34,31,8],fastcgi_split_path_info:39,render_templ:[47,1,18,20,53,24,3,61,26,27,44,12,32],enable_buff:59,reusabl:[17,7],"0x1047d3190":[],setdefault:[14,56],geoloc:5,userapi:20,synchron:22,refus:5,recov:5,thing:[9,1,2,4,5,6,7,8,11,13,14,17,21,23,24,26,27,28,30,31,34,36,39,40,43,64,53,3,60,45,59],get_db:14,place:[1,3,10,11,12,13,14,21,26,28,30,31,64,34,35,18,20,46,41,51,6,45],guess_language_from_request:29,okai:1,principl:[15,38,36,20,28,29],imposs:[35,1],lambda:41,oper:[14,47,34,49,1,51,3,4,41,7,26,62,31],info:[3,35],directli:[46,59,60,9,1,18,40,3,51,21,23,19,57,7,26,28,25,10,31,63],template_nam:[53,3,59,20],carri:13,onc:[14,47,48,9,1,51,4,21,39,56,3,58,26,60,49,35,31],arrai:45,yourself:[15,38,34,1,36,60,21,39,40,56,3,8,30,31,45,59,27],fast:19,open:[14,47,41,18,2,36,3,60,22,57,8,49,10,11,31],angular:3,size:[16,9,36,61,26,28,59],given:[47,17,1,18,60,5,56,3,26,62,13],silent:[3,31,18,51],convent:[15,38,41,55,36],gif:28,teardown:[14,15,38,51,3,60,21,23,6,57],after_this_request:29,caught:[3,6,21],traction:5,max_length:19,test_client:[23,6,21,60,3],"0x104e4c890":[],white:[28,24,16,1],conveni:23,friend:45,includ:[14,41,50,51,55,21,39,3,5,62,45],hub:51,especi:[14,1,20,23,56,7,26],copi:[14,17,49,1,42,25,55],undoubtedli:5,specifi:[14,47,9,1,18,20,51,5,23,3,26,8,28,0,32],decorated_funct:53,blacklist:28,github:[58,49,26],mostli:[14,15,38,6],holder:[3,50],than:[47,17,49,1,36,51,3,53,21,5,19,57,7,55,8,31,59],png:[28,50],serv:[48,0,1,21,5,3,28,62],wide:[15,38,49,51,40,3,7,26],scriptalia:25,were:[34,1,51,3,4,21,5,23,24,6,7,26,60,44,45,32],posit:[3,8],seri:49,pre:[64,3,21,60,22],blueprint:[15,47,2,51,12,21,38,56,3,43,31],sai:[47,1,4,55,23,6,43,45],productionconfig:31,san:16,nicer:[28,3,27],pro:[28,15,38,17,26],argument:[47,41,1,3,4,23,57,26,27,44,11,13],properli:[64,47,1,51,5,3,7,8,30,45,63,13],deliv:1,notimplementederror:20,django:[19,48,31,63,20],engin:[15,38,1,36,51,4,5,3,7,42,59,25,30,45,63,13],techniqu:48,destroi:[47,6],jinja_opt:3,note:[14,15,38,48,35,1,50,3,60,21,39,61,19,6,57,26,27,49,32,31,13],altogeth:13,ideal:[47,1,55,22,3,26,45,31],maintain:[6,7,50],take:[17,1,36,20,3,4,21,27,48,7,8,45,11,13],advis:[3,50,43],green:22,wonder:[19,11,1,63],noth:[33,17,24,3,44,32],channel:[14,17],connect_via:23,infinit:51,begin:[15,38,17,2,51,3,60,57],sure:[1,3,4,57,8,13,14,21,23,24,25,28,31,32,35,36,39,40,43,45,64,47,49,51,55,56,6,59,62,63],importantli:[14,35,1],normal:[47,34,1,51,4,3],track:[3,60],toplevel:[45,3],micro:[15,38,7,36],pair:[23,3],homepag:42,icon:[49,0],renam:[17,43],textarea:61,rescu:49,adopt:5,raquo:[3,1],create_al:63,pattern:[14,15,47,48,1,2,31,53,21,38,55,19,3,27,28,12],registrationform:27,shortnam:21,salt:41,gracefulli:23,show:[51,15,47,60,9,1,33,40,20,21,5,19,3,58,26,49,45,32,64,13],error_handler_spec:3,rendit:7,my_index:53,developmentconfig:31,bright:7,concurr:[45,17,1],permiss:[40,35,50],hack:7,help:[14,47,0,1,36,20,3,60,23,40,56,6,7,8,43,45,32,31,13],xml:[13,51,21,5,3,7,26,61],onli:[9,1,3,60,6,7,8,10,11,13,14,17,21,28,30,31,32,33,34,35,36,37,39,43,44,64,47,48,49,51,53,55,57,61,45,63],explicitli:[64,1,20,51,21,39,56,3,55,10,31,45,13],transact:[10,3,60,63],activ:[14,50,34,18,1,36,51,3,60,21,40,6,58,49,31,64],enough:[47,9,1,36,20,4,39,3,26,44,2,32],dict:[14,13,40,3,53,60,19,57,61,26,31,63,32],zip_saf:[14,55],hello_world:1,class_kwarg:3,offici:[14,35,1,63,13],startswith:3,nearli:[19,7,1],variou:[36,50,51,21,55,58,31],get:[0,1,2,3,4,6,61,10,11,12,14,15,17,18,21,22,23,19,26,27,28,29,31,32,33,34,35,36,20,40,44,46,47,48,49,51,53,57,60,59,45,63,64],soon:[17,36,5],cannot:[14,47,49,1,20,12,55,23,3,61,10,31,45],url_for:[47,0,1,18,3,53,21,42,24,56,6,61,26,27,44,28,32,13],requir:[0,13,2,60,5,3,7,8,10,14,21,19,27,28,31,34,35,36,20,40,64,41,51,53,55,58,63],mapper:[19,63,36],yield:[23,59],stupid:45,adminx:60,where:[1,2,3,57,7,11,14,17,21,23,25,26,28,29,31,64,34,35,36,20,40,43,46,47,51,53,55,56,6,45,63],wiki:[40,3,1],"__module__":[30,53],from_envvar:[64,3,31,18,51],testcas:60,concern:36,"0x104e3a650":[],test_request_context:[34,6,1,60,3,57],detect:[3,21,51],foreword:[15,38,36],review:[14,21],enumer:[57,21],label:27,getattr:[29,57],teardown_app_request:3,between:[14,48,49,1,41,3,51,21,19,6,26,31],"import":[0,1,3,4,5,6,7,10,12,13,14,15,17,18,24,21,22,23,19,25,26,27,28,29,30,31,34,35,36,20,38,39,40,42,43,44,64,47,48,51,53,55,56,57,58,59,60,45,63],across:[47,39],shutdown_sess:63,plupload:28,assumpt:[3,17,6,8],parent:42,screen:[3,39],"_get_current_object":[23,6],come:[1,60,5,6,7,8,11,13,21,23,24,31,33,34,18,20,48,64,41,55,56,45],vimrc:8,similar:[64,48,1,20,3,4,39,23,41,25,26,8,60,7,63],afshar:50,contract:50,emit:[23,3,21,51],uploaded_fil:[28,1],audienc:14,tutori:[46,15,38,64,33,60,11],improv:[15,38,17,2,36,51,3,31,60,21,5,56,34,28,12],test_client_class:3,among:5,undocu:21,color:[16,42],overview:[3,1,5,44],unittest:[14,34,1,50,51,31,54,21,23,3,7,60,12],inspir:[7,43,20],equalto:27,pop:[34,1,51,3,56,6,31,32],exploit:36,colon:41,from_form_data:20,supervisor:39,poll:28,damag:50,better:[17,0,1,20,49,51,21,5,40,3,7,26,60,44,28,35,55,31],sess:60,coupl:[17,35,13,3,31,21,5,23,19,6,27,28,45,12],resort:17,invers:21,mark:[14,1,36,3,5,24,57,61,8,28,29,11,32,13],"0x104f1cb90":[],addit:[15,38,53,60,21,3,63,32],valueerror:21,thead:5,thousand:22,rubi:[7,22],enable_modul:3,those:[17,9,1,42,3,7,35,31],stream_templ:59,sound:[53,42],mount:[47,0,39],include_package_data:[14,55],trick:[15,38,34,20,60,30,45,59,32],invok:[14,1,51,22,23,3,59],connect_db:[10,11,57,18],got_request_except:[23,3],schranz:50,margin:16,advantag:[48,20,21,55,23,40,3,7,26,27],stdout:40,canon:[3,7,1],show_al:14,worri:1,endswith:48,sqlite3_db:14,myapp:[62,31,26],"return":[0,1,3,4,6,7,8,11,12,13,14,15,24,21,22,23,19,26,27,28,29,30,31,32,34,35,18,20,38,41,43,44,47,48,51,53,56,57,60,59,63],ascii:[41,8],"__init__":[14,48,1,20,3,22,41,43,30,31,63],yourfil:55,httpserver:22,develop:[1,2,4,5,6,7,8,14,15,17,36,21,23,26,28,31,33,60,18,38,48,49,50,51,52,55,3,58,45],author:[14,15,38,41,50],same:[0,1,60,5,6,7,8,12,13,14,18,21,23,19,26,30,35,36,20,39,41,47,48,49,51,53,55,3,61,45,63],binari:[41,50,8],html:[9,1,2,60,5,3,61,8,0,13,15,21,23,24,26,27,28,32,33,36,20,38,42,43,44,47,51,53,45,59],pad:16,subdomain:[47,48,2,51,3,31],frazier:50,finish:[49,54],webserv:[17,0,1,3,39,40,48,7,28,25,12],screenshot:[9,1],nest:[3,41],someon:[28,45,18],unhandl:[3,6],baseconvert:3,http_host:[48,22],mani:[14,17,49,1,36,5,22,41,7,27,28,31,63],extern:[64,15,49,1,18,51,3,45],thehandleryouw:35,permanent_session_lifetim:[3,31],appropri:[14,64,60,21,8],moder:14,fastcgi_path_info:39,megabyt:28,macro:[3,7,13,27],markup:[1,5,3,61,45,13],rotatingfilehandl:35,this_is_never_execut:1,without:[14,50,47,49,1,18,51,3,60,21,5,19,6,7,55,8,30,31,45,59,64],xb4:31,promis:35,model:[20,22,23,19,3,63],grappa:51,roughli:[64,3],ccc:16,create_url_adapt:[3,51],send_from_directori:[28,3,0],wiki_fold:3,execut:[1,3,60,6,10,11,14,21,22,23,25,28,29,31,32,34,18,20,39,40,64,47,49,51,56,57,45,63],when:[9,1,3,4,5,6,7,8,10,12,14,18,21,22,23,24,26,27,29,31,32,34,35,36,20,42,43,44,47,51,53,56,57,58,60,45,59],resp:[6,21,1,60],xiaohong:50,rest:[3,20],genshi:[7,5],touch:[14,64,31],speed:4,versu:[15,38,1,5,63],display_nam:41,hint:[15,38,11,20],except:[14,47,48,35,61,19,3,51,21,41,23,24,6,57,8,28,60,10,11,31,63],littl:[49,18,36,51,3,53,60,19,57,26,27,28,45,31,63],desktop:49,blog:9,from_pyfil:[14,31,3,12,51],vulner:[36,32],earli:[14,35,1,23,24,31],around:[15,38,34,35,1,36,60,3,4,21,5,6,7,39,43,50],read:[14,47,34,35,1,36,3,53,21,5,57,55,8,28,10,31,27],outermost:53,"0x104bef610":[],dispatch:[15,47,48,2,20,3,51,21,38,6],generate_large_csv:59,amp:3,mod:40,silverlight:28,whitespac:[3,41,5],has_request_context:[3,51],integ:[3,31,1,63,37],server:[0,1,4,5,6,7,8,10,15,17,18,24,21,22,19,25,26,28,31,35,36,39,40,45,64,38,48,49,51,52,55,3,62,59],either:[0,1,3,8,13,14,17,21,19,25,26,29,31,36,20,40,64,47,49,51,55,6,45,63],yourconfig:3,manag:[14,47,49,1,39,23,40,55,27,45,31],fulfil:3,my_file_object:21,friendfe:22,wsgiapplicationgroup:40,use_reload:[3,48],url_prefix:[47,3,12,56],dispatchermiddlewar:48,is_null_sess:3,brokenpackag:55,definit:[15,38,3,1,50],achiev:[28,17,51],legal:[15,38],x3c:26,inject:[13,3,53,21,56,57,45,32],searchword:1,unbeliev:61,complic:[42,5],refer:[14,15,38,0,50,36,3,6,7,43,31],home_username_:28,power:[17,1,42,22,5,10],gztar:64,inspect:[3,31,60],broken:60,found:[36,50,1,18,55,24,3,10,31,62],"__name__":[1,60,3,7,12,14,19,25,26,28,30,31,18,39,40,43,64,47,53,56,6,62],referr:6,"throw":4,valid_login:1,comparison:[33,41,7],central:[47,2,51,3,7,30],greatli:[47,21,36],total_second:[],microframework:[14,17,7,36],stand:22,act:3,luck:0,processor:[15,38,13,2,51,21,56,3],road:6,lazyview:30,convert_unicod:63,effici:3,status_cod:[23,3],surviv:3,show_us:[3,20],runawai:51,the_templ:59,strip:[64,3],your:[0,1,4,42,6,7,8,9,10,11,12,13,14,17,18,24,21,22,23,19,25,26,27,28,30,31,32,34,35,36,60,39,40,43,45,64,47,48,49,51,52,53,55,56,3,58,61,62,63],certainli:35,log:[15,38,9,1,2,51,53,60,21,39,61,3,7,44,35,45,32],grindstaff:50,use_debugg:3,strict:[15,38,50,5,19],interfac:[15,38,48,49,1,51,60,21,5,3,7,8,44,45],low:60,lot:[14,17,9,2,36,20,3,21,55,56,6,59,28,35,31,63],instance_root:31,strictli:[14,6,5],machin:[64,1],nteventloghandl:35,ago:[28,26],tupl:[41,35,1,3,63,32],bundl:7,regard:[14,17,48],cryptograph:[3,1],longer:[17,1,41,3,51,21,39,56,6,7,60],pull:[64,56,3,49,55],tripl:41,mathml:5,possibl:[0,1,60,3,61,10,12,13,14,18,21,29,31,36,44,49,50,51,53,55,57,7,45],"default":[1,60,3,61,8,13,21,19,26,28,31,32,35,18,20,39,44,47,48,49,51,53,55,6,59],start_respons:[3,6,48,22],add_numb:26,preconfigur:[1,36],embed:45,elegantli:11,mongodb_host:19,formattim:35,gone:[24,21],creat:[9,1,2,3,4,5,6,7,10,12,14,15,16,17,20,23,19,25,26,27,29,31,33,34,35,18,37,38,39,40,43,46,47,48,49,51,52,53,55,57,60,45,63,64],certain:[35,1,2,51,3,53,60,23,6,7,45,31],yourapplication_set:[3,31],strongli:[3,21,36],uppercase_with_underscor:41,file:[0,1,2,3,60,5,6,7,8,10,12,14,15,36,21,25,26,28,30,31,64,35,18,37,38,39,40,43,45,46,47,41,49,50,51,52,55,57,58,62],ocurr:3,fill:[45,3,42,36],again:[64,2,3,60,39,40,6,7,55,8,45,32],logger_nam:[3,31],googl:[30,25,26,51],idiom:14,valid:[15,38,48,1,36,51,60,5,19,3,27,28,45,2,31],class_arg:3,ignor:[34,1,51,40,3,45,11],you:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,17,18,24,21,22,23,19,25,26,27,28,29,30,31,32,33,34,35,36,20,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],poor:5,registri:[14,3,58,55],brandl:50,sequenc:3,docstr:[15,38,41],testproject:47,register_error_handl:[3,21],reduc:[56,5],assert:[48,1,51,60,23,3],unbind:3,directori:[46,64,0,51,21,39,40,3,7,55,8],connected_to:23,bindaddress:39,tricki:3,adam:50,potenti:29,escap:[1,51,3,61,26,27,45,13],degrad:23,represent:[3,13],all:[9,1,60,5,6,7,0,11,13,14,17,18,21,23,24,25,26,28,30,31,32,35,36,20,40,41,42,43,44,64,47,48,49,50,51,55,56,3,61,45,63],dist:64,consider:[15,38,45,13],ali:50,flask_simplexml:14,lack:[21,5],month:3,rebind:41,scalar:41,runserv:43,higher:49,abil:[64,13,51,21,3,28,31],follow:[9,1,60,5,3,7,10,11,12,13,14,15,21,23,24,27,28,29,31,64,35,18,37,39,40,43,45,46,41,49,50,53,61,62,63],blueprintnam:21,edg:[15,38,49],extra:[14,7,3,0],chain:29,script_nam:[62,39],articl:[45,0,5],init:39,program:[14,24,7,35,36],hasattr:[14,29,57,21,3],rstrip:48,neglig:50,introduc:[14,15,47,9,33,20,21,38,56,51,31],"case":[1,2,60,5,6,7,8,10,12,13,14,17,21,23,24,26,30,31,34,18,39,41,43,64,47,48,51,53,55,3,63],liter:[45,8],straightforward:[64,53,5,3,28,12],fals:[14,64,41,1,3,21,55,57,26,27,31,63,13],subcommand:64,minitwit:60,offlin:5,util:[47,6,21,1],"1px":16,verb:[1,20],mechan:28,failur:3,fab:64,otherlibrari:35,list:[14,16,41,35,1,50,20,3,51,55,23,19,57,58,26,27,29,31],helloworld:14,collect:[19,47],sane:59,stderr:[40,3],small:[15,41,35,18,36,20,21,6,26,43,28,31,32],preserve_context_on_except:[3,6,31],secret_kei:[31,3,21,1,18],default_config:[64,3],ass:49,unreview:36,pk_type:20,past:[14,17,1,21,3,7],syslog:35,zero:[49,35],design:[14,15,38,17,36,51,60,6,7,27,29,62,31],pass:[1,60,57,7,11,12,13,14,21,23,24,27,29,30,31,32,35,36,20,39,64,41,51,53,3,59,61,63],further:[14,15,38,34,35,51,3,53,56,6,30,12],gunicorn:[52,22],mymiddlewar:3,sub:25,section:[64,15,50,18,1,36,54,21,40,7,43,49,13],abl:[64,17,18,51,3,21,23,57,7,28,45,31],brief:41,overload:[24,35],forc:[3,31,6,7,55],delet:[64,60,1,20,51,24,3,7,43,45,32],version:[14,15,38,17,49,64,50,51,31,21,39,22,23,3,58,26,28,55,12],primary_kei:63,use_evalex:3,row:[61,32,57,59,37],"public":[1,51],contrast:[23,6],full:[33,48,35,1,50,51,52,4,19,3,60,44,28,31],themselv:[14,35,3,31],unmodifi:3,behaviour:[14,1,51,5,19,3,7,26,13],modular:[15,47,38,3,43,12],shouldn:7,simon:50,goodby:41,strong:[61,3,60,1,44],modifi:[15,38,17,1,50,40,3,31,51,21,23,19,6,60,28,29,62,11,12,45],newserv:64,valu:[1,3,4,5,6,7,11,12,13,14,15,21,22,23,19,26,27,28,31,32,60,18,20,44,38,41,49,51,53,56,57,61,45],search:[49,1],rendertemplateview:20,sender:23,ahead:[64,7,51],memcach:4,prior:50,amount:[28,30,17,53,59],social:45,action:[1,23,61,27,44,28],pop_path_info:48,x0f5:31,server_nam:[3,31,51],via:[14,46,47,0,21,3,27,31],packagenam:14,after_request_func:3,primit:26,transit:[14,15,38,21],"0x105024550":[],vim:8,deprec:[14,21,3,7,51],href:[0,42,24,3,61,26,44,5,45],famili:16,suddenli:[30,17,1],"0x10355cb50":[],handle_error:21,select:[63,57,26,8,32],helper:[14,34,13,51,3,23,57,27,10,30],internation:[56,2],liber:14,regist:[14,15,47,34,13,36,24,20,38,55,19,3,27,28,29,51,31,45,63],libev:22,taken:21,md5:41,send_static_fil:3,toggl:31,more:[9,1,2,3,60,5,6,7,10,13,14,15,17,18,24,21,23,19,25,26,27,28,31,32,34,35,36,20,39,40,64,47,41,49,50,51,53,55,56,57,59,45,63],guesss:21,precompil:41,templatenotfound:47,desir:1,signals_avail:3,mozilla:5,myproject:[49,22],flag:[14,1,18,51,60,21,55,3,31],stick:50,broke:51,particular:[6,1,50,3,29,45],known:[3,55,5],sourcecod:[64,33,3,26,50],cach:[15,38,2,51,53,4,3,26],none:[14,16,48,1,20,3,53,4,41,56,6,57,44,29,11,31,63,32],endpoint:[47,1,2,51,53,20,21,56,3],outlin:[21,19,3,7,10,45,63],dev:[14,49,31],histori:[15,38,5],remain:30,learn:[14,15,38,17,33],before_app_first_request:3,def:[0,1,3,4,6,7,8,10,11,12,13,14,24,21,22,23,19,26,27,28,29,30,32,60,18,20,41,43,44,64,47,48,53,56,57,59,63],someobject:3,factori:[14,15,38,48,2,60,40,7,12],prompt:49,scan:21,duplain:50,registr:[15,38,51,20,21,3,27],share:[14,47,3,55,6,61,5],save_sess:3,accept:[1,51,23,3,26,27,28],compani:55,minimum:[14,55,8],unreli:[21,3,7,51],explor:5,"3yx":1,cours:[64,17,0,1,20,8,44,45,12,27],newlin:8,awkward:29,secur:[15,38,18,1,36,51,22,40,3,28,45,32,31,13],rather:[15,47,3,1,19],anoth:[14,47,48,35,1,51,3,55,21,42,22,23,56,6,7,26,45],snippet:2,reject:31,csv:59,simpl:[1,2,3,4,42,6,14,22,19,26,28,30,33,60,35,36,20,41,43,44,64,47,48,53,57,58,63],css:[46,16,1,47,42,3,61,43,45],unabl:21,resourc:[15,47,34,2,40,51,38,55,24,56,3,7,10],flip:[31,51],reflect:[3,17,7],url_value_preprocessor:[56,3],embrac:36,datastor:36,unlink:60,associ:[47,6],list_templ:51,"short":[14,23,64,28],footer:[1,42],roundtrip:59,render_large_templ:59,ambigu:7,caus:[14,50,17,1,36,51,3,21,5,23,40,6,7,28,45,13],callback:[15,38,17,1,2,51,3,21,6,29,34,45],rotat:35,max_ag:3,hypertext:5,kitten:45,autoload:63,through:[47,3,31,1,51],paramet:[14,47,41,1,20,3,55,51,21,39,40,56,6,26,32,31,13],style:[15,16,1,33,47,42,3,61,43,38],overhead:5,appl:[3,1,5],view_func:[30,3,20],late:[28,30,1,2],segfault:40,"0x105037bd0":[],bypass:59,might:[9,1,5,6,11,14,21,22,23,24,25,27,28,30,31,32,34,35,36,20,39,40,41,42,44,45,47,48,51,55,56,3,59,62,63],alter:[7,51],epol:22,finer:[6,51],good:[9,1,3,4,5,57,7,10,11,14,21,23,24,28,31,32,60,35,18,20,43,44,64,41,49,50,53,6,45],"4c271729e13823182f000000":19,timestamp:3,fidl:3,"_get_current_us":3,framework:[17,35,36,23,3,7,45],rsplit:[28,30],complain:[3,18,51],"_helper":13,document:[0,1,2,60,5,6,7,8,13,14,15,24,21,19,25,26,28,31,34,35,36,41,42,43,64,38,48,50,51,52,54,3,58,45,63],troubleshoot:[40,10,52],unlik:[49,5],authent:[45,3,36,2],did:[14,35,1,51,3,60,21,24,6,43,10,63],token:45,http_server:22,undertak:7,fulli:[55,51],unicod:[15,38,41,1,36,19,3,7,8,27],ifi:[],after_app_request:3,use_x_sendfil:[3,31],weight:16,hard:[14,36,18,60,5,39,27,45,1],idea:[1,3,4,57,7,10,11,12,13,14,17,18,24,19,26,28,34,35,36,39,43,48,54,53,56,6],procedur:1,realli:[14,48,0,1,36,39,5,23,56,26,8,44,12,53],iter:[35,36,3,7,61,59],event:[35,26,50,22],hostnam:3,"try":[14,47,41,49,13,3,60,55,23,24,6,7,26,27,29],flaskext:[14,15,38,3,58],upload_fil:[28,1],publish:5,payload:28,bubbl:[31,6,21],log_template_rend:23,etag:[3,21,51],lineno:[3,35],print:[41,1,40,23,19,6,57,31],variable_nam:[3,1],url_map:[53,3,56],get_sess:3,name_r:41,instance_relative_config:[3,31],proxi:[15,38,17,1,3,52,60,21,22,23,6],advanc:[33,49,39,40,25,5,62],select_jinja_autoescap:[3,21],guess:[35,18,51,21,3,0,45,31],pleasant:[29,34,57,36,8],quick:[64,1,50,5,3,7,26,43,30,13],reason:[34,1,36,3,5,23,40,6,7,55,43,28],base:[1,2,4,5,57,7,8,14,15,17,21,22,23,19,31,60,36,20,42,38,48,49,51,53,56,3,45,63],put:[0,1,4,3,7,8,11,13,17,20,19,25,26,31,64,34,35,37,40,46,41,51,56,61,63],basi:[3,5,51],thread:[15,38,17,1,36,3,40,6,7,48,11,63],capabl:1,propagate_except:[3,31,51],perman:[28,24,3,31,51],lifetim:[3,31],assign:[3,21],feed:33,pleas:[41,35,1,3,21,39,22,40,57,25,55,62,31,13],major:[64,17,1,60,5,25,8,7],notifi:[23,32],default_set:31,feel:[14,9],exchang:26,number:[64,17,35,1,3,41,26,8,28,31],wsgiscriptreload:40,done:[14,64,34,49,1,55,3,7,26,31,32],least:[49,24,4,31,26],blank:41,miss:[1,51,21,5,23,3,61,26,28],fanci:[24,8],differ:[9,1,60,6,7,11,12,13,14,15,17,21,23,24,26,31,35,36,20,39,40,41,44,64,47,48,49,50,52,3,58,63],php:28,script:[14,15,38,18,1,2,3,55,39,21,5,57,36,26,28,49,10,11,31,45,13],get_cookie_secur:3,interact:[34,1,18,3,21,6,57],construct:[47,55,3,5,45,11],stori:28,underlin:41,order_bi:41,expand:[3,17,27],statement:[64,15,38,34,1,41,3,51,21,6,57,26,60,10,63,32],cfg:[14,31,3,12,64],scheme:[14,21],store:[14,64,17,35,1,36,60,3,53,4,40,34,7,8,28,10,11,31,45,32],schema:[46,15,38,18,2,33,3,37,19,57,10],option:[15,47,48,1,51,52,38,5,22,23,3,39,30,62,13],behind:[11,6,1,5,22],checklist:[64,43],pymongo:[19,2],selector:26,part:[14,15,47,50,1,36,20,3,51,21,38,42,23,56,6,57,26,8,60,45,31],pars:[3,26,5],consult:[28,35,25,40],myclass:41,notfound:[3,48],kind:[14,17,1,36,21,24,3,26,30,31,45],whenev:[49,13,20,23,40,3,7,8],remot:[14,64,51,22],remov:[60,1,51,3,4,21,40,56,6,63,32],riski:31,jqueri:[15,38,3,26,2],bridg:[14,7],str:[19,3,8],consumpt:3,pull_lang_cod:56,when_template_rend:23,cleaner:[6,18,5],comput:[64,49,35,1],deleg:48,favicon:[15,38,0,2],packag:[1,2,60,3,7,10,12,14,17,21,31,64,35,40,43,46,47,41,49,51,55,58,63],uwsgi_param:62,expir:3,mod_rewrit:25,dedic:0,"null":[3,37],imagin:[1,3,53,6,43,28,30,12,45],built:[3,8,51],equival:[61,3,7],remote_addr:[3,22],self:[14,48,20,3,60,5,22,23,19,6,55,41,30,63],blindli:22,client:[15,38,35,1,18,51,3,60,21,22,23,6,26,28,11,59],also:[0,1,2,4,5,6,7,8,9,10,13,14,15,17,18,24,21,23,19,25,26,28,31,34,35,36,20,39,40,44,64,47,48,51,55,3,60,59,61,45,63],before_first_request_func:3,useless:[45,35],on_json_loading_fail:3,brace:41,"35em":16,to_url:3,vnd:0,distribut:[14,15,38,2,50,55,3,58,31,64],unsur:1,setuptool:[14,49,55],previou:[21,51],reach:[6,60],safe_join:[3,51],react:[1,5],most:[0,1,2,5,6,7,8,14,17,24,21,22,23,19,27,28,31,35,36,20,39,40,42,43,64,49,55,3,62,63],plai:[34,8,51],path_info:39,flask_extensionnam:14,enpoint:[],lazili:[15,30,38,2],filesystem:[47,35,1,60,3,8,28,12,59],mymodel:41,cover:[35,1,36,40,3,8],ext:[14,3,58,63,51],exp:41,script_root:[3,26],enctyp:[28,1],usual:[64,47,35,1,36,51,49,5,22,24,3,7,26,8,44,28,25,30,31,45,58],microsoft:0,awesom:[42,5],session_transact:[3,60,51],wsgi:[64,15,47,48,49,1,2,3,52,38,39,22,40,6,7,25,62,12,59],somewhat:[19,30],flaskr_set:18,session:[15,38,34,1,18,51,60,21,23,19,3,7,61,32,31,63,13],estienn:50,font:16,fine:[35,43],find:[64,15,47,17,0,36,2,40,3,21,38,39,19,6,58,55,27,61,30,11,31],nosql:9,copyright:[41,50,42],paranoid:60,solut:[18,36,53,60,39,56,28,2,31,1],templat:[1,2,5,3,7,8,12,13,15,21,23,24,26,27,32,33,36,20,38,42,43,44,46,47,49,51,53,55,61,45,59],factor:[47,17],wsgidaemonprocess:40,yml:51,nullsess:3,remedi:45,xss:[15,38,13,36,28,45],hit:1,ifself:47,albeit:[15,45],sapin:50,"__file__":40,express:[15,38,41,1,50,45,59],with_:3,app_url_value_preprocessor:3,absolute_import:14,myvari:13,liabl:50,cgi:[15,38,25,52],restart:[40,31,1,39],use_cooki:3,rfc:1,common:[0,1,2,42,3,7,8,12,14,15,24,22,23,19,28,29,31,34,36,39,64,47,48,51,53,56,58,63],xe5:1,wrote:[18,5],set:[1,2,4,5,6,7,8,12,14,24,22,23,19,26,28,29,30,31,32,60,35,18,20,39,40,41,64,47,48,49,51,53,55,56,3,62],aspect:36,dump:3,creator:48,cleverli:41,startup:[40,43],mutabl:3,request_tearing_down:[23,3],see:[0,1,2,60,6,7,13,14,24,21,22,19,26,27,28,31,32,35,18,20,39,41,64,47,48,49,50,51,53,54,55,3,62],bare:[14,45,5],arg:[35,1,3,53,60,6,57,26,27,30],close:[14,41,2,20,3,60,21,5,23,57,10,11,45,63],session_cookie_domain:[3,31],glue:17,someth:[1,60,3,7,8,14,24,23,19,25,26,28,4,35,39,40,41,43,46,48,53,57],topmost:6,yoda:41,reus:61,subscript:[23,15,38],experi:[15,38,34,1,31,21,3,8,28,29,12],"15th":51,altern:[20,3,21,55,40,6,44,28,29,31],latin:8,greb:50,javascript:[46,1,5,3,26,28,45,13],isol:[48,49],sigler:50,disallow:[28,24,40],superuser_requir:3,lowercas:[3,8,20],len:[23,19,48],solv:[45,49,36,22],config_filenam:12,popul:[3,31],disclaim:[55,50],last:[17,41,3,51,21,39,40,6,5,28],register_blueprint:[47,3,12],alon:[14,51,26,22],strict_slash:[],context:[14,15,38,17,49,1,20,3,51,21,57,23,6,7,60,34,31,45,59,13],forgotten:53,pdf:[28,51],oldarrai:45,whole:[47,1,36,51,21,56,3,26,31],load:[39,15,38,18,2,20,51,21,5,40,3,7,26,8,30,31,45,63],markdown:13,simpli:[48,0,5],point:[64,47,17,1,20,3,60,55,6,25,8,29,34,31],instanti:[35,47,6,7,53],open_resourc:[3,10,57,7,47],unrealist:5,header:[48,1,51,3,60,39,22,41,61,5,8,45],param:[],shutdown:34,suppli:[14,51],mistak:24,not_found:[3,1],backend:[3,4,35,60,48],add_etag:[3,21],java:28,devic:1,due:[14,17,51,20,21,5,3,45],empti:[53,3,49,42,51],accessor:3,app_context_processor:3,secret:[3,51,31,1,44],make_setup_st:3,damn:24,xab:31,session_class:3,"5em":16,error_handl:21,execfil:40,fire:[15,38,34,49,18,60,7],static_url_path:3,imag:[45,0,50,5],consequenti:50,append:[41,35,1,23,3,49,29],understand:[1,21,42,6,7,5],func:[3,26],demand:[57,21,1,2],repetit:[14,56],wsgiserv:[39,22],convers:[15,38,8],xa8:1,georgia:16,conception:51,pilgrim:5,xa0:1,xa1:1,xa2:1,xa3:31,durat:[10,3],formatt:35,"while":[14,47,35,36,3,53,60,21,5,6,7,28,45,11,63],unifi:21,match:[6,1,55,56,3,27],abov:[0,1,60,5,3,61,12,13,14,23,19,26,27,28,31,32,35,18,64,49,50,54,45,63],error:[1,2,60,5,3,61,10,15,16,21,24,26,27,31,32,35,18,39,40,44,38,48,51,6,45],fun:[64,1,27],loop:[44,61,22],pack:64,propag:[31,51],pound:41,readi:64,ctx:[14,34,6,53,3],readm:14,jpg:28,itself:[1,4,3,7,13,14,17,21,23,26,31,34,35,36,20,43,64,49,50,51,55,60,45,59],x8d:31,coroutin:22,addhandl:35,decor:[15,47,1,2,20,3,53,51,21,38,23,24,56,57,7,43,29,30,11,13],restructur:43,minim:[15,38,7,1],belong:3,decod:[15,38,3,8],sqlite3:[14,9,18,60,57,10,63],lenient:5,mod_wsgi:[64,15,38,52,40],conflict:[49,1],bom:8,appreci:50,optim:[30,25],painless:[21,8],wherea:21,alert:[45,35],moment:[28,11,20],temporari:[64,1,60,39,23,3,28],user:[9,1,2,3,60,5,6,61,13,14,15,17,18,24,21,19,26,27,28,29,30,31,32,33,34,35,36,20,38,39,40,41,44,46,47,48,49,51,53,57,45,63,64],"0x104bfa750":[],chang:[1,60,5,3,8,10,12,14,17,21,23,28,31,35,36,40,64,47,49,51,55,6,45],recent:[63,6,7,55,39],subpackag:55,lower:[47,35,36,51],sha1:41,lib:[31,26],discourag:[14,3,21],older:[14,64,55,58,39,28],find_packag:55,entri:[33,16,17,9,37,60,55,19,61,35,63,32],parenthes:41,expens:53,endfor:[3,61,27,44],the_fil:1,blurprint:3,explan:[1,26],from:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,17,18,24,21,22,23,19,25,26,27,28,29,30,31,32,34,35,36,20,38,39,40,43,44,64,47,48,49,50,51,53,55,56,57,58,59,60,61,45,63],morsel:3,zaplet:50,collabor:14,mysql:31,love:34,question:[64,0,36,20,3,5,57,7,26,32],move:[18,20,21,39,40,3,25,26,43,29,62,12,45],make_config:3,cur:[14,57,32],code_or_except:3,restructuredtext:41,instance_rel:3,theoret:[45,5],eager:[21,1],armin:50,input:[14,1,5,61,26,27,44,28],desc:[41,32],init_jinja_glob:[3,51],bin:[64,40,25,49,39],vendor:5,transpar:1,big:[15,38,17,36,3,23,48,7,43,45],f0d6d6:16,forbidden:24,nginx:[52,62,39],reitz:50,page_not_found:[24,3,1],bit:[34,49,20,53,39,26,43,28,62,45,63],characterist:14,httpexcept:[24,3],onmouseov:45,template_context_processor:3,marian:50,signal:[15,38,17,51,3,23,6],threadsaf:[1,36],show_user_profil:1,resolv:[3,41,43],httponli:[3,31],manifest:55,intellij:1,gretel:8,api:[14,15,38,1,36,20,5,22,23,3,26,45,64],eee:16,flup:39,jsonifi:[45,3,26],encount:[40,5],before_request_func:3,often:[14,49,1,20,3,53,5,24,57,39,29,31],visibl:[1,18],some:[0,1,4,5,6,7,8,9,10,11,14,15,16,17,24,21,22,23,19,28,29,31,34,35,36,43,38,41,50,51,53,55,3,60,45,59],styleguid:[15,38,41],understood:41,sampl:35,"28th":51,surpris:[3,7,36],virtualenv:[14,15,38,49,64,55,31],instan:51,though:[14,47,1,60,6,7,59],pep:41,per:[48,51,21,19,56,3],libapache2:40,substitut:50,larg:[47,17,36,21,7,8,45,59],slash:[48,1,53,3,26,13],smtphandler:35,reproduc:50,requestentitytoolarg:28,patient:28,sadli:5,funcnam:35,step:[14,15,16,9,18,2,37,33,20,46,55,3,61,38,10,11,64,32],log_request:23,logrecord:35,output:[3,60],dependency_link:55,flaskclient:3,idx:57,materi:50,license_nam:41,simple_pag:47,exc_info:[3,35],block:[1,61,40,60,39,22,23,24,3,7,26,44,25,10,62,42,13],plan:[14,36],"__future__":[14,10],real:[41,3,22,23,34,30],accept_to:27,visit:45,within:[47,17,49,1,36,51,3,11,12,13],"_add_numb":26,keystrok:30,contributor:50,occour:3,occupi:31,inclus:3,span:[3,41,26],spam:36,fledg:28,sock:[62,39],stylesheet:[16,61,42],submit:[1,21,61,27,44,28,45],custom:[15,38,35,1,2,51,3,21,23,24,6,45,13],pocoo:[15,38,41,50],suit:[14,60,9],forward:[13,36,39,22,23,56,3,27,31],xpath:7,doctyp:[1,42,61,5,44,28],fishi:1,server1:64,server2:64,navig:[1,26],serif:16,link:[14,15,47,0,50,36,51,3,55,21,5,24,6,61,26,45,42],translat:1,newer:[15,38,21],http_x_fhost:22,line:[14,64,41,35,18,3,21,5,22,40,6,39,8,11],populate_request:3,utf:[3,41,8],consist:[41,9,1,37,51,21,3,31],caller:20,pkg_add:40,function_cal:41,"export":[31,45,3,21],booleanfield:27,curv:17,constant:41,user1:40,flask_sqlite3:14,capit:14,doesn:[49,7],repres:[3,31],chap:24,septemb:51,guarante:[11,6,3],buffer:[3,59,8],titl:[9,1,37,60,5,24,61,42,44,28,32],xb0:31,invalid:[1,60,21,42,5,44,32],actuali:3,declar:[41,2,20,55,19,3,7,26,45,63],nav:5,librari:[1,4,5,3,7,8,14,15,17,22,23,19,26,27,28,35,36,40,64,38,49,51,55],nice:[14,1,31,53,21,24,28,12],draw:5,clean:[21,51],mongodb:19,svn:21,land:7,mimetyp:[0,1,51,21,3,45,59],svg:[50,5],confirm:27,virtualhost:40,dot:[47,41,49,53,21,19,3,30,31],leak:[3,6],far:[9,36,60,61,6,7,8,35,30,12],xbf:31,hello:[14,15,38,41,1,53,60,5,43,3,7,8],cached_properti:30,pluggabl:[15,47,51,20,38,3,7],code:[1,2,3,60,5,6,7,8,11,13,14,15,17,18,19,20,21,23,24,26,27,28,29,30,31,33,34,35,36,37,38,39,40,64,47,41,50,51,53,55,56,57,61,45,63],partial:[13,36],x95:1,x96:1,queri:[41,35,1,2,20,3,55,21,5,19,57,26,63,32],urandom:1,"0x103dc8090":3,ridicul:26,compact:5,procur:50,elsewher:23,friendli:1,send:[15,38,35,1,51,3,60,23,24,6,26,8,28,45,59],becam:26,aris:[21,50],sent:[1,23,3,26,45,11,59],unzip:64,distribute_setup:55,mous:45,x9c:31,facebook:45,implicitli:[3,6,31],userview:20,tri:[35,51,21,5,3,8,45],magic:[11,64,6,44],button:49,scalabl:22,michael:50,unquot:[45,5],allowed_extens:28,yourapplication_mod:31,freed:7,rack:7,databaseerror:3,x01o:1,malici:[36,22],impli:[50,27],smaller:43,fortun:45,readabl:[14,3,35],natur:17,focu:18,video:5,instnac:[],download:[14,49,51,55,21,5,3,58,26,63],before_request:[14,51,3,60,23,6,57,29,11],fullnam:64,py_modul:14,odd:[35,51],click:[49,26],get_user_for_prefix:48,compat:[49,2,36,51,21,5,19,3,58,55],index:[47,41,1,3,53,21,5,23,24,56,6,7,26,43,44,30,12,42],handle_except:[3,6],compar:[45,41],access:[1,60,3,7,12,13,14,15,6,23,24,27,28,31,18,38,40,44,64,47,41,49,57,61,63],importerror:[3,39],secret_pag:53,get_user_for_subdomain:48,led:51,chose:[64,31,9],fabfil:[64,2],bodi:[16,1,5,23,24,3,61,26,44,42],logout:[33,60,61,1,32],ubuntu:[40,49],striptag:[3,1],becom:[15,47,17,35,1,36,60,38,5,43,3,7,27,31],implicit:[21,45,7,20],convert:[1,2,20,3,53,55,40,6,26,43,30,32,13],activate_thi:40,mailinglist:[14,17],pretti:[14,53,3,60,1],metanav:[16,61],jinja_env:[3,13,59],larger:[64,15,47,17,9,43,2,60,21,38,5,48,7,55,27,28,11,63],technolog:[15,38,36,5],later:[14,46,47,35,18,31,21,55,24,3,26,28,49,10,12],log_except:[23,3],file_wrapp:3,counterapi:3,query_db:57,typic:[14,58,27],explain:[28,64,49,1,20],chanc:[33,49,2,36,3,6,35],cee5f5:16,florent:50,danger:[28,15,38,45,36],appli:[49,1,50,20,55,53,21,39,3,7,26],app:[0,1,3,4,6,7,10,11,12,13,14,24,21,22,23,19,25,26,27,28,29,30,31,32,34,35,18,20,39,40,43,44,64,47,48,51,52,53,56,57,60,59,62,63],foundat:[7,36],base_url:3,apt:[40,49],expect:[14,64,17,54,21,5,3,7,28],"boolean":5,session_cookie_httponli:[3,31],pw_hash:41,"377ba8":16,kenneth:50,zip:[14,21,55,51],commun:[15,38,17,39,36],doubl:[3,45,17,49,41],upgrad:[15,38,21,36,51],next:[1,2,3,10,11,14,21,19,28,30,31,32,18,41,43,44,64,48,49,53,55,6],websit:[14,17,0,27,19,5,24,61,26,8,45,63],few:[14,59,18,27,36,3,21,5,22,24,6,7,26,8,49,45,63],usr:[31,25,39],postprocess:[3,21],flask_someth:14,null_session_class:3,simpler:[62,39,51],start:[1,60,5,6,7,10,14,15,17,18,21,22,23,25,28,29,31,32,33,34,36,20,39,40,42,45,46,49,52,3,58,61,62,63,64],sort:[35,21,7],clever:[49,45,12,36],rich:13,src:[45,26],ap2:40,whiski:51,trail:[3,41,1],agent:5,cheeseshop:55,starter:18,executescript:[10,57],account:[49,7],redirect_to:0,alia:[3,39],cumbersom:1,annoi:56,obvious:[64,47,7,1,13],meet:7,control:[64,15,38,35,1,40,3,51,21,5,24,6,49,45,31,13],sqlite:[14,15,38,1,2,37,33,57,10,31,63,32],malform:[1,51],quickstart:[15,38,3,1],objectid:19,process:[14,3,17,49,36,40,55,52,51,5,22,23,19,6,7,39,27,48,11,12],lock:48,sdist:64,sudo:49,unguess:3,high:[45,2,22],tag:[0,13,51,42,3,5,28,45,26],test_messag:60,login_requir:53,tarbal:[64,55],cygwin:21,lighttpdcgirootfix:[1,39],unus:51,surfac:7,my_macro:13,gaememcachedcach:4,georg:50,subdirectori:36,instead:[1,4,5,57,7,14,21,23,24,29,30,31,60,35,36,20,40,41,43,47,48,49,51,55,3,58,59,45,63],close_db_connect:23,chri:50,static_path:3,follow_redirect:60,flaskrtestcas:60,overridden:3,singular:10,stop:[3,1],trap_bad_request_error:[3,31],await:5,attent:[1,36],pydev:1,flaskext_compat:58,alloc:7,"_preserve_context":3,bind:[14,47,1,51,3,39,22,6,7,26,62,31,63],"0x104efdc50":[],get_appl:48,correspond:[47,49,1],element:[1,42,5,27,45,26],issu:[17,35,36,51,21,22,23,34,7,45],allow:[9,1,60,5,3,61,10,11,18,22,23,28,31,34,36,40,48,42,41,51,53,55,45,63],get_cookie_domain:3,fallback:[3,26],elif:[53,32],insight:14,test_login_logout:60,comma:35,my_sign:[23,6],securecooki:3,perfect:[51,34,31,26,48],chosen:51,whether:[3,50,51],get_flashed_messag:[1,51,3,61,44,13],therefor:1,pixel:0,template_rend:[23,3],crash:35,greater:31,python:[1,3,4,6,7,8,10,11,13,14,15,17,18,21,22,19,25,26,27,31,33,34,35,36,38,39,40,43,46,47,48,49,51,53,55,57,60,62,64],db_session:[63,27],extra_arg:14,innermost:53,dai:[19,3],tellingen:50,mention:[64,1,20,53,55,3,45,31],get_expiration_tim:3,overkil:64,front:51,unregist:47,environbuild:3,somewher:[14,1,40,4,39,24,56,28],auto:[16,3],update_template_context:[3,59],autoflush:63,get_connect:57,trap:[3,51],truth:[3,60],"2em":16,reserv:[41,50],circular:[14,43],from_object:[64,19,3,31,18],"0x104dd1c10":[],intellig:[9,1],chunk:[28,21],sessionmak:63,filehandl:35,item_valu:41,"static":[46,15,16,0,1,36,51,55,61,21,47,39,3,7,26,43,38,42],our:[14,46,9,1,36,60,18,19,26,28,45,11,64],patch:[45,17,21,50,41],x8b83:31,special:[1,50,3,5,19,6,57,26,8,61,11,31,13],out:[9,1,60,3,7,8,0,10,13,14,15,17,18,21,23,25,26,27,28,30,31,32,33,35,36,39,40,41,43,45,64,38,48,50,51,56,61,62],variabl:[64,41,35,1,18,51,3,21,39,57,23,6,7,26,43,49,31,13],matt:50,reload:[64,1,52,40,3,31],before_app_request:3,session_cookie_path:[3,31],identifi:60,trickier:49,categori:[3,51,21,2,44],thoma:50,rel:[47,0,1,21,5,3,7,39,61,31,42],request_finish:[23,3],leverag:13,plural:10,clone:49,red:44,shut:11,umbrella:5,insid:[14,46,48,49,1,18,51,39,40,3,25,26,43,44,7,62,13],standalon:18,create_jinja_environ:[3,21,51],dictionari:[1,53,21,23,19,56,3,28,32,31,13],releas:[14,15,38,64,51,21],likelihood:36,afterward:[11,31],etern:24,captured_templ:23,indent:41,unwant:3,could:[14,64,47,34,35,1,3,31,44,21,57,56,6,7,26,48,45,12],ask:[28,3,1,32],keep:[1,3,4,6,10,13,14,15,17,18,22,23,24,30,31,34,35,36,20,40,38,41,49,53,55,57,60,45,59],length:[19,41,31,27],simplexml:14,outsid:[14,1,51,60,3,31],retain:50,endors:50,blown:48,qualiti:[64,21],scene:[11,6],sessioninterfac:3,mai:[0,1,50,51,21,5,19,7,42],overwrit:1,owner:50,prioriti:47,forgeri:[15,38,45],"long":[41,50,36,5,19,3,8,28,45,31],iter_all_row:59,unknown:[3,60,1],licens:[14,15,38,17,50,41],perfectli:[35,5],mkdir:[64,49],system:[1,42,6,7,8,10,13,14,15,17,21,29,30,31,35,18,20,39,40,44,38,49,51,53,55,3,63],messag:[15,38,35,1,2,51,60,21,18,5,24,3,61,27,44,32],attach:[14,35,1,20,51,21,3,29,45,31],attack:[45,57,36],request_class:3,stephan:50,termin:35,"final":[14,64,9,1,18,23,3,61,49,10,31],wizard:[],shell:[15,38,34,49,1,18,3,6,57,10,31],wtfpl:14,ming32:21,real_nam:41,juli:51,shallow:3,"1em":16,rst:58,textfield:27,nobodi:[14,35],secure_filenam:[28,1],got_first_request:3,bother:55,emac:8,structur:[14,64,19,3,45,31],charact:[41,1,5,19,3,61,8,13],probe:36,try_fil:[62,39],sens:[35,1,20,39,56,6,9,11,63,13],disband:5,seriou:49,extensionnam:[14,3],other:[1,60,5,6,7,8,10,11,14,15,19,20,21,22,23,24,25,26,29,30,31,32,34,35,36,37,38,39,43,45,47,48,49,50,52,53,55,3,58,62,59],steep:17,counter:[3,45,17,21],terribl:24,find_on:19,have:[1,3,4,5,6,7,8,10,11,12,13,14,17,18,24,21,23,19,25,26,27,28,30,31,32,33,34,35,36,20,39,40,41,43,44,45,64,47,48,49,51,52,53,54,55,56,57,58,59,60,61,62,63],tabl:[34,37,5,19,10,63],need:[0,1,3,60,5,6,7,8,10,11,13,14,21,22,19,25,26,28,29,30,31,32,33,34,18,37,39,40,46,41,49,53,57,62,63],turn:14,border:16,show_the_login_form:1,get_annoying_nam:41,"0x104da5ad0":[],rout:[14,15,47,0,1,20,53,38,43,56,3,7,26,27,44,28,30,12,59,32],roul:3,which:[1,4,5,6,7,8,10,12,14,15,17,18,21,22,23,25,26,27,28,30,31,33,34,35,36,20,38,39,40,41,42,44,45,64,47,48,49,51,55,56,3,60,61,62,59],mit:14,singl:[51,41,1,36,37,3,20,21,40,56,57,7,45,11,31],uppercas:[3,41,31,18],fastcgi_param:39,unless:[14,1,36,51,55,23,3,61,10,45,13],freebsd:40,clash:41,deploy:[64,15,38,48,49,2,52,39,40,25,55,62,31],endmacro:[3,27],who:28,campel:50,deploi:[64,15,38,35,2,39,22,40,25,55,62,31],create_app:[48,12],pyc:[43,51],segment:41,why:[14,15,47,17,35,1,36,31,38,5,19,3,7,39,28,45,12,63],urg:[14,21],url:[1,2,6,7,8,14,15,24,25,26,28,30,20,38,39,45,47,48,51,53,55,56,3,61,62],setlevel:35,request:[0,1,2,3,60,6,7,10,11,12,13,14,15,18,21,23,24,26,27,28,29,30,31,32,33,34,35,36,20,38,44,47,48,51,53,56,57,61,45,63],wtform:[15,38,27,2],enlist:[14,55],pipe:10,deni:[40,1],determin:[7,5],"_id":19,rakia:51,fact:[14,47,35,36,20,21,7],dbm:19,simplecach:4,text:[33,16,41,9,1,50,37,59,63,60,5,3,61,26,8,44,35,45,32,42,13],get_template_nam:20,connect:[9,1,2,4,3,7,10,11,14,15,21,22,23,19,32,33,34,35,18,64,38,51,57,60,63],bring:17,xd5:1,xd1:1,fear:55,cache_timeout:3,trivial:22,anywai:[55,35,13,8],setter:45,the_usernam:57,uwsgi_pass:62,locat:[14,64,47,35,1,51,55,21,39,40,3,58,26,28,10,31,62,42],should:[0,1,4,5,6,7,8,14,15,17,18,21,23,26,28,31,60,35,36,40,43,64,38,41,49,51,52,53,55,3,58,61,45],prolong:6,won:[17,35,1,36,3,21,55,57,7,26,45],suppos:[6,58,1,5,51],"5px":16,"__tablename__":63,werkzeug:[15,17,49,1,36,51,3,53,4,22,48,7,8,28,60,30,31],local:[64,15,38,17,1,36,51,3,60,21,39,40,6,7,25,62,31],themodul:35,ocur:3,contribut:[17,2],beat:5,approv:[14,15,38,41],myview:[3,20],pypi:[14,4,55,26,27,63],bear:11,autom:[60,21,55,36,54],csrf:[15,38,45],enabl:[49,1,18,51,21,39,3,61,10,31,30,59,13],organ:11,upper:41,fixer:[1,22],hypothetical_flask:7,stuff:[45,34,1],she:[28,32],contain:[47,41,35,1,50,55,60,42,40,3,61,5],"__html__":3,view:[0,1,2,60,6,11,12,14,15,24,26,27,29,30,32,33,18,20,38,43,47,51,53,56,3,59],shortcom:17,knowledg:[28,3,31],displai:[35,1,5,24,3,61,44,28],temporarili:[23,6,60,13,51],multipart:[28,1],stack:[6,51,21,3,7,31],syntact:60,statu:[15,38,1,36,60,24,3,31],correctli:24,mainli:3,tend:[60,39],favor:3,written:[64,45,50,22],progress:[28,2],neither:1,bunch:[29,56],email:[14,35,19,3,27,45,63],hash:41,mail_handl:35,blinker:[23,3,51],kei:[51,41,1,18,37,53,4,5,61,3,60,26,28,29,32,31,42,13],open_instance_resourc:[3,31],calculate_valu:4,tempfil:[28,60],job:[3,42],entir:[45,48,60,36],rare:51,"0x103937fd0":[],disconnect:23,thumb:8,admin:[47,35,18,60,21,19,3,44,49,45,12,63],joke:36,equal:[45,41],wsgiref:25,etc:[14,64,34,50,51,3,12,41,26,31],instanc:[1,3,7,12,14,15,22,23,24,29,31,20,38,40,41,47,48,51,53,56,6,58],uncaught:24,wirtel:50,html5:[28,15,38,5],comment:[15,38,41,33],endwith:44,guidelin:14,edgemon:50,arriv:[23,26],chmod:39,distinguish:0,make_default_options_respons:[3,51],googleapi:26,quit:[14,64,49,1,2,37,3,5,22,36,6,7,26,43,28,59],divid:[15,43],tort:50,addition:[47,13,60,21,23,3],obstacl:17,compon:[29,47,3,51],json:[15,38,13,2,51,21,3,26,45],write_fil:8,treat:[3,31,6,7,5],immedi:[3,34,41],"h\u00e4nsel":8,infrastructur:[64,7],yournam:35,autoescap:[15,38,13,51,21,3,7,61],both:[14,41,49,1,22,56,3,62,31,13],protect:[40,45,41,36,5],deliber:36,togeth:[17,11,26,63],present:[1,50,5,13,3,7,45,32],delimit:49,plain:[24,6],align:[16,41],rate_limit:20,xicluna:50,cursor:[14,10,57,32],defin:[14,64,17,1,18,20,3,53,51,5,19,34,39,27,45,63,10,30,42],sebastien:50,contextlib:[23,10,57],endblock:[24,61,42,44],layer:[47,48,2,36,19,3,7,63],customiz:[51,20],tar:64,almost:[14,28],"__import__":[],site:[15,38,13,36,55,53,42,40,26,28,45,2,31],middlewar:[15,38,48,1,39,22,3,7,12,59],archiv:[55,2],textfil:45,lightweight:26,prose:[15,38],incom:[15,38,35,51,22,3,28,31],revis:1,tojson:[3,13,26],scienc:7,handle_user_except:3,denial:45,let:[14,46,9,18,20,53,60,21,39,25,26,43,28,49,31,32],welcom:[15,42],parti:[14,45],cross:[15,38,13,36,51,3,28,45,31],member:41,matthew:50,flaskr:[46,15,38,60,9,18,33,37,61,10],gui:53,flaskr_test:60,multidict:3,infer:47,difficult:49,http:[14,46,60,49,1,50,20,3,55,51,42,22,24,6,61,26,8,62,31,45,27],redirect_url:6,fastcgi_script_nam:39,"8em":16,effect:1,handi:[34,1,18,24,6,57,26,12],logfil:35,canva:5,build:[15,47,1,38,42,3,7,32],decoupl:23,distutil:55,tighter:3,default_app:48,com:[14,64,48,35,50,3,55,40,6,26,49,45],well:[0,1,4,5,3,7,8,13,14,17,18,24,21,22,23,19,28,31,32,64,60,35,36,20,46,47,41,49,50,51,56,61,63],concis:[],cgihandl:25,set_cooki:[29,3,1],exampl:[0,1,2,3,4,5,6,7,8,10,11,12,13,14,17,24,21,22,23,19,25,26,27,28,29,31,32,33,60,35,36,20,39,40,41,42,43,44,64,48,50,51,53,54,55,57,45,63],command:[64,34,49,18,21,55,22,6,58,10,31,62],setq:8,choos:[49,18],undefin:[23,7],outgrow:30,audio:5,loss:50,draconian:5,latest:[64,49,5],unari:41,xee:31,newest:[9,32],"27th":51,less:[24,17,9,60],"0x1027bcf50":[],heavili:35,simultan:22,web:[0,1,2,5,3,7,8,9,14,15,17,22,26,28,31,36,20,38,39,47,49,50,53,45],jinja:[15,38,1,21,5,3,7,26,8,61,45,42,13],field:27,onward:[64,34,6],makefil:64,add:[9,1,3,4,5,6,61,0,10,12,14,16,17,18,21,26,27,28,31,32,33,60,36,40,43,44,64,49,51,53,54,55,57,58,63],cleanup:3,compet:14,logger:[35,1,51,21,23,3,31],kick:[6,51,23,3,26,49],jython:51,use_dot_not:19,webpag:42,piec:[45,6,21,59],is_endpoint_expect:56,camelcas:41,realiz:[28,17],know:[14,64,1,36,3,60,55,23,24,6,7,26,8,28,45,11,31],xe3:1,password:[41,1,18,60,61,27,44,32],recurs:[45,55],mkstemp:60,python3:36,python2:31,insert:[19,63,13,27,32],resid:14,like:[1,3,4,5,6,7,8,12,13,14,15,17,24,21,22,23,19,25,26,27,28,30,31,32,34,35,36,20,38,39,41,42,43,45,64,47,48,49,53,55,56,57,60,62,63],lost:[14,24,3,1],incred:17,securecookiesess:3,microblog:33,anyth:[14,36,60,21,40,7,8,45],necessari:[14,47,41,13,3,31,39,60,21,5,6,57,26,27,29,10,12,45,63],lose:[3,7,5],soft:41,page:[9,1,2,60,5,6,61,13,15,16,24,26,27,32,35,18,20,47,42,38,48,50,51,53,55,3,45,59],stdin:6,revers:[9,1,51,21,56,3,13],captur:[64,45],flask_foo:[14,58],linux:[49,3,31],flaskext_foo:14,gevent:[52,22],with_stat:10,flush:59,proper:[34,51,3,21,5,40,41,7],home:28,peter:60,transport:26,tmp:[64,18,39,10,62,63],trust:[28,9,1,22],pkgsrc:40,lead:[35,13,50,21,5,3],broad:1,avoid:[14,41,0,21,3,29,45],leav:[10,60,0,18,36],blueprintsetupst:3,mode:[15,38,35,1,18,51,3,21,23,6,49,31],preload:31,encourag:[23,21,63],acronym:41,autoincr:37,usag:[34,2,3,27,31,59],wsgirestrictstdout:40,symlink:[64,40],host:[64,48,1,51,22,3,31],full_dispatch_request:[3,6],nutshel:3,obei:5,offset:41,user_id:[57,20],panel:8,about:[1,5,6,7,8,13,14,15,17,21,23,19,26,27,28,31,32,35,36,20,44,38,49,51,52,56,3,63],actual:[1,4,5,3,7,12,14,24,28,30,31,32,60,35,18,20,43,64,47,49,52,53,55,6],justin:50,world:[1,8,19,3,7,43,31,53],testsuit:[64,21],column:[19,41,63,42,32],fastcgi_pass:39,harder:[21,31,7,55],remote_app:14,lifecycl:6,constructor:[47,1,21,3,45,31],discard:14,frontend_app:48,disabl:[1,18,60,21,39,40,3,31,13],own:[14,64,48,49,1,51,3,53,21,22,23,56,41,7,45,31,13],do_the_login:1,inlin:[41,5],builtin:[15,38,48,35,51,52,21,23,41,45,31],easy_instal:[15,38,49,21,55,58],automat:[1,4,3,7,8,13,14,15,20,21,19,34,35,37,40,64,38,51,52,53,55,56,60,45,63],warranti:50,guard:40,index_templ:12,pointless:1,"_formhelp":27,merg:13,combinedmultidict:3,w3c:5,van:50,val:26,pictur:26,much:[14,64,17,35,36,20,3,5,57,6,7,28,41,31,59],inner:[41,59,43],"var":[64,1,39,40,3,45,31],"function":[1,2,3,4,6,7,10,11,12,13,14,15,17,24,21,23,19,26,27,28,29,30,31,32,33,34,35,36,20,38,40,41,43,44,64,47,48,51,53,55,56,57,58,59,60,61,45,63],simplejson:[3,26],brand:0,subscrib:[23,15,38,3],add_url_rul:[0,51,20,3,28,30],keyerror:1,gain:43,uninstal:31,oauth:14,eas:21,highest:32,bug:[21,1,39,51],taglin:5,made:[24,31,21],wise:18,tab:[49,41,0,8],yourapplication_config:64,reverse_filt:13,sgml:5,troubl:[7,36],asynchron:7,record:[47,35,1,23,3,44],below:[48,1,50,3,56,6,43,10,11],limit:[17,50,36,51,3,41,7,8,28,31],otherwis:[14,48,1,50,3,53,4,43,41,60,27,28,45,11,63,32],problem:[14,35,1,36,40,51,21,18,39,43,19,3,7,26,8,28,49,30,31,45,13],"catch":[45,3,21,1,60],evalu:[45,3,7,59,42],collis:21,"int":[3,20,1,26],descript:[14,41,35,1,20,24,57],dure:[35,1,36,51,3,52,60,23,6,49,31],filenam:[47,0,1,51,55,21,42,40,3,61,26,8,28,35,31],url_rule_class:3,implement:[14,47,17,1,36,19,3,53,20,21,51,5,57,24,6,7,43,48,28,12],ini:18,pip:[14,58,49,55],probabl:[64,35,1,36,54,55,53,60,21,5,40,3,7,26,8,44,28,49],charpoint:8,nonetheless:26,ecmascript:45,boot:39,detail:[14,15,41,1,50,39,21,5,3,7,26,45,31,64],virtual:[64,40,52,51],routing_except:3,functionc:[],book:5,lookup:[3,55],futur:[1,36,54,51,21,5,3],rememb:[14,48,1,52,53,39,43,3,7,27,28,29],varieti:[49,8],log_the_user_in:1,user_api:20,will_not_be_escap:13,servernam:[64,40],repeat:27,star:34,sooner:[24,35,55],"class":[1,60,5,3,7,14,15,17,21,22,23,19,27,30,31,20,41,42,44,38,48,51,61,63],june:51,render_template_str:3,kinda:[19,45],throughout:17,singleton:[40,41],debian:40,serial:[45,3],stai:[1,36],match_request:3,multithread:3,sphinx:[14,41],get_cookie_path:3,reliabl:[28,51],root_path:[31,47,3,0],rule:[15,47,41,49,1,20,3,53,51,38,5,6,58,26,8,28,30,45],portion:[35,42],show_post:[3,1],decemb:51,getlogg:35},objtypes:{"0":"py:module","1":"py:function","2":"py:method","3":"py:attribute","4":"py:class","5":"py:data","6":"py:classmethod"},titles:["Adding a favicon","Quickstart","Patterns for Flask","API","Caching","HTML/XHTML FAQ","The Request Context","Design Decisions in Flask","Unicode in Flask","Introducing Flaskr","Step 3: Creating The Database","Step 4: Request Database Connections","Application Factories","Templates","Flask Extension Development","Welcome to Flask","Step 7: Adding Style","Becoming Big","Step 2: Application Setup Code","MongoKit in Flask","Pluggable Views","Upgrading to Newer Releases","Other Servers","Signals","Custom Error Pages","CGI","AJAX with jQuery","Form Validation with WTForms","Uploading Files","Deferred Request Callbacks","Lazily Loading Views","Configuration Handling","Step 5: The View Functions","Tutorial","Working with the Shell","Handling Application Errors","Foreword","Step 1: Database Schema","Flask Documentation","FastCGI","mod_wsgi (Apache)","Pocoo Styleguide","Template Inheritance","Larger Applications","Message Flashing","Security Considerations","Step 0: Creating The Folders","Modular Applications with Blueprints","Application Dispatching","Installation","License","Flask Changelog","Deployment Options","View Decorators","Bonus: Testing the Application","Deploying with Distribute","Using URL Processors","Using SQLite 3 with Flask","Flask Extensions","Streaming Contents","Testing Flask Applications","Step 6: The Templates","uWSGI","SQLAlchemy in Flask","Deploying with Fabric"],objnames:{"0":"Python module","1":"Python function","2":"Python method","3":"Python attribute","4":"Python class","5":"Python data","6":"Python class method"},filenames:["patterns/favicon","quickstart","patterns/index","api","patterns/caching","htmlfaq","reqcontext","design","unicode","tutorial/introduction","tutorial/dbinit","tutorial/dbcon","patterns/appfactories","templating","extensiondev","index","tutorial/css","becomingbig","tutorial/setup","patterns/mongokit","views","upgrading","deploying/others","signals","patterns/errorpages","deploying/cgi","patterns/jquery","patterns/wtforms","patterns/fileuploads","patterns/deferredcallbacks","patterns/lazyloading","config","tutorial/views","tutorial/index","shell","errorhandling","foreword","tutorial/schema","latexindex","deploying/fastcgi","deploying/mod_wsgi","styleguide","patterns/templateinheritance","patterns/packages","patterns/flashing","security","tutorial/folders","blueprints","patterns/appdispatch","installation","license","changelog","deploying/index","patterns/viewdecorators","tutorial/testing","patterns/distribute","patterns/urlprocessors","patterns/sqlite3","extensions","patterns/streaming","testing","tutorial/templates","deploying/uwsgi","patterns/sqlalchemy","patterns/fabric"]}) \ No newline at end of file
diff --git a/app/static/doc/flask-docs/security.html b/app/static/doc/flask-docs/security.html
new file mode 100644
index 0000000..f118cd2
--- /dev/null
+++ b/app/static/doc/flask-docs/security.html
@@ -0,0 +1,260 @@
+
+<!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>Security Considerations &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="index.html" />
+ <link rel="next" title="Unicode in Flask" href="unicode.html" />
+ <link rel="prev" title="HTML/XHTML FAQ" href="htmlfaq.html" />
+
+
+ <link rel="apple-touch-icon" href="_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <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="unicode.html" title="Unicode in Flask"
+ accesskey="N">next</a> |</li>
+ <li class="right" >
+ <a href="htmlfaq.html" title="HTML/XHTML FAQ"
+ accesskey="P">previous</a> |</li>
+ <li><a href="index.html">Flask 0.8 documentation</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="security-considerations">
+<h1>Security Considerations<a class="headerlink" href="#security-considerations" title="Permalink to this headline">¶</a></h1>
+<p>Web applications usually face all kinds of security problems and it&#8217;s very
+hard to get everything right. Flask tries to solve a few of these things
+for you, but there are a couple more you have to take care of yourself.</p>
+<div class="section" id="cross-site-scripting-xss">
+<span id="xss"></span><h2>Cross-Site Scripting (XSS)<a class="headerlink" href="#cross-site-scripting-xss" title="Permalink to this headline">¶</a></h2>
+<p>Cross site scripting is the concept of injecting arbitrary HTML (and with
+it JavaScript) into the context of a website. To remedy this, developers
+have to properly escape text so that it cannot include arbitrary HTML
+tags. For more information on that have a look at the Wikipedia article
+on <a class="reference external" href="http://en.wikipedia.org/wiki/Cross-site_scripting">Cross-Site Scripting</a>.</p>
+<p>Flask configures Jinja2 to automatically escape all values unless
+explicitly told otherwise. This should rule out all XSS problems caused
+in templates, but there are still other places where you have to be
+careful:</p>
+<ul class="simple">
+<li>generating HTML without the help of Jinja2</li>
+<li>calling <a class="reference internal" href="api.html#flask.Markup" title="flask.Markup"><tt class="xref py py-class docutils literal"><span class="pre">Markup</span></tt></a> on data submitted by users</li>
+<li>sending out HTML from uploaded files, never do that, use the
+<cite>Content-Disposition: attachment</cite> header to prevent that problem.</li>
+<li>sending out textfiles from uploaded files. Some browsers are using
+content-type guessing based on the first few bytes so users could
+trick a browser to execute HTML.</li>
+</ul>
+<p>Another thing that is very important are unquoted attributes. While
+Jinja2 can protect you from XSS issues by escaping HTML, there is one
+thing it cannot protect you from: XSS by attribute injection. To counter
+this possible attack vector, be sure to always quote your attributes with
+either double or single quotes when using Jinja expressions in them:</p>
+<div class="highlight-html+jinja"><div class="highlight"><pre><span class="nt">&lt;a</span> <span class="na">href=</span><span class="s">&quot;</span><span class="cp">{{</span> <span class="nv">href</span> <span class="cp">}}</span><span class="s">&quot;</span><span class="nt">&gt;</span>the text<span class="nt">&lt;/a&gt;</span>
+</pre></div>
+</div>
+<p>Why is this necessary? Because if you would not be doing that, an
+attacker could easily inject custom JavaScript handlers. For example an
+attacker could inject this piece of HTML+JavaScript:</p>
+<div class="highlight-html"><div class="highlight"><pre>onmouseover=alert(document.cookie)
+</pre></div>
+</div>
+<p>When the user would then move with the mouse over the link, the cookie
+would be presented to the user in an alert window. But instead of showing
+the cookie to the user, a good attacker might also execute any other
+JavaScript code. In combination with CSS injections the attacker might
+even make the element fill out the entire page so that the user would
+just have to have the mouse anywhere on the page to trigger the attack.</p>
+</div>
+<div class="section" id="cross-site-request-forgery-csrf">
+<h2>Cross-Site Request Forgery (CSRF)<a class="headerlink" href="#cross-site-request-forgery-csrf" title="Permalink to this headline">¶</a></h2>
+<p>Another big problem is CSRF. This is a very complex topic and I won&#8217;t
+outline it here in detail just mention what it is and how to theoretically
+prevent it.</p>
+<p>If your authentication information is stored in cookies, you have implicit
+state management. The state of &#8220;being logged in&#8221; is controlled by a
+cookie, and that cookie is sent with each request to a page.
+Unfortunately that includes requests triggered by 3rd party sites. If you
+don&#8217;t keep that in mind, some people might be able to trick your
+application&#8217;s users with social engineering to do stupid things without
+them knowing.</p>
+<p>Say you have a specific URL that, when you sent <cite>POST</cite> requests to will
+delete a user&#8217;s profile (say <cite>http://example.com/user/delete</cite>). If an
+attacker now creates a page that sends a post request to that page with
+some JavaScript they just has to trick some users to load that page and
+their profiles will end up being deleted.</p>
+<p>Imagine you were to run Facebook with millions of concurrent users and
+someone would send out links to images of little kittens. When users
+would go to that page, their profiles would get deleted while they are
+looking at images of fluffy cats.</p>
+<p>How can you prevent that? Basically for each request that modifies
+content on the server you would have to either use a one-time token and
+store that in the cookie <strong>and</strong> also transmit it with the form data.
+After receiving the data on the server again, you would then have to
+compare the two tokens and ensure they are equal.</p>
+<p>Why does Flask not do that for you? The ideal place for this to happen is
+the form validation framework, which does not exist in Flask.</p>
+</div>
+<div class="section" id="json-security">
+<span id="id1"></span><h2>JSON Security<a class="headerlink" href="#json-security" title="Permalink to this headline">¶</a></h2>
+<div class="admonition-ecmascript-5-changes admonition ">
+<p class="first admonition-title">ECMAScript 5 Changes</p>
+<p class="last">Starting with ECMAScript 5 the behavior of literals changed. Now they
+are not constructed with the constructor of <tt class="docutils literal"><span class="pre">Array</span></tt> and others, but
+with the builtin constructor of <tt class="docutils literal"><span class="pre">Array</span></tt> which closes this particular
+attack vector.</p>
+</div>
+<p>JSON itself is a high-level serialization format, so there is barely
+anything that could cause security problems, right? You can&#8217;t declare
+recursive structures that could cause problems and the only thing that
+could possibly break are very large responses that can cause some kind of
+denial of service at the receiver&#8217;s side.</p>
+<p>However there is a catch. Due to how browsers work the CSRF issue comes
+up with JSON unfortunately. Fortunately there is also a weird part of the
+JavaScript specification that can be used to solve that problem easily and
+Flask is kinda doing that for you by preventing you from doing dangerous
+stuff. Unfortunately that protection is only there for
+<a class="reference internal" href="api.html#flask.jsonify" title="flask.jsonify"><tt class="xref py py-func docutils literal"><span class="pre">jsonify()</span></tt></a> so you are still at risk when using other ways to
+generate JSON.</p>
+<p>So what is the issue and how to avoid it? The problem are arrays at
+top-level in JSON. Imagine you send the following data out in a JSON
+request. Say that&#8217;s exporting the names and email addresses of all your
+friends for a part of the user interface that is written in JavaScript.
+Not very uncommon:</p>
+<div class="highlight-javascript"><div class="highlight"><pre><span class="p">[</span>
+ <span class="p">{</span><span class="s2">&quot;username&quot;</span><span class="o">:</span> <span class="s2">&quot;admin&quot;</span><span class="p">,</span>
+ <span class="s2">&quot;email&quot;</span><span class="o">:</span> <span class="s2">&quot;admin@localhost&quot;</span><span class="p">}</span>
+<span class="p">]</span>
+</pre></div>
+</div>
+<p>And it is doing that of course only as long as you are logged in and only
+for you. And it is doing that for all <cite>GET</cite> requests to a certain URL,
+say the URL for that request is
+<tt class="docutils literal"><span class="pre">http://example.com/api/get_friends.json</span></tt>.</p>
+<p>So now what happens if a clever hacker is embedding this to his website
+and social engineers a victim to visiting his site:</p>
+<div class="highlight-html"><div class="highlight"><pre><span class="nt">&lt;script </span><span class="na">type=</span><span class="s">text/javascript</span><span class="nt">&gt;</span>
+<span class="kd">var</span> <span class="nx">captured</span> <span class="o">=</span> <span class="p">[];</span>
+<span class="kd">var</span> <span class="nx">oldArray</span> <span class="o">=</span> <span class="nb">Array</span><span class="p">;</span>
+<span class="kd">function</span> <span class="nb">Array</span><span class="p">()</span> <span class="p">{</span>
+ <span class="kd">var</span> <span class="nx">obj</span> <span class="o">=</span> <span class="k">this</span><span class="p">,</span> <span class="nx">id</span> <span class="o">=</span> <span class="mi">0</span><span class="p">,</span> <span class="nx">capture</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">value</span><span class="p">)</span> <span class="p">{</span>
+ <span class="nx">obj</span><span class="p">.</span><span class="nx">__defineSetter__</span><span class="p">(</span><span class="nx">id</span><span class="o">++</span><span class="p">,</span> <span class="nx">capture</span><span class="p">);</span>
+ <span class="k">if</span> <span class="p">(</span><span class="nx">value</span><span class="p">)</span>
+ <span class="nx">captured</span><span class="p">.</span><span class="nx">push</span><span class="p">(</span><span class="nx">value</span><span class="p">);</span>
+ <span class="p">};</span>
+ <span class="nx">capture</span><span class="p">();</span>
+<span class="p">}</span>
+<span class="nt">&lt;/script&gt;</span>
+<span class="nt">&lt;script </span><span class="na">type=</span><span class="s">text/javascript</span>
+ <span class="na">src=</span><span class="s">http://example.com/api/get_friends.json</span><span class="nt">&gt;&lt;/script&gt;</span>
+<span class="nt">&lt;script </span><span class="na">type=</span><span class="s">text/javascript</span><span class="nt">&gt;</span>
+<span class="nb">Array</span> <span class="o">=</span> <span class="nx">oldArray</span><span class="p">;</span>
+<span class="c1">// now we have all the data in the captured array.</span>
+<span class="nt">&lt;/script&gt;</span>
+</pre></div>
+</div>
+<p>If you know a bit of JavaScript internals you might know that it&#8217;s
+possible to patch constructors and register callbacks for setters. An
+attacker can use this (like above) to get all the data you exported in
+your JSON file. The browser will totally ignore the <tt class="docutils literal"><span class="pre">application/json</span></tt>
+mimetype if <tt class="docutils literal"><span class="pre">text/javascript</span></tt> is defined as content type in the script
+tag and evaluate that as JavaScript. Because top-level array elements are
+allowed (albeit useless) and we hooked in our own constructor, after that
+page loaded the data from the JSON response is in the <cite>captured</cite> array.</p>
+<p>Because it is a syntax error in JavaScript to have an object literal
+(<tt class="docutils literal"><span class="pre">{...}</span></tt>) toplevel an attacker could not just do a request to an
+external URL with the script tag to load up the data. So what Flask does
+is to only allow objects as toplevel elements when using
+<a class="reference internal" href="api.html#flask.jsonify" title="flask.jsonify"><tt class="xref py py-func docutils literal"><span class="pre">jsonify()</span></tt></a>. Make sure to do the same when using an ordinary
+JSON generate function.</p>
+</div>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="index.html">
+ <img class="logo" src="_static/flask.png" alt="Logo"/>
+</a></p>
+ <h3><a href="index.html">Table Of Contents</a></h3>
+ <ul>
+<li><a class="reference internal" href="#">Security Considerations</a><ul>
+<li><a class="reference internal" href="#cross-site-scripting-xss">Cross-Site Scripting (XSS)</a></li>
+<li><a class="reference internal" href="#cross-site-request-forgery-csrf">Cross-Site Request Forgery (CSRF)</a></li>
+<li><a class="reference internal" href="#json-security">JSON Security</a></li>
+</ul>
+</li>
+</ul>
+<h3>Related Topics</h3>
+<ul>
+ <li><a href="index.html">Documentation overview</a><ul>
+ <li>Previous: <a href="htmlfaq.html" title="previous chapter">HTML/XHTML FAQ</a></li>
+ <li>Next: <a href="unicode.html" title="next chapter">Unicode in Flask</a></li>
+ </ul></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="_sources/security.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/shell.html b/app/static/doc/flask-docs/shell.html
new file mode 100644
index 0000000..758ba0f
--- /dev/null
+++ b/app/static/doc/flask-docs/shell.html
@@ -0,0 +1,194 @@
+
+<!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>Working with the Shell &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="index.html" />
+ <link rel="next" title="Patterns for Flask" href="patterns/index.html" />
+ <link rel="prev" title="Flask Extensions" href="extensions.html" />
+
+
+ <link rel="apple-touch-icon" href="_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <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="patterns/index.html" title="Patterns for Flask"
+ accesskey="N">next</a> |</li>
+ <li class="right" >
+ <a href="extensions.html" title="Flask Extensions"
+ accesskey="P">previous</a> |</li>
+ <li><a href="index.html">Flask 0.8 documentation</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="working-with-the-shell">
+<span id="shell"></span><h1>Working with the Shell<a class="headerlink" href="#working-with-the-shell" title="Permalink to this headline">¶</a></h1>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.3.</span></p>
+<p>One of the reasons everybody loves Python is the interactive shell. It
+basically allows you to execute Python commands in real time and
+immediately get results back. Flask itself does not come with an
+interactive shell, because it does not require any specific setup upfront,
+just import your application and start playing around.</p>
+<p>There are however some handy helpers to make playing around in the shell a
+more pleasant experience. The main issue with interactive console
+sessions is that you&#8217;re not triggering a request like a browser does which
+means that <a class="reference internal" href="api.html#flask.g" title="flask.g"><tt class="xref py py-data docutils literal"><span class="pre">g</span></tt></a>, <a class="reference internal" href="api.html#flask.request" title="flask.request"><tt class="xref py py-data docutils literal"><span class="pre">request</span></tt></a> and others are not
+available. But the code you want to test might depend on them, so what
+can you do?</p>
+<p>This is where some helper functions come in handy. Keep in mind however
+that these functions are not only there for interactive shell usage, but
+also for unittesting and other situations that require a faked request
+context.</p>
+<p>Generally it&#8217;s recommended that you read the <a class="reference internal" href="reqcontext.html#request-context"><em>The Request Context</em></a>
+chapter of the documentation first.</p>
+<div class="section" id="creating-a-request-context">
+<h2>Creating a Request Context<a class="headerlink" href="#creating-a-request-context" title="Permalink to this headline">¶</a></h2>
+<p>The easiest way to create a proper request context from the shell is by
+using the <a class="reference internal" href="api.html#flask.Flask.test_request_context" title="flask.Flask.test_request_context"><tt class="xref py py-attr docutils literal"><span class="pre">test_request_context</span></tt></a> method which creates
+us a <a class="reference internal" href="api.html#flask.ctx.RequestContext" title="flask.ctx.RequestContext"><tt class="xref py py-class docutils literal"><span class="pre">RequestContext</span></tt></a>:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">ctx</span> <span class="o">=</span> <span class="n">app</span><span class="o">.</span><span class="n">test_request_context</span><span class="p">()</span>
+</pre></div>
+</div>
+<p>Normally you would use the <cite>with</cite> statement to make this request object
+active, but in the shell it&#8217;s easier to use the
+<a class="reference internal" href="api.html#flask.ctx.RequestContext.push" title="flask.ctx.RequestContext.push"><tt class="xref py py-meth docutils literal"><span class="pre">push()</span></tt></a> and
+<a class="reference internal" href="api.html#flask.ctx.RequestContext.pop" title="flask.ctx.RequestContext.pop"><tt class="xref py py-meth docutils literal"><span class="pre">pop()</span></tt></a> methods by hand:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">ctx</span><span class="o">.</span><span class="n">push</span><span class="p">()</span>
+</pre></div>
+</div>
+<p>From that point onwards you can work with the request object until you
+call <cite>pop</cite>:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">ctx</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span>
+</pre></div>
+</div>
+</div>
+<div class="section" id="firing-before-after-request">
+<h2>Firing Before/After Request<a class="headerlink" href="#firing-before-after-request" title="Permalink to this headline">¶</a></h2>
+<p>By just creating a request context, you still don&#8217;t have run the code that
+is normally run before a request. This might result in your database
+being unavailable if you are connecting to the database in a
+before-request callback or the current user not being stored on the
+<a class="reference internal" href="api.html#flask.g" title="flask.g"><tt class="xref py py-data docutils literal"><span class="pre">g</span></tt></a> object etc.</p>
+<p>This however can easily be done yourself. Just call
+<a class="reference internal" href="api.html#flask.Flask.preprocess_request" title="flask.Flask.preprocess_request"><tt class="xref py py-meth docutils literal"><span class="pre">preprocess_request()</span></tt></a>:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">ctx</span> <span class="o">=</span> <span class="n">app</span><span class="o">.</span><span class="n">test_request_context</span><span class="p">()</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">ctx</span><span class="o">.</span><span class="n">push</span><span class="p">()</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">app</span><span class="o">.</span><span class="n">preprocess_request</span><span class="p">()</span>
+</pre></div>
+</div>
+<p>Keep in mind that the <a class="reference internal" href="api.html#flask.Flask.preprocess_request" title="flask.Flask.preprocess_request"><tt class="xref py py-meth docutils literal"><span class="pre">preprocess_request()</span></tt></a> function
+might return a response object, in that case just ignore it.</p>
+<p>To shutdown a request, you need to trick a bit before the after request
+functions (triggered by <a class="reference internal" href="api.html#flask.Flask.process_response" title="flask.Flask.process_response"><tt class="xref py py-meth docutils literal"><span class="pre">process_response()</span></tt></a>) operate on
+a response object:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">app</span><span class="o">.</span><span class="n">process_response</span><span class="p">(</span><span class="n">app</span><span class="o">.</span><span class="n">response_class</span><span class="p">())</span>
+<span class="go">&lt;Response 0 bytes [200 OK]&gt;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">ctx</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span>
+</pre></div>
+</div>
+<p>The functions registered as <a class="reference internal" href="api.html#flask.Flask.teardown_request" title="flask.Flask.teardown_request"><tt class="xref py py-meth docutils literal"><span class="pre">teardown_request()</span></tt></a> are
+automatically called when the context is popped. So this is the perfect
+place to automatically tear down resources that were needed by the request
+context (such as database connections).</p>
+</div>
+<div class="section" id="further-improving-the-shell-experience">
+<h2>Further Improving the Shell Experience<a class="headerlink" href="#further-improving-the-shell-experience" title="Permalink to this headline">¶</a></h2>
+<p>If you like the idea of experimenting in a shell, create yourself a module
+with stuff you want to star import into your interactive session. There
+you could also define some more helper methods for common things such as
+initializing the database, dropping tables etc.</p>
+<p>Just put them into a module (like <cite>shelltools</cite> and import from there):</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">shelltools</span> <span class="kn">import</span> <span class="o">*</span>
+</pre></div>
+</div>
+</div>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="index.html">
+ <img class="logo" src="_static/flask.png" alt="Logo"/>
+</a></p>
+ <h3><a href="index.html">Table Of Contents</a></h3>
+ <ul>
+<li><a class="reference internal" href="#">Working with the Shell</a><ul>
+<li><a class="reference internal" href="#creating-a-request-context">Creating a Request Context</a></li>
+<li><a class="reference internal" href="#firing-before-after-request">Firing Before/After Request</a></li>
+<li><a class="reference internal" href="#further-improving-the-shell-experience">Further Improving the Shell Experience</a></li>
+</ul>
+</li>
+</ul>
+<h3>Related Topics</h3>
+<ul>
+ <li><a href="index.html">Documentation overview</a><ul>
+ <li>Previous: <a href="extensions.html" title="previous chapter">Flask Extensions</a></li>
+ <li>Next: <a href="patterns/index.html" title="next chapter">Patterns for Flask</a></li>
+ </ul></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="_sources/shell.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/signals.html b/app/static/doc/flask-docs/signals.html
new file mode 100644
index 0000000..77250d5
--- /dev/null
+++ b/app/static/doc/flask-docs/signals.html
@@ -0,0 +1,358 @@
+
+<!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>Signals &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="index.html" />
+ <link rel="next" title="Pluggable Views" href="views.html" />
+ <link rel="prev" title="Configuration Handling" href="config.html" />
+
+
+ <link rel="apple-touch-icon" href="_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <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="views.html" title="Pluggable Views"
+ accesskey="N">next</a> |</li>
+ <li class="right" >
+ <a href="config.html" title="Configuration Handling"
+ accesskey="P">previous</a> |</li>
+ <li><a href="index.html">Flask 0.8 documentation</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="signals">
+<span id="id1"></span><h1>Signals<a class="headerlink" href="#signals" title="Permalink to this headline">¶</a></h1>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.6.</span></p>
+<p>Starting with Flask 0.6, there is integrated support for signalling in
+Flask. This support is provided by the excellent <a class="reference external" href="http://pypi.python.org/pypi/blinker">blinker</a> library and
+will gracefully fall back if it is not available.</p>
+<p>What are signals? Signals help you decouple applications by sending
+notifications when actions occur elsewhere in the core framework or
+another Flask extensions. In short, signals allow certain senders to
+notify subscribers that something happened.</p>
+<p>Flask comes with a couple of signals and other extensions might provide
+more. Also keep in mind that signals are intended to notify subscribers
+and should not encourage subscribers to modify data. You will notice that
+there are signals that appear to do the same thing like some of the
+builtin decorators do (eg: <a class="reference internal" href="api.html#flask.request_started" title="flask.request_started"><tt class="xref py py-data docutils literal"><span class="pre">request_started</span></tt></a> is very similar
+to <a class="reference internal" href="api.html#flask.Flask.before_request" title="flask.Flask.before_request"><tt class="xref py py-meth docutils literal"><span class="pre">before_request()</span></tt></a>). There are however difference in
+how they work. The core <a class="reference internal" href="api.html#flask.Flask.before_request" title="flask.Flask.before_request"><tt class="xref py py-meth docutils literal"><span class="pre">before_request()</span></tt></a> handler for
+example is executed in a specific order and is able to abort the request
+early by returning a response. In contrast all signal handlers are
+executed in undefined order and do not modify any data.</p>
+<p>The big advantage of signals over handlers is that you can safely
+subscribe to them for the split of a second. These temporary
+subscriptions are helpful for unittesting for example. Say you want to
+know what templates were rendered as part of a request: signals allow you
+to do exactly that.</p>
+<div class="section" id="subscribing-to-signals">
+<h2>Subscribing to Signals<a class="headerlink" href="#subscribing-to-signals" title="Permalink to this headline">¶</a></h2>
+<p>To subscribe to a signal, you can use the
+<a class="reference external" href="http://discorporate.us/projects/Blinker/docs/1.1/api.html#blinker.base.Signal.connect" title="(in Blinker v1.1)"><tt class="xref py py-meth docutils literal"><span class="pre">connect()</span></tt></a> method of a signal. The first
+argument is the function that should be called when the signal is emitted,
+the optional second argument specifies a sender. To unsubscribe from a
+signal, you can use the <a class="reference external" href="http://discorporate.us/projects/Blinker/docs/1.1/api.html#blinker.base.Signal.disconnect" title="(in Blinker v1.1)"><tt class="xref py py-meth docutils literal"><span class="pre">disconnect()</span></tt></a> method.</p>
+<p>For all core Flask signals, the sender is the application that issued the
+signal. When you subscribe to a signal, be sure to also provide a sender
+unless you really want to listen for signals of all applications. This is
+especially true if you are developing an extension.</p>
+<p>Here for example a helper context manager that can be used to figure out
+in a unittest which templates were rendered and what variables were passed
+to the template:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">template_rendered</span>
+<span class="kn">from</span> <span class="nn">contextlib</span> <span class="kn">import</span> <span class="n">contextmanager</span>
+
+<span class="nd">@contextmanager</span>
+<span class="k">def</span> <span class="nf">captured_templates</span><span class="p">(</span><span class="n">app</span><span class="p">):</span>
+ <span class="n">recorded</span> <span class="o">=</span> <span class="p">[]</span>
+ <span class="k">def</span> <span class="nf">record</span><span class="p">(</span><span class="n">sender</span><span class="p">,</span> <span class="n">template</span><span class="p">,</span> <span class="n">context</span><span class="p">):</span>
+ <span class="n">recorded</span><span class="o">.</span><span class="n">append</span><span class="p">((</span><span class="n">template</span><span class="p">,</span> <span class="n">context</span><span class="p">))</span>
+ <span class="n">template_rendered</span><span class="o">.</span><span class="n">connect</span><span class="p">(</span><span class="n">record</span><span class="p">,</span> <span class="n">app</span><span class="p">)</span>
+ <span class="k">try</span><span class="p">:</span>
+ <span class="k">yield</span> <span class="n">recorded</span>
+ <span class="k">finally</span><span class="p">:</span>
+ <span class="n">template_rendered</span><span class="o">.</span><span class="n">disconnect</span><span class="p">(</span><span class="n">record</span><span class="p">,</span> <span class="n">app</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>This can now easily be paired with a test client:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">with</span> <span class="n">captured_templates</span><span class="p">(</span><span class="n">app</span><span class="p">)</span> <span class="k">as</span> <span class="n">templates</span><span class="p">:</span>
+ <span class="n">rv</span> <span class="o">=</span> <span class="n">app</span><span class="o">.</span><span class="n">test_client</span><span class="p">()</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;/&#39;</span><span class="p">)</span>
+ <span class="k">assert</span> <span class="n">rv</span><span class="o">.</span><span class="n">status_code</span> <span class="o">==</span> <span class="mi">200</span>
+ <span class="k">assert</span> <span class="nb">len</span><span class="p">(</span><span class="n">templates</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</span>
+ <span class="n">template</span><span class="p">,</span> <span class="n">context</span> <span class="o">=</span> <span class="n">templates</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
+ <span class="k">assert</span> <span class="n">template</span><span class="o">.</span><span class="n">name</span> <span class="o">==</span> <span class="s">&#39;index.html&#39;</span>
+ <span class="k">assert</span> <span class="nb">len</span><span class="p">(</span><span class="n">context</span><span class="p">[</span><span class="s">&#39;items&#39;</span><span class="p">])</span> <span class="o">==</span> <span class="mi">10</span>
+</pre></div>
+</div>
+<p>All the template rendering in the code issued by the application <cite>app</cite>
+in the body of the <cite>with</cite> block will now be recorded in the <cite>templates</cite>
+variable. Whenever a template is rendered, the template object as well as
+context are appended to it.</p>
+<p>Additionally there is a convenient helper method
+(<a class="reference external" href="http://discorporate.us/projects/Blinker/docs/1.1/api.html#blinker.base.Signal.connected_to" title="(in Blinker v1.1)"><tt class="xref py py-meth docutils literal"><span class="pre">connected_to()</span></tt></a>). that allows you to
+temporarily subscribe a function to a signal with is a context manager on
+its own. Because the return value of the context manager cannot be
+specified that way one has to pass the list in as argument:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">template_rendered</span>
+
+<span class="k">def</span> <span class="nf">captured_templates</span><span class="p">(</span><span class="n">app</span><span class="p">,</span> <span class="n">recorded</span><span class="p">):</span>
+ <span class="k">def</span> <span class="nf">record</span><span class="p">(</span><span class="n">sender</span><span class="p">,</span> <span class="n">template</span><span class="p">,</span> <span class="n">context</span><span class="p">):</span>
+ <span class="n">recorded</span><span class="o">.</span><span class="n">append</span><span class="p">((</span><span class="n">template</span><span class="p">,</span> <span class="n">context</span><span class="p">))</span>
+ <span class="k">return</span> <span class="n">template_rendered</span><span class="o">.</span><span class="n">connected_to</span><span class="p">(</span><span class="n">record</span><span class="p">,</span> <span class="n">app</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>The example above would then look like this:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="n">templates</span> <span class="o">=</span> <span class="p">[]</span>
+<span class="k">with</span> <span class="n">captured_templates</span><span class="p">(</span><span class="n">app</span><span class="p">,</span> <span class="n">templates</span><span class="p">):</span>
+ <span class="o">...</span>
+ <span class="n">template</span><span class="p">,</span> <span class="n">context</span> <span class="o">=</span> <span class="n">templates</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
+</pre></div>
+</div>
+<div class="admonition-blinker-api-changes admonition ">
+<p class="first admonition-title">Blinker API Changes</p>
+<p class="last">The <a class="reference external" href="http://discorporate.us/projects/Blinker/docs/1.1/api.html#blinker.base.Signal.connected_to" title="(in Blinker v1.1)"><tt class="xref py py-meth docutils literal"><span class="pre">connected_to()</span></tt></a> method arrived in Blinker
+with version 1.1.</p>
+</div>
+</div>
+<div class="section" id="creating-signals">
+<h2>Creating Signals<a class="headerlink" href="#creating-signals" title="Permalink to this headline">¶</a></h2>
+<p>If you want to use signals in your own application, you can use the
+blinker library directly. The most common use case are named signals in a
+custom <a class="reference external" href="http://discorporate.us/projects/Blinker/docs/1.1/api.html#blinker.base.Namespace" title="(in Blinker v1.1)"><tt class="xref py py-class docutils literal"><span class="pre">Namespace</span></tt></a>.. This is what is recommended
+most of the time:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">blinker</span> <span class="kn">import</span> <span class="n">Namespace</span>
+<span class="n">my_signals</span> <span class="o">=</span> <span class="n">Namespace</span><span class="p">()</span>
+</pre></div>
+</div>
+<p>Now you can create new signals like this:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="n">model_saved</span> <span class="o">=</span> <span class="n">my_signals</span><span class="o">.</span><span class="n">signal</span><span class="p">(</span><span class="s">&#39;model-saved&#39;</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>The name for the signal here makes it unique and also simplifies
+debugging. You can access the name of the signal with the
+<a class="reference external" href="http://discorporate.us/projects/Blinker/docs/1.1/api.html#blinker.base.NamedSignal.name" title="(in Blinker v1.1)"><tt class="xref py py-attr docutils literal"><span class="pre">name</span></tt></a> attribute.</p>
+<div class="admonition-for-extension-developers admonition ">
+<p class="first admonition-title">For Extension Developers</p>
+<p class="last">If you are writing a Flask extension and you want to gracefully degrade for
+missing blinker installations, you can do so by using the
+<a class="reference internal" href="api.html#flask.signals.Namespace" title="flask.signals.Namespace"><tt class="xref py py-class docutils literal"><span class="pre">flask.signals.Namespace</span></tt></a> class.</p>
+</div>
+</div>
+<div class="section" id="sending-signals">
+<h2>Sending Signals<a class="headerlink" href="#sending-signals" title="Permalink to this headline">¶</a></h2>
+<p>If you want to emit a signal, you can do so by calling the
+<a class="reference external" href="http://discorporate.us/projects/Blinker/docs/1.1/api.html#blinker.base.Signal.send" title="(in Blinker v1.1)"><tt class="xref py py-meth docutils literal"><span class="pre">send()</span></tt></a> method. It accepts a sender as first
+argument and optionally some keyword arguments that are forwarded to the
+signal subscribers:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">class</span> <span class="nc">Model</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
+ <span class="o">...</span>
+
+ <span class="k">def</span> <span class="nf">save</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+ <span class="n">model_saved</span><span class="o">.</span><span class="n">send</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>Try to always pick a good sender. If you have a class that is emitting a
+signal, pass <cite>self</cite> as sender. If you emitting a signal from a random
+function, you can pass <tt class="docutils literal"><span class="pre">current_app._get_current_object()</span></tt> as sender.</p>
+<div class="admonition-passing-proxies-as-senders admonition ">
+<p class="first admonition-title">Passing Proxies as Senders</p>
+<p class="last">Never pass <a class="reference internal" href="api.html#flask.current_app" title="flask.current_app"><tt class="xref py py-data docutils literal"><span class="pre">current_app</span></tt></a> as sender to a signal. Use
+<tt class="docutils literal"><span class="pre">current_app._get_current_object()</span></tt> instead. The reason for this is
+that <a class="reference internal" href="api.html#flask.current_app" title="flask.current_app"><tt class="xref py py-data docutils literal"><span class="pre">current_app</span></tt></a> is a proxy and not the real application
+object.</p>
+</div>
+</div>
+<div class="section" id="decorator-based-signal-subscriptions">
+<h2>Decorator Based Signal Subscriptions<a class="headerlink" href="#decorator-based-signal-subscriptions" title="Permalink to this headline">¶</a></h2>
+<p>With Blinker 1.1 you can also easily subscribe to signals by using the new
+<tt class="xref py py-meth docutils literal"><span class="pre">connect_via()</span></tt> decorator:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">template_rendered</span>
+
+<span class="nd">@template_rendered.connect_via</span><span class="p">(</span><span class="n">app</span><span class="p">)</span>
+<span class="k">def</span> <span class="nf">when_template_rendered</span><span class="p">(</span><span class="n">sender</span><span class="p">,</span> <span class="n">template</span><span class="p">,</span> <span class="n">context</span><span class="p">):</span>
+ <span class="k">print</span> <span class="s">&#39;Template </span><span class="si">%s</span><span class="s"> is rendered with </span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> <span class="p">(</span><span class="n">template</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> <span class="n">context</span><span class="p">)</span>
+</pre></div>
+</div>
+</div>
+<div class="section" id="core-signals">
+<h2>Core Signals<a class="headerlink" href="#core-signals" title="Permalink to this headline">¶</a></h2>
+<p>The following signals exist in Flask:</p>
+<dl class="data">
+<dt>
+<tt class="descclassname">flask.</tt><tt class="descname">template_rendered</tt></dt>
+<dd><p>This signal is sent when a template was successfully rendered. The
+signal is invoked with the instance of the template as <cite>template</cite>
+and the context as dictionary (named <cite>context</cite>).</p>
+<p>Example subscriber:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">def</span> <span class="nf">log_template_renders</span><span class="p">(</span><span class="n">sender</span><span class="p">,</span> <span class="n">template</span><span class="p">,</span> <span class="n">context</span><span class="p">):</span>
+ <span class="n">sender</span><span class="o">.</span><span class="n">logger</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s">&#39;Rendering template &quot;</span><span class="si">%s</span><span class="s">&quot; with context </span><span class="si">%s</span><span class="s">&#39;</span><span class="p">,</span>
+ <span class="n">template</span><span class="o">.</span><span class="n">name</span> <span class="ow">or</span> <span class="s">&#39;string template&#39;</span><span class="p">,</span>
+ <span class="n">context</span><span class="p">)</span>
+
+<span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">template_rendered</span>
+<span class="n">template_rendered</span><span class="o">.</span><span class="n">connect</span><span class="p">(</span><span class="n">log_template_renders</span><span class="p">,</span> <span class="n">app</span><span class="p">)</span>
+</pre></div>
+</div>
+</dd></dl>
+
+<dl class="data">
+<dt>
+<tt class="descclassname">flask.</tt><tt class="descname">request_started</tt></dt>
+<dd><p>This signal is sent before any request processing started but when the
+request context was set up. Because the request context is already
+bound, the subscriber can access the request with the standard global
+proxies such as <a class="reference internal" href="api.html#flask.request" title="flask.request"><tt class="xref py py-class docutils literal"><span class="pre">request</span></tt></a>.</p>
+<p>Example subscriber:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">def</span> <span class="nf">log_request</span><span class="p">(</span><span class="n">sender</span><span class="p">):</span>
+ <span class="n">sender</span><span class="o">.</span><span class="n">logger</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s">&#39;Request context is set up&#39;</span><span class="p">)</span>
+
+<span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">request_started</span>
+<span class="n">request_started</span><span class="o">.</span><span class="n">connect</span><span class="p">(</span><span class="n">log_request</span><span class="p">,</span> <span class="n">app</span><span class="p">)</span>
+</pre></div>
+</div>
+</dd></dl>
+
+<dl class="data">
+<dt>
+<tt class="descclassname">flask.</tt><tt class="descname">request_finished</tt></dt>
+<dd><p>This signal is sent right before the response is sent to the client.
+It is passed the response to be sent named <cite>response</cite>.</p>
+<p>Example subscriber:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">def</span> <span class="nf">log_response</span><span class="p">(</span><span class="n">sender</span><span class="p">,</span> <span class="n">response</span><span class="p">):</span>
+ <span class="n">sender</span><span class="o">.</span><span class="n">logger</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s">&#39;Request context is about to close down. &#39;</span>
+ <span class="s">&#39;Response: </span><span class="si">%s</span><span class="s">&#39;</span><span class="p">,</span> <span class="n">response</span><span class="p">)</span>
+
+<span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">request_finished</span>
+<span class="n">request_finished</span><span class="o">.</span><span class="n">connect</span><span class="p">(</span><span class="n">log_response</span><span class="p">,</span> <span class="n">app</span><span class="p">)</span>
+</pre></div>
+</div>
+</dd></dl>
+
+<dl class="data">
+<dt>
+<tt class="descclassname">flask.</tt><tt class="descname">got_request_exception</tt></dt>
+<dd><p>This signal is sent when an exception happens during request processing.
+It is sent <em>before</em> the standard exception handling kicks in and even
+in debug mode, where no exception handling happens. The exception
+itself is passed to the subscriber as <cite>exception</cite>.</p>
+<p>Example subscriber:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">def</span> <span class="nf">log_exception</span><span class="p">(</span><span class="n">sender</span><span class="p">,</span> <span class="n">exception</span><span class="p">):</span>
+ <span class="n">sender</span><span class="o">.</span><span class="n">logger</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s">&#39;Got exception during processing: </span><span class="si">%s</span><span class="s">&#39;</span><span class="p">,</span> <span class="n">exception</span><span class="p">)</span>
+
+<span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">got_request_exception</span>
+<span class="n">got_request_exception</span><span class="o">.</span><span class="n">connect</span><span class="p">(</span><span class="n">log_exception</span><span class="p">,</span> <span class="n">app</span><span class="p">)</span>
+</pre></div>
+</div>
+</dd></dl>
+
+<dl class="data">
+<dt>
+<tt class="descclassname">flask.</tt><tt class="descname">request_tearing_down</tt></dt>
+<dd><p>This signal is sent when the request is tearing down. This is always
+called, even if an exception is caused. Currently functions listening
+to this signal are called after the regular teardown handlers, but this
+is not something you can rely on.</p>
+<p>Example subscriber:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">def</span> <span class="nf">close_db_connection</span><span class="p">(</span><span class="n">sender</span><span class="p">):</span>
+ <span class="n">session</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
+
+<span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">request_tearing_down</span>
+<span class="n">request_tearing_down</span><span class="o">.</span><span class="n">connect</span><span class="p">(</span><span class="n">close_db_connection</span><span class="p">,</span> <span class="n">app</span><span class="p">)</span>
+</pre></div>
+</div>
+</dd></dl>
+
+</div>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="index.html">
+ <img class="logo" src="_static/flask.png" alt="Logo"/>
+</a></p>
+ <h3><a href="index.html">Table Of Contents</a></h3>
+ <ul>
+<li><a class="reference internal" href="#">Signals</a><ul>
+<li><a class="reference internal" href="#subscribing-to-signals">Subscribing to Signals</a></li>
+<li><a class="reference internal" href="#creating-signals">Creating Signals</a></li>
+<li><a class="reference internal" href="#sending-signals">Sending Signals</a></li>
+<li><a class="reference internal" href="#decorator-based-signal-subscriptions">Decorator Based Signal Subscriptions</a></li>
+<li><a class="reference internal" href="#core-signals">Core Signals</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 Handling</a></li>
+ <li>Next: <a href="views.html" title="next chapter">Pluggable Views</a></li>
+ </ul></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="_sources/signals.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/styleguide.html b/app/static/doc/flask-docs/styleguide.html
new file mode 100644
index 0000000..f45955d
--- /dev/null
+++ b/app/static/doc/flask-docs/styleguide.html
@@ -0,0 +1,321 @@
+
+<!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>Pocoo Styleguide &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="index.html" />
+ <link rel="next" title="Upgrading to Newer Releases" href="upgrading.html" />
+ <link rel="prev" title="Flask Extension Development" href="extensiondev.html" />
+
+
+ <link rel="apple-touch-icon" href="_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <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="upgrading.html" title="Upgrading to Newer Releases"
+ accesskey="N">next</a> |</li>
+ <li class="right" >
+ <a href="extensiondev.html" title="Flask Extension Development"
+ accesskey="P">previous</a> |</li>
+ <li><a href="index.html">Flask 0.8 documentation</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="pocoo-styleguide">
+<h1>Pocoo Styleguide<a class="headerlink" href="#pocoo-styleguide" title="Permalink to this headline">¶</a></h1>
+<p>The Pocoo styleguide is the styleguide for all Pocoo Projects, including
+Flask. This styleguide is a requirement for Patches to Flask and a
+recommendation for Flask extensions.</p>
+<p>In general the Pocoo Styleguide closely follows <span class="target" id="index-0"></span><a class="pep reference external" href="http://www.python.org/dev/peps/pep-0008"><strong>PEP 8</strong></a> with some small
+differences and extensions.</p>
+<div class="section" id="general-layout">
+<h2>General Layout<a class="headerlink" href="#general-layout" title="Permalink to this headline">¶</a></h2>
+<dl class="docutils">
+<dt>Indentation:</dt>
+<dd>4 real spaces. No tabs, no exceptions.</dd>
+<dt>Maximum line length:</dt>
+<dd>79 characters with a soft limit for 84 if absolutely necessary. Try
+to avoid too nested code by cleverly placing <cite>break</cite>, <cite>continue</cite> and
+<cite>return</cite> statements.</dd>
+<dt>Continuing long statements:</dt>
+<dd><p class="first">To continue a statement you can use backslashes in which case you should
+align the next line with the last dot or equal sign, or indent four
+spaces:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="n">this_is_a_very_long</span><span class="p">(</span><span class="n">function_call</span><span class="p">,</span> <span class="s">&#39;with many parameters&#39;</span><span class="p">)</span> \
+ <span class="o">.</span><span class="n">that_returns_an_object_with_an_attribute</span>
+
+<span class="n">MyModel</span><span class="o">.</span><span class="n">query</span><span class="o">.</span><span class="n">filter</span><span class="p">(</span><span class="n">MyModel</span><span class="o">.</span><span class="n">scalar</span> <span class="o">&gt;</span> <span class="mi">120</span><span class="p">)</span> \
+ <span class="o">.</span><span class="n">order_by</span><span class="p">(</span><span class="n">MyModel</span><span class="o">.</span><span class="n">name</span><span class="o">.</span><span class="n">desc</span><span class="p">())</span> \
+ <span class="o">.</span><span class="n">limit</span><span class="p">(</span><span class="mi">10</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>If you break in a statement with parentheses or braces, align to the
+braces:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="n">this_is_a_very_long</span><span class="p">(</span><span class="n">function_call</span><span class="p">,</span> <span class="s">&#39;with many parameters&#39;</span><span class="p">,</span>
+ <span class="mi">23</span><span class="p">,</span> <span class="mi">42</span><span class="p">,</span> <span class="s">&#39;and even more&#39;</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>For lists or tuples with many items, break immediately after the
+opening brace:</p>
+<div class="last highlight-python"><div class="highlight"><pre><span class="n">items</span> <span class="o">=</span> <span class="p">[</span>
+ <span class="s">&#39;this is the first&#39;</span><span class="p">,</span> <span class="s">&#39;set of items&#39;</span><span class="p">,</span> <span class="s">&#39;with more items&#39;</span><span class="p">,</span>
+ <span class="s">&#39;to come in this line&#39;</span><span class="p">,</span> <span class="s">&#39;like this&#39;</span>
+<span class="p">]</span>
+</pre></div>
+</div>
+</dd>
+<dt>Blank lines:</dt>
+<dd><p class="first">Top level functions and classes are separated by two lines, everything
+else by one. Do not use too many blank lines to separate logical
+segments in code. Example:</p>
+<div class="last highlight-python"><div class="highlight"><pre><span class="k">def</span> <span class="nf">hello</span><span class="p">(</span><span class="n">name</span><span class="p">):</span>
+ <span class="k">print</span> <span class="s">&#39;Hello </span><span class="si">%s</span><span class="s">!&#39;</span> <span class="o">%</span> <span class="n">name</span>
+
+
+<span class="k">def</span> <span class="nf">goodbye</span><span class="p">(</span><span class="n">name</span><span class="p">):</span>
+ <span class="k">print</span> <span class="s">&#39;See you </span><span class="si">%s</span><span class="s">.&#39;</span> <span class="o">%</span> <span class="n">name</span>
+
+
+<span class="k">class</span> <span class="nc">MyClass</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
+ <span class="sd">&quot;&quot;&quot;This is a simple docstring&quot;&quot;&quot;</span>
+
+ <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">):</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">name</span>
+
+ <span class="k">def</span> <span class="nf">get_annoying_name</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+ <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">name</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> <span class="o">+</span> <span class="s">&#39;!!!!111&#39;</span>
+</pre></div>
+</div>
+</dd>
+</dl>
+</div>
+<div class="section" id="expressions-and-statements">
+<h2>Expressions and Statements<a class="headerlink" href="#expressions-and-statements" title="Permalink to this headline">¶</a></h2>
+<dl class="docutils">
+<dt>General whitespace rules:</dt>
+<dd><ul class="first simple">
+<li>No whitespace for unary operators that are not words
+(e.g.: <tt class="docutils literal"><span class="pre">-</span></tt>, <tt class="docutils literal"><span class="pre">~</span></tt> etc.) as well on the inner side of parentheses.</li>
+<li>Whitespace is placed between binary operators.</li>
+</ul>
+<p>Good:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="n">exp</span> <span class="o">=</span> <span class="o">-</span><span class="mf">1.05</span>
+<span class="n">value</span> <span class="o">=</span> <span class="p">(</span><span class="n">item_value</span> <span class="o">/</span> <span class="n">item_count</span><span class="p">)</span> <span class="o">*</span> <span class="n">offset</span> <span class="o">/</span> <span class="n">exp</span>
+<span class="n">value</span> <span class="o">=</span> <span class="n">my_list</span><span class="p">[</span><span class="n">index</span><span class="p">]</span>
+<span class="n">value</span> <span class="o">=</span> <span class="n">my_dict</span><span class="p">[</span><span class="s">&#39;key&#39;</span><span class="p">]</span>
+</pre></div>
+</div>
+<p>Bad:</p>
+<div class="last highlight-python"><div class="highlight"><pre><span class="n">exp</span> <span class="o">=</span> <span class="o">-</span> <span class="mf">1.05</span>
+<span class="n">value</span> <span class="o">=</span> <span class="p">(</span> <span class="n">item_value</span> <span class="o">/</span> <span class="n">item_count</span> <span class="p">)</span> <span class="o">*</span> <span class="n">offset</span> <span class="o">/</span> <span class="n">exp</span>
+<span class="n">value</span> <span class="o">=</span> <span class="p">(</span><span class="n">item_value</span><span class="o">/</span><span class="n">item_count</span><span class="p">)</span><span class="o">*</span><span class="n">offset</span><span class="o">/</span><span class="n">exp</span>
+<span class="n">value</span><span class="o">=</span><span class="p">(</span> <span class="n">item_value</span><span class="o">/</span><span class="n">item_count</span> <span class="p">)</span> <span class="o">*</span> <span class="n">offset</span><span class="o">/</span><span class="n">exp</span>
+<span class="n">value</span> <span class="o">=</span> <span class="n">my_list</span><span class="p">[</span> <span class="n">index</span> <span class="p">]</span>
+<span class="n">value</span> <span class="o">=</span> <span class="n">my_dict</span> <span class="p">[</span><span class="s">&#39;key&#39;</span><span class="p">]</span>
+</pre></div>
+</div>
+</dd>
+<dt>Yoda statements are a no-go:</dt>
+<dd><p class="first">Never compare constant with variable, always variable with constant:</p>
+<p>Good:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">if</span> <span class="n">method</span> <span class="o">==</span> <span class="s">&#39;md5&#39;</span><span class="p">:</span>
+ <span class="k">pass</span>
+</pre></div>
+</div>
+<p>Bad:</p>
+<div class="last highlight-python"><div class="highlight"><pre><span class="k">if</span> <span class="s">&#39;md5&#39;</span> <span class="o">==</span> <span class="n">method</span><span class="p">:</span>
+ <span class="k">pass</span>
+</pre></div>
+</div>
+</dd>
+<dt>Comparisons:</dt>
+<dd><ul class="first last simple">
+<li>against arbitrary types: <tt class="docutils literal"><span class="pre">==</span></tt> and <tt class="docutils literal"><span class="pre">!=</span></tt></li>
+<li>against singletons with <tt class="docutils literal"><span class="pre">is</span></tt> and <tt class="docutils literal"><span class="pre">is</span> <span class="pre">not</span></tt> (eg: <tt class="docutils literal"><span class="pre">foo</span> <span class="pre">is</span> <span class="pre">not</span>
+<span class="pre">None</span></tt>)</li>
+<li>never compare something with <cite>True</cite> or <cite>False</cite> (for example never
+do <tt class="docutils literal"><span class="pre">foo</span> <span class="pre">==</span> <span class="pre">False</span></tt>, do <tt class="docutils literal"><span class="pre">not</span> <span class="pre">foo</span></tt> instead)</li>
+</ul>
+</dd>
+<dt>Negated containment checks:</dt>
+<dd>use <tt class="docutils literal"><span class="pre">foo</span> <span class="pre">not</span> <span class="pre">in</span> <span class="pre">bar</span></tt> instead of <tt class="docutils literal"><span class="pre">not</span> <span class="pre">foo</span> <span class="pre">in</span> <span class="pre">bar</span></tt></dd>
+<dt>Instance checks:</dt>
+<dd><tt class="docutils literal"><span class="pre">isinstance(a,</span> <span class="pre">C)</span></tt> instead of <tt class="docutils literal"><span class="pre">type(A)</span> <span class="pre">is</span> <span class="pre">C</span></tt>, but try to avoid
+instance checks in general. Check for features.</dd>
+</dl>
+</div>
+<div class="section" id="naming-conventions">
+<h2>Naming Conventions<a class="headerlink" href="#naming-conventions" title="Permalink to this headline">¶</a></h2>
+<ul class="simple">
+<li>Class names: <tt class="docutils literal"><span class="pre">CamelCase</span></tt>, with acronyms kept uppercase (<tt class="docutils literal"><span class="pre">HTTPWriter</span></tt>
+and not <tt class="docutils literal"><span class="pre">HttpWriter</span></tt>)</li>
+<li>Variable names: <tt class="docutils literal"><span class="pre">lowercase_with_underscores</span></tt></li>
+<li>Method and function names: <tt class="docutils literal"><span class="pre">lowercase_with_underscores</span></tt></li>
+<li>Constants: <tt class="docutils literal"><span class="pre">UPPERCASE_WITH_UNDERSCORES</span></tt></li>
+<li>precompiled regular expressions: <tt class="docutils literal"><span class="pre">name_re</span></tt></li>
+</ul>
+<p>Protected members are prefixed with a single underscore. Double
+underscores are reserved for mixin classes.</p>
+<p>On classes with keywords, trailing underscores are appended. Clashes with
+builtins are allowed and <strong>must not</strong> be resolved by appending an
+underline to the variable name. If the function needs to access a
+shadowed builtin, rebind the builtin to a different name instead.</p>
+<dl class="docutils">
+<dt>Function and method arguments:</dt>
+<dd><ul class="first last simple">
+<li>class methods: <tt class="docutils literal"><span class="pre">cls</span></tt> as first parameter</li>
+<li>instance methods: <tt class="docutils literal"><span class="pre">self</span></tt> as first parameter</li>
+<li>lambdas for properties might have the first parameter replaced
+with <tt class="docutils literal"><span class="pre">x</span></tt> like in <tt class="docutils literal"><span class="pre">display_name</span> <span class="pre">=</span> <span class="pre">property(lambda</span> <span class="pre">x:</span> <span class="pre">x.real_name</span>
+<span class="pre">or</span> <span class="pre">x.username)</span></tt></li>
+</ul>
+</dd>
+</dl>
+</div>
+<div class="section" id="docstrings">
+<h2>Docstrings<a class="headerlink" href="#docstrings" title="Permalink to this headline">¶</a></h2>
+<dl class="docutils">
+<dt>Docstring conventions:</dt>
+<dd><p class="first">All docstrings are formatted with reStructuredText as understood by
+Sphinx. Depending on the number of lines in the docstring, they are
+laid out differently. If it&#8217;s just one line, the closing triple
+quote is on the same line as the opening, otherwise the text is on
+the same line as the opening quote and the triple quote that closes
+the string on its own line:</p>
+<div class="last highlight-python"><div class="highlight"><pre><span class="k">def</span> <span class="nf">foo</span><span class="p">():</span>
+ <span class="sd">&quot;&quot;&quot;This is a simple docstring&quot;&quot;&quot;</span>
+
+
+<span class="k">def</span> <span class="nf">bar</span><span class="p">():</span>
+ <span class="sd">&quot;&quot;&quot;This is a longer docstring with so much information in there</span>
+<span class="sd"> that it spans three lines. In this case the closing triple quote</span>
+<span class="sd"> is on its own line.</span>
+<span class="sd"> &quot;&quot;&quot;</span>
+</pre></div>
+</div>
+</dd>
+<dt>Module header:</dt>
+<dd><p class="first">The module header consists of an utf-8 encoding declaration (if non
+ASCII letters are used, but it is recommended all the time) and a
+standard docstring:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="c"># -*- coding: utf-8 -*-</span>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="sd"> package.module</span>
+<span class="sd"> ~~~~~~~~~~~~~~</span>
+
+<span class="sd"> A brief description goes here.</span>
+
+<span class="sd"> :copyright: (c) YEAR by AUTHOR.</span>
+<span class="sd"> :license: LICENSE_NAME, see LICENSE_FILE for more details.</span>
+<span class="sd">&quot;&quot;&quot;</span>
+</pre></div>
+</div>
+<p class="last">Please keep in mind that proper copyrights and license files are a
+requirement for approved Flask extensions.</p>
+</dd>
+</dl>
+</div>
+<div class="section" id="comments">
+<h2>Comments<a class="headerlink" href="#comments" title="Permalink to this headline">¶</a></h2>
+<p>Rules for comments are similar to docstrings. Both are formatted with
+reStructuredText. If a comment is used to document an attribute, put a
+colon after the opening pound sign (<tt class="docutils literal"><span class="pre">#</span></tt>):</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">class</span> <span class="nc">User</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
+ <span class="c">#: the name of the user as unicode string</span>
+ <span class="n">name</span> <span class="o">=</span> <span class="n">Column</span><span class="p">(</span><span class="n">String</span><span class="p">)</span>
+ <span class="c">#: the sha1 hash of the password + inline salt</span>
+ <span class="n">pw_hash</span> <span class="o">=</span> <span class="n">Column</span><span class="p">(</span><span class="n">String</span><span class="p">)</span>
+</pre></div>
+</div>
+</div>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="index.html">
+ <img class="logo" src="_static/flask.png" alt="Logo"/>
+</a></p>
+ <h3><a href="index.html">Table Of Contents</a></h3>
+ <ul>
+<li><a class="reference internal" href="#">Pocoo Styleguide</a><ul>
+<li><a class="reference internal" href="#general-layout">General Layout</a></li>
+<li><a class="reference internal" href="#expressions-and-statements">Expressions and Statements</a></li>
+<li><a class="reference internal" href="#naming-conventions">Naming Conventions</a></li>
+<li><a class="reference internal" href="#docstrings">Docstrings</a></li>
+<li><a class="reference internal" href="#comments">Comments</a></li>
+</ul>
+</li>
+</ul>
+<h3>Related Topics</h3>
+<ul>
+ <li><a href="index.html">Documentation overview</a><ul>
+ <li>Previous: <a href="extensiondev.html" title="previous chapter">Flask Extension Development</a></li>
+ <li>Next: <a href="upgrading.html" title="next chapter">Upgrading to Newer Releases</a></li>
+ </ul></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="_sources/styleguide.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/templating.html b/app/static/doc/flask-docs/templating.html
new file mode 100644
index 0000000..4aedfbe
--- /dev/null
+++ b/app/static/doc/flask-docs/templating.html
@@ -0,0 +1,293 @@
+
+<!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>Templates &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="index.html" />
+ <link rel="next" title="Testing Flask Applications" href="testing.html" />
+ <link rel="prev" title="Bonus: Testing the Application" href="tutorial/testing.html" />
+
+
+ <link rel="apple-touch-icon" href="_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <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="testing.html" title="Testing Flask Applications"
+ accesskey="N">next</a> |</li>
+ <li class="right" >
+ <a href="tutorial/testing.html" title="Bonus: Testing the Application"
+ accesskey="P">previous</a> |</li>
+ <li><a href="index.html">Flask 0.8 documentation</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="templates">
+<h1>Templates<a class="headerlink" href="#templates" title="Permalink to this headline">¶</a></h1>
+<p>Flask leverages Jinja2 as template engine. You are obviously free to use
+a different template engine, but you still have to install Jinja2 to run
+Flask itself. This requirement is necessary to enable rich extensions.
+An extension can depend on Jinja2 being present.</p>
+<p>This section only gives a very quick introduction into how Jinja2
+is integrated into Flask. If you want information on the template
+engine&#8217;s syntax itself, head over to the official <a class="reference external" href="http://jinja.pocoo.org/2/documentation/templates">Jinja2 Template
+Documentation</a> for
+more information.</p>
+<div class="section" id="jinja-setup">
+<h2>Jinja Setup<a class="headerlink" href="#jinja-setup" title="Permalink to this headline">¶</a></h2>
+<p>Unless customized, Jinja2 is configured by Flask as follows:</p>
+<ul class="simple">
+<li>autoescaping is enabled for all templates ending in <tt class="docutils literal"><span class="pre">.html</span></tt>,
+<tt class="docutils literal"><span class="pre">.htm</span></tt>, <tt class="docutils literal"><span class="pre">.xml</span></tt> as well as <tt class="docutils literal"><span class="pre">.xhtml</span></tt></li>
+<li>a template has the ability to opt in/out autoescaping with the
+<tt class="docutils literal"><span class="pre">{%</span> <span class="pre">autoescape</span> <span class="pre">%}</span></tt> tag.</li>
+<li>Flask inserts a couple of global functions and helpers into the
+Jinja2 context, additionally to the values that are present by
+default.</li>
+</ul>
+</div>
+<div class="section" id="standard-context">
+<h2>Standard Context<a class="headerlink" href="#standard-context" title="Permalink to this headline">¶</a></h2>
+<p>The following global variables are available within Jinja2 templates
+by default:</p>
+<dl class="data">
+<dt>
+<tt class="descname">config</tt></dt>
+<dd><p>The current configuration object (<tt class="xref py py-data docutils literal"><span class="pre">flask.config</span></tt>)</p>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.6.</span></p>
+</dd></dl>
+
+<dl class="data">
+<dt>
+<tt class="descname">request</tt></dt>
+<dd><p>The current request object (<a class="reference internal" href="api.html#flask.request" title="flask.request"><tt class="xref py py-class docutils literal"><span class="pre">flask.request</span></tt></a>)</p>
+</dd></dl>
+
+<dl class="data">
+<dt>
+<tt class="descname">session</tt></dt>
+<dd><p>The current session object (<a class="reference internal" href="api.html#flask.session" title="flask.session"><tt class="xref py py-class docutils literal"><span class="pre">flask.session</span></tt></a>)</p>
+</dd></dl>
+
+<dl class="data">
+<dt>
+<tt class="descname">g</tt></dt>
+<dd><p>The request-bound object for global variables (<a class="reference internal" href="api.html#flask.g" title="flask.g"><tt class="xref py py-data docutils literal"><span class="pre">flask.g</span></tt></a>)</p>
+</dd></dl>
+
+<dl class="function">
+<dt>
+<tt class="descname">url_for</tt><big>(</big><big>)</big></dt>
+<dd><p>The <a class="reference internal" href="api.html#flask.url_for" title="flask.url_for"><tt class="xref py py-func docutils literal"><span class="pre">flask.url_for()</span></tt></a> function.</p>
+</dd></dl>
+
+<dl class="function">
+<dt>
+<tt class="descname">get_flashed_messages</tt><big>(</big><big>)</big></dt>
+<dd><p>The <a class="reference internal" href="api.html#flask.get_flashed_messages" title="flask.get_flashed_messages"><tt class="xref py py-func docutils literal"><span class="pre">flask.get_flashed_messages()</span></tt></a> function.</p>
+</dd></dl>
+
+<div class="admonition-the-jinja-context-behaviour admonition ">
+<p class="first admonition-title">The Jinja Context Behaviour</p>
+<p>These variables are added to the context of variables, they are not
+global variables. The difference is that by default these will not
+show up in the context of imported templates. This is partially caused
+by performance considerations, partially to keep things explicit.</p>
+<p>What does this mean for you? If you have a macro you want to import,
+that needs to access the request object you have two possibilities:</p>
+<ol class="arabic simple">
+<li>you explicitly pass the request to the macro as parameter, or
+the attribute of the request object you are interested in.</li>
+<li>you import the macro &#8220;with context&#8221;.</li>
+</ol>
+<p>Importing with context looks like this:</p>
+<div class="last highlight-jinja"><div class="highlight"><pre><span class="cp">{%</span> <span class="k">from</span> <span class="s1">&#39;_helpers.html&#39;</span> <span class="k">import</span> <span class="nv">my_macro</span> <span class="k">with context</span> <span class="cp">%}</span><span class="x"></span>
+</pre></div>
+</div>
+</div>
+</div>
+<div class="section" id="standard-filters">
+<h2>Standard Filters<a class="headerlink" href="#standard-filters" title="Permalink to this headline">¶</a></h2>
+<p>These filters are available in Jinja2 additionally to the filters provided
+by Jinja2 itself:</p>
+<dl class="function">
+<dt>
+<tt class="descname">tojson</tt><big>(</big><big>)</big></dt>
+<dd><p>This function converts the given object into JSON representation. This
+is for example very helpful if you try to generate JavaScript on the
+fly.</p>
+<p>Note that inside <cite>script</cite> tags no escaping must take place, so make
+sure to disable escaping with <tt class="docutils literal"><span class="pre">|safe</span></tt> if you intend to use it inside
+<cite>script</cite> tags:</p>
+<div class="highlight-html+jinja"><div class="highlight"><pre><span class="nt">&lt;script </span><span class="na">type=</span><span class="s">text/javascript</span><span class="nt">&gt;</span>
+ <span class="nx">doSomethingWith</span><span class="p">(</span><span class="cp">{{</span> <span class="nv">user.username</span><span class="o">|</span><span class="nf">tojson</span><span class="o">|</span><span class="nf">safe</span> <span class="cp">}}</span><span class="p">);</span>
+<span class="nt">&lt;/script&gt;</span>
+</pre></div>
+</div>
+<p>That the <tt class="docutils literal"><span class="pre">|tojson</span></tt> filter escapes forward slashes properly for you.</p>
+</dd></dl>
+
+</div>
+<div class="section" id="controlling-autoescaping">
+<h2>Controlling Autoescaping<a class="headerlink" href="#controlling-autoescaping" title="Permalink to this headline">¶</a></h2>
+<p>Autoescaping is the concept of automatically escaping special characters
+of you. Special characters in the sense of HTML (or XML, and thus XHTML)
+are <tt class="docutils literal"><span class="pre">&amp;</span></tt>, <tt class="docutils literal"><span class="pre">&gt;</span></tt>, <tt class="docutils literal"><span class="pre">&lt;</span></tt>, <tt class="docutils literal"><span class="pre">&quot;</span></tt> as well as <tt class="docutils literal"><span class="pre">'</span></tt>. Because these characters
+carry specific meanings in documents on their own you have to replace them
+by so called &#8220;entities&#8221; if you want to use them for text. Not doing so
+would not only cause user frustration by the inability to use these
+characters in text, but can also lead to security problems. (see
+<a class="reference internal" href="security.html#xss"><em>Cross-Site Scripting (XSS)</em></a>)</p>
+<p>Sometimes however you will need to disable autoescaping in templates.
+This can be the case if you want to explicitly inject HTML into pages, for
+example if they come from a system that generate secure HTML like a
+markdown to HTML converter.</p>
+<p>There are three ways to accomplish that:</p>
+<ul class="simple">
+<li>In the Python code, wrap the HTML string in a <a class="reference internal" href="api.html#flask.Markup" title="flask.Markup"><tt class="xref py py-class docutils literal"><span class="pre">Markup</span></tt></a>
+object before passing it to the template. This is in general the
+recommended way.</li>
+<li>Inside the template, use the <tt class="docutils literal"><span class="pre">|safe</span></tt> filter to explicitly mark a
+string as safe HTML (<tt class="docutils literal"><span class="pre">{{</span> <span class="pre">myvariable|safe</span> <span class="pre">}}</span></tt>)</li>
+<li>Temporarily disable the autoescape system altogether.</li>
+</ul>
+<p>To disable the autoescape system in templates, you can use the <tt class="docutils literal"><span class="pre">{%</span>
+<span class="pre">autoescape</span> <span class="pre">%}</span></tt> block:</p>
+<div class="highlight-html+jinja"><div class="highlight"><pre><span class="cp">{%</span> <span class="k">autoescape</span> <span class="kp">false</span> <span class="cp">%}</span>
+ <span class="nt">&lt;p&gt;</span>autoescaping is disabled here
+ <span class="nt">&lt;p&gt;</span><span class="cp">{{</span> <span class="nv">will_not_be_escaped</span> <span class="cp">}}</span>
+<span class="cp">{%</span> <span class="k">endautoescape</span> <span class="cp">%}</span>
+</pre></div>
+</div>
+<p>Whenever you do this, please be very cautious about the variables you are
+using in this block.</p>
+</div>
+<div class="section" id="registering-filters">
+<h2>Registering Filters<a class="headerlink" href="#registering-filters" title="Permalink to this headline">¶</a></h2>
+<p>If you want to register your own filters in Jinja2 you have two ways to do
+that. You can either put them by hand into the
+<a class="reference internal" href="api.html#flask.Flask.jinja_env" title="flask.Flask.jinja_env"><tt class="xref py py-attr docutils literal"><span class="pre">jinja_env</span></tt></a> of the application or use the
+<a class="reference internal" href="api.html#flask.Flask.template_filter" title="flask.Flask.template_filter"><tt class="xref py py-meth docutils literal"><span class="pre">template_filter()</span></tt></a> decorator.</p>
+<p>The two following examples work the same and both reverse an object:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="nd">@app.template_filter</span><span class="p">(</span><span class="s">&#39;reverse&#39;</span><span class="p">)</span>
+<span class="k">def</span> <span class="nf">reverse_filter</span><span class="p">(</span><span class="n">s</span><span class="p">):</span>
+ <span class="k">return</span> <span class="n">s</span><span class="p">[::</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span>
+
+<span class="k">def</span> <span class="nf">reverse_filter</span><span class="p">(</span><span class="n">s</span><span class="p">):</span>
+ <span class="k">return</span> <span class="n">s</span><span class="p">[::</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span>
+<span class="n">app</span><span class="o">.</span><span class="n">jinja_env</span><span class="o">.</span><span class="n">filters</span><span class="p">[</span><span class="s">&#39;reverse&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">reverse_filter</span>
+</pre></div>
+</div>
+<p>In case of the decorator the argument is optional if you want to use the
+function name as name of the filter.</p>
+</div>
+<div class="section" id="context-processors">
+<h2>Context Processors<a class="headerlink" href="#context-processors" title="Permalink to this headline">¶</a></h2>
+<p>To inject new variables automatically into the context of a template
+context processors exist in Flask. Context processors run before the
+template is rendered and have the ability to inject new values into the
+template context. A context processor is a function that returns a
+dictionary. The keys and values of this dictionary are then merged with
+the template context:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="nd">@app.context_processor</span>
+<span class="k">def</span> <span class="nf">inject_user</span><span class="p">():</span>
+ <span class="k">return</span> <span class="nb">dict</span><span class="p">(</span><span class="n">user</span><span class="o">=</span><span class="n">g</span><span class="o">.</span><span class="n">user</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>The context processor above makes a variable called <cite>user</cite> available in
+the template with the value of <cite>g.user</cite>. This example is not very
+interesting because <cite>g</cite> is available in templates anyways, but it gives an
+idea how this works.</p>
+</div>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="index.html">
+ <img class="logo" src="_static/flask.png" alt="Logo"/>
+</a></p>
+ <h3><a href="index.html">Table Of Contents</a></h3>
+ <ul>
+<li><a class="reference internal" href="#">Templates</a><ul>
+<li><a class="reference internal" href="#jinja-setup">Jinja Setup</a></li>
+<li><a class="reference internal" href="#standard-context">Standard Context</a></li>
+<li><a class="reference internal" href="#standard-filters">Standard Filters</a></li>
+<li><a class="reference internal" href="#controlling-autoescaping">Controlling Autoescaping</a></li>
+<li><a class="reference internal" href="#registering-filters">Registering Filters</a></li>
+<li><a class="reference internal" href="#context-processors">Context Processors</a></li>
+</ul>
+</li>
+</ul>
+<h3>Related Topics</h3>
+<ul>
+ <li><a href="index.html">Documentation overview</a><ul>
+ <li>Previous: <a href="tutorial/testing.html" title="previous chapter">Bonus: Testing the Application</a></li>
+ <li>Next: <a href="testing.html" title="next chapter">Testing Flask Applications</a></li>
+ </ul></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="_sources/templating.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/testing.html b/app/static/doc/flask-docs/testing.html
new file mode 100644
index 0000000..2f93142
--- /dev/null
+++ b/app/static/doc/flask-docs/testing.html
@@ -0,0 +1,391 @@
+
+<!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>Testing Flask Applications &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="index.html" />
+ <link rel="next" title="Handling Application Errors" href="errorhandling.html" />
+ <link rel="prev" title="Templates" href="templating.html" />
+
+
+ <link rel="apple-touch-icon" href="_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <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="errorhandling.html" title="Handling Application Errors"
+ accesskey="N">next</a> |</li>
+ <li class="right" >
+ <a href="templating.html" title="Templates"
+ accesskey="P">previous</a> |</li>
+ <li><a href="index.html">Flask 0.8 documentation</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="testing-flask-applications">
+<span id="testing"></span><h1>Testing Flask Applications<a class="headerlink" href="#testing-flask-applications" title="Permalink to this headline">¶</a></h1>
+<blockquote>
+<div><strong>Something that is untested is broken.</strong></div></blockquote>
+<p>The origin of this quote is unknown and while it is not entirely correct, it is also
+not far from the truth. Untested applications make it hard to
+improve existing code and developers of untested applications tend to
+become pretty paranoid. If an application has automated tests, you can
+safely make changes and instantly know if anything breaks.</p>
+<p>Flask provides a way to test your application by exposing the Werkzeug
+test <a class="reference external" href="http://werkzeug.pocoo.org/docs/test/#werkzeug.test.Client" title="(in Werkzeug v0.7)"><tt class="xref py py-class docutils literal"><span class="pre">Client</span></tt></a> and handling the context locals for you.
+You can then use that with your favourite testing solution. In this documentation
+we will use the <a class="reference external" href="http://docs.python.org/dev/library/unittest.html#unittest" title="(in Python v3.3)"><tt class="xref py py-mod docutils literal"><span class="pre">unittest</span></tt></a> package that comes pre-installed with Python.</p>
+<div class="section" id="the-application">
+<h2>The Application<a class="headerlink" href="#the-application" title="Permalink to this headline">¶</a></h2>
+<p>First, we need an application to test; we will use the application from
+the <a class="reference internal" href="tutorial/index.html#tutorial"><em>Tutorial</em></a>. If you don&#8217;t have that application yet, get the
+sources from <a class="reference external" href="http://github.com/mitsuhiko/flask/tree/master/examples/flaskr/">the examples</a>.</p>
+</div>
+<div class="section" id="the-testing-skeleton">
+<h2>The Testing Skeleton<a class="headerlink" href="#the-testing-skeleton" title="Permalink to this headline">¶</a></h2>
+<p>In order to test the application, we add a second module
+(<cite>flaskr_tests.py</cite>) and create a unittest skeleton there:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">os</span>
+<span class="kn">import</span> <span class="nn">flaskr</span>
+<span class="kn">import</span> <span class="nn">unittest</span>
+<span class="kn">import</span> <span class="nn">tempfile</span>
+
+<span class="k">class</span> <span class="nc">FlaskrTestCase</span><span class="p">(</span><span class="n">unittest</span><span class="o">.</span><span class="n">TestCase</span><span class="p">):</span>
+
+ <span class="k">def</span> <span class="nf">setUp</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">db_fd</span><span class="p">,</span> <span class="n">flaskr</span><span class="o">.</span><span class="n">app</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s">&#39;DATABASE&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">tempfile</span><span class="o">.</span><span class="n">mkstemp</span><span class="p">()</span>
+ <span class="n">flaskr</span><span class="o">.</span><span class="n">app</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s">&#39;TESTING&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="bp">True</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">app</span> <span class="o">=</span> <span class="n">flaskr</span><span class="o">.</span><span class="n">app</span><span class="o">.</span><span class="n">test_client</span><span class="p">()</span>
+ <span class="n">flaskr</span><span class="o">.</span><span class="n">init_db</span><span class="p">()</span>
+
+ <span class="k">def</span> <span class="nf">tearDown</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+ <span class="n">os</span><span class="o">.</span><span class="n">close</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">db_fd</span><span class="p">)</span>
+ <span class="n">os</span><span class="o">.</span><span class="n">unlink</span><span class="p">(</span><span class="n">flaskr</span><span class="o">.</span><span class="n">app</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s">&#39;DATABASE&#39;</span><span class="p">])</span>
+
+<span class="k">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">&#39;__main__&#39;</span><span class="p">:</span>
+ <span class="n">unittest</span><span class="o">.</span><span class="n">main</span><span class="p">()</span>
+</pre></div>
+</div>
+<p>The code in the <a class="reference external" href="http://docs.python.org/dev/library/unittest.html#unittest.TestCase.setUp" title="(in Python v3.3)"><tt class="xref py py-meth docutils literal"><span class="pre">setUp()</span></tt></a> method creates a new test
+client and initializes a new database. This function is called before
+each individual test function is run. To delete the database after the
+test, we close the file and remove it from the filesystem in the
+<a class="reference external" href="http://docs.python.org/dev/library/unittest.html#unittest.TestCase.tearDown" title="(in Python v3.3)"><tt class="xref py py-meth docutils literal"><span class="pre">tearDown()</span></tt></a> method. Additionally during setup the
+<tt class="docutils literal"><span class="pre">TESTING</span></tt> config flag is activated. What it does is disabling the error
+catching during request handling so that you get better error reports when
+performing test requests against the application.</p>
+<p>This test client will give us a simple interface to the application. We can
+trigger test requests to the application, and the client will also keep track
+of cookies for us.</p>
+<p>Because SQLite3 is filesystem-based we can easily use the tempfile module
+to create a temporary database and initialize it. The
+<a class="reference external" href="http://docs.python.org/dev/library/tempfile.html#tempfile.mkstemp" title="(in Python v3.3)"><tt class="xref py py-func docutils literal"><span class="pre">mkstemp()</span></tt></a> function does two things for us: it returns a
+low-level file handle and a random file name, the latter we use as
+database name. We just have to keep the <cite>db_fd</cite> around so that we can use
+the <a class="reference external" href="http://docs.python.org/dev/library/os.html#os.close" title="(in Python v3.3)"><tt class="xref py py-func docutils literal"><span class="pre">os.close()</span></tt></a> function to close the file.</p>
+<p>If we now run the test suite, we should see the following output:</p>
+<div class="highlight-python"><pre>$ python flaskr_tests.py
+
+----------------------------------------------------------------------
+Ran 0 tests in 0.000s
+
+OK</pre>
+</div>
+<p>Even though it did not run any actual tests, we already know that our flaskr
+application is syntactically valid, otherwise the import would have died
+with an exception.</p>
+</div>
+<div class="section" id="the-first-test">
+<h2>The First Test<a class="headerlink" href="#the-first-test" title="Permalink to this headline">¶</a></h2>
+<p>Now it&#8217;s time to start testing the functionality of the application.
+Let&#8217;s check that the application shows &#8220;No entries here so far&#8221; if we
+access the root of the application (<tt class="docutils literal"><span class="pre">/</span></tt>). To do this, we add a new
+test method to our class, like this:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">class</span> <span class="nc">FlaskrTestCase</span><span class="p">(</span><span class="n">unittest</span><span class="o">.</span><span class="n">TestCase</span><span class="p">):</span>
+
+ <span class="k">def</span> <span class="nf">setUp</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">db_fd</span><span class="p">,</span> <span class="n">flaskr</span><span class="o">.</span><span class="n">app</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s">&#39;DATABASE&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">tempfile</span><span class="o">.</span><span class="n">mkstemp</span><span class="p">()</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">app</span> <span class="o">=</span> <span class="n">flaskr</span><span class="o">.</span><span class="n">app</span><span class="o">.</span><span class="n">test_client</span><span class="p">()</span>
+ <span class="n">flaskr</span><span class="o">.</span><span class="n">init_db</span><span class="p">()</span>
+
+ <span class="k">def</span> <span class="nf">tearDown</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+ <span class="n">os</span><span class="o">.</span><span class="n">close</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">db_fd</span><span class="p">)</span>
+ <span class="n">os</span><span class="o">.</span><span class="n">unlink</span><span class="p">(</span><span class="n">flaskr</span><span class="o">.</span><span class="n">DATABASE</span><span class="p">)</span>
+
+ <span class="k">def</span> <span class="nf">test_empty_db</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+ <span class="n">rv</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">app</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;/&#39;</span><span class="p">)</span>
+ <span class="k">assert</span> <span class="s">&#39;No entries here so far&#39;</span> <span class="ow">in</span> <span class="n">rv</span><span class="o">.</span><span class="n">data</span>
+</pre></div>
+</div>
+<p>Notice that our test functions begin with the word <cite>test</cite>; this allows
+<a class="reference external" href="http://docs.python.org/dev/library/unittest.html#unittest" title="(in Python v3.3)"><tt class="xref py py-mod docutils literal"><span class="pre">unittest</span></tt></a> to automatically identify the method as a test to run.</p>
+<p>By using <cite>self.app.get</cite> we can send an HTTP <cite>GET</cite> request to the application with
+the given path. The return value will be a <a class="reference internal" href="api.html#flask.Flask.response_class" title="flask.Flask.response_class"><tt class="xref py py-class docutils literal"><span class="pre">response_class</span></tt></a> object.
+We can now use the <a class="reference external" href="http://werkzeug.pocoo.org/docs/wrappers/#werkzeug.wrappers.BaseResponse.data" title="(in Werkzeug v0.7)"><tt class="xref py py-attr docutils literal"><span class="pre">data</span></tt></a> attribute to inspect
+the return value (as string) from the application. In this case, we ensure that
+<tt class="docutils literal"><span class="pre">'No</span> <span class="pre">entries</span> <span class="pre">here</span> <span class="pre">so</span> <span class="pre">far'</span></tt> is part of the output.</p>
+<p>Run it again and you should see one passing test:</p>
+<div class="highlight-python"><pre>$ python flaskr_tests.py
+.
+----------------------------------------------------------------------
+Ran 1 test in 0.034s
+
+OK</pre>
+</div>
+</div>
+<div class="section" id="logging-in-and-out">
+<h2>Logging In and Out<a class="headerlink" href="#logging-in-and-out" title="Permalink to this headline">¶</a></h2>
+<p>The majority of the functionality of our application is only available for
+the administrative user, so we need a way to log our test client in and out
+of the application. To do this, we fire some requests to the login and logout
+pages with the required form data (username and password). And because the
+login and logout pages redirect, we tell the client to <cite>follow_redirects</cite>.</p>
+<p>Add the following two methods to your <cite>FlaskrTestCase</cite> class:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">def</span> <span class="nf">login</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">username</span><span class="p">,</span> <span class="n">password</span><span class="p">):</span>
+ <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">app</span><span class="o">.</span><span class="n">post</span><span class="p">(</span><span class="s">&#39;/login&#39;</span><span class="p">,</span> <span class="n">data</span><span class="o">=</span><span class="nb">dict</span><span class="p">(</span>
+ <span class="n">username</span><span class="o">=</span><span class="n">username</span><span class="p">,</span>
+ <span class="n">password</span><span class="o">=</span><span class="n">password</span>
+ <span class="p">),</span> <span class="n">follow_redirects</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
+
+<span class="k">def</span> <span class="nf">logout</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+ <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">app</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;/logout&#39;</span><span class="p">,</span> <span class="n">follow_redirects</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>Now we can easily test that logging in and out works and that it fails with
+invalid credentials. Add this new test to the class:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">def</span> <span class="nf">test_login_logout</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+ <span class="n">rv</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">login</span><span class="p">(</span><span class="s">&#39;admin&#39;</span><span class="p">,</span> <span class="s">&#39;default&#39;</span><span class="p">)</span>
+ <span class="k">assert</span> <span class="s">&#39;You were logged in&#39;</span> <span class="ow">in</span> <span class="n">rv</span><span class="o">.</span><span class="n">data</span>
+ <span class="n">rv</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">logout</span><span class="p">()</span>
+ <span class="k">assert</span> <span class="s">&#39;You were logged out&#39;</span> <span class="ow">in</span> <span class="n">rv</span><span class="o">.</span><span class="n">data</span>
+ <span class="n">rv</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">login</span><span class="p">(</span><span class="s">&#39;adminx&#39;</span><span class="p">,</span> <span class="s">&#39;default&#39;</span><span class="p">)</span>
+ <span class="k">assert</span> <span class="s">&#39;Invalid username&#39;</span> <span class="ow">in</span> <span class="n">rv</span><span class="o">.</span><span class="n">data</span>
+ <span class="n">rv</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">login</span><span class="p">(</span><span class="s">&#39;admin&#39;</span><span class="p">,</span> <span class="s">&#39;defaultx&#39;</span><span class="p">)</span>
+ <span class="k">assert</span> <span class="s">&#39;Invalid password&#39;</span> <span class="ow">in</span> <span class="n">rv</span><span class="o">.</span><span class="n">data</span>
+</pre></div>
+</div>
+</div>
+<div class="section" id="test-adding-messages">
+<h2>Test Adding Messages<a class="headerlink" href="#test-adding-messages" title="Permalink to this headline">¶</a></h2>
+<p>We should also test that adding messages works. Add a new test method
+like this:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">def</span> <span class="nf">test_messages</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">login</span><span class="p">(</span><span class="s">&#39;admin&#39;</span><span class="p">,</span> <span class="s">&#39;default&#39;</span><span class="p">)</span>
+ <span class="n">rv</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">app</span><span class="o">.</span><span class="n">post</span><span class="p">(</span><span class="s">&#39;/add&#39;</span><span class="p">,</span> <span class="n">data</span><span class="o">=</span><span class="nb">dict</span><span class="p">(</span>
+ <span class="n">title</span><span class="o">=</span><span class="s">&#39;&lt;Hello&gt;&#39;</span><span class="p">,</span>
+ <span class="n">text</span><span class="o">=</span><span class="s">&#39;&lt;strong&gt;HTML&lt;/strong&gt; allowed here&#39;</span>
+ <span class="p">),</span> <span class="n">follow_redirects</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
+ <span class="k">assert</span> <span class="s">&#39;No entries here so far&#39;</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">rv</span><span class="o">.</span><span class="n">data</span>
+ <span class="k">assert</span> <span class="s">&#39;&amp;lt;Hello&amp;gt;&#39;</span> <span class="ow">in</span> <span class="n">rv</span><span class="o">.</span><span class="n">data</span>
+ <span class="k">assert</span> <span class="s">&#39;&lt;strong&gt;HTML&lt;/strong&gt; allowed here&#39;</span> <span class="ow">in</span> <span class="n">rv</span><span class="o">.</span><span class="n">data</span>
+</pre></div>
+</div>
+<p>Here we check that HTML is allowed in the text but not in the title,
+which is the intended behavior.</p>
+<p>Running that should now give us three passing tests:</p>
+<div class="highlight-python"><pre>$ python flaskr_tests.py
+...
+----------------------------------------------------------------------
+Ran 3 tests in 0.332s
+
+OK</pre>
+</div>
+<p>For more complex tests with headers and status codes, check out the
+<a class="reference external" href="http://github.com/mitsuhiko/flask/tree/master/examples/minitwit/">MiniTwit Example</a> from the sources which contains a larger test
+suite.</p>
+</div>
+<div class="section" id="other-testing-tricks">
+<h2>Other Testing Tricks<a class="headerlink" href="#other-testing-tricks" title="Permalink to this headline">¶</a></h2>
+<p>Besides using the test client as shown above, there is also the
+<a class="reference internal" href="api.html#flask.Flask.test_request_context" title="flask.Flask.test_request_context"><tt class="xref py py-meth docutils literal"><span class="pre">test_request_context()</span></tt></a> method that can be used
+in combination with the <cite>with</cite> statement to activate a request context
+temporarily. With this you can access the <a class="reference internal" href="api.html#flask.request" title="flask.request"><tt class="xref py py-class docutils literal"><span class="pre">request</span></tt></a>,
+<a class="reference internal" href="api.html#flask.g" title="flask.g"><tt class="xref py py-class docutils literal"><span class="pre">g</span></tt></a> and <a class="reference internal" href="api.html#flask.session" title="flask.session"><tt class="xref py py-class docutils literal"><span class="pre">session</span></tt></a> objects like in view
+functions. Here is a full example that demonstrates this approach:</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="o">.</span><span class="n">Flask</span><span class="p">(</span><span class="n">__name__</span><span class="p">)</span>
+
+<span class="k">with</span> <span class="n">app</span><span class="o">.</span><span class="n">test_request_context</span><span class="p">(</span><span class="s">&#39;/?name=Peter&#39;</span><span class="p">):</span>
+ <span class="k">assert</span> <span class="n">flask</span><span class="o">.</span><span class="n">request</span><span class="o">.</span><span class="n">path</span> <span class="o">==</span> <span class="s">&#39;/&#39;</span>
+ <span class="k">assert</span> <span class="n">flask</span><span class="o">.</span><span class="n">request</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s">&#39;name&#39;</span><span class="p">]</span> <span class="o">==</span> <span class="s">&#39;Peter&#39;</span>
+</pre></div>
+</div>
+<p>All the other objects that are context bound can be used in the same
+way.</p>
+<p>If you want to test your application with different configurations and
+there does not seem to be a good way to do that, consider switching to
+application factories (see <a class="reference internal" href="patterns/appfactories.html#app-factories"><em>Application Factories</em></a>).</p>
+<p>Note however that if you are using a test request context, the
+<a class="reference internal" href="api.html#flask.Flask.before_request" title="flask.Flask.before_request"><tt class="xref py py-meth docutils literal"><span class="pre">before_request()</span></tt></a> functions are not automatically called
+same for <a class="reference internal" href="api.html#flask.Flask.after_request" title="flask.Flask.after_request"><tt class="xref py py-meth docutils literal"><span class="pre">after_request()</span></tt></a> functions. However
+<a class="reference internal" href="api.html#flask.Flask.teardown_request" title="flask.Flask.teardown_request"><tt class="xref py py-meth docutils literal"><span class="pre">teardown_request()</span></tt></a> functions are indeed executed when
+the test request context leaves the <cite>with</cite> block. If you do want the
+<a class="reference internal" href="api.html#flask.Flask.before_request" title="flask.Flask.before_request"><tt class="xref py py-meth docutils literal"><span class="pre">before_request()</span></tt></a> functions to be called as well, you
+need to call <a class="reference internal" href="api.html#flask.Flask.preprocess_request" title="flask.Flask.preprocess_request"><tt class="xref py py-meth docutils literal"><span class="pre">preprocess_request()</span></tt></a> yourself:</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="o">.</span><span class="n">Flask</span><span class="p">(</span><span class="n">__name__</span><span class="p">)</span>
+
+<span class="k">with</span> <span class="n">app</span><span class="o">.</span><span class="n">test_request_context</span><span class="p">(</span><span class="s">&#39;/?name=Peter&#39;</span><span class="p">):</span>
+ <span class="n">app</span><span class="o">.</span><span class="n">preprocess_request</span><span class="p">()</span>
+ <span class="o">...</span>
+</pre></div>
+</div>
+<p>This can be necessary to open database connections or something similar
+depending on how your application was designed.</p>
+<p>If you want to call the <a class="reference internal" href="api.html#flask.Flask.after_request" title="flask.Flask.after_request"><tt class="xref py py-meth docutils literal"><span class="pre">after_request()</span></tt></a> functions you
+need to call into <a class="reference internal" href="api.html#flask.Flask.process_response" title="flask.Flask.process_response"><tt class="xref py py-meth docutils literal"><span class="pre">process_response()</span></tt></a> which however
+requires that you pass it a response object:</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="o">.</span><span class="n">Flask</span><span class="p">(</span><span class="n">__name__</span><span class="p">)</span>
+
+<span class="k">with</span> <span class="n">app</span><span class="o">.</span><span class="n">test_request_context</span><span class="p">(</span><span class="s">&#39;/?name=Peter&#39;</span><span class="p">):</span>
+ <span class="n">resp</span> <span class="o">=</span> <span class="n">Response</span><span class="p">(</span><span class="s">&#39;...&#39;</span><span class="p">)</span>
+ <span class="n">resp</span> <span class="o">=</span> <span class="n">app</span><span class="o">.</span><span class="n">process_response</span><span class="p">(</span><span class="n">resp</span><span class="p">)</span>
+ <span class="o">...</span>
+</pre></div>
+</div>
+<p>This in general is less useful because at that point you can directly
+start using the test client.</p>
+</div>
+<div class="section" id="keeping-the-context-around">
+<h2>Keeping the Context Around<a class="headerlink" href="#keeping-the-context-around" title="Permalink to this headline">¶</a></h2>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.4.</span></p>
+<p>Sometimes it is helpful to trigger a regular request but still keep the
+context around for a little longer so that additional introspection can
+happen. With Flask 0.4 this is possible by using the
+<a class="reference internal" href="api.html#flask.Flask.test_client" title="flask.Flask.test_client"><tt class="xref py py-meth docutils literal"><span class="pre">test_client()</span></tt></a> with a <cite>with</cite> block:</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="o">.</span><span class="n">Flask</span><span class="p">(</span><span class="n">__name__</span><span class="p">)</span>
+
+<span class="k">with</span> <span class="n">app</span><span class="o">.</span><span class="n">test_client</span><span class="p">()</span> <span class="k">as</span> <span class="n">c</span><span class="p">:</span>
+ <span class="n">rv</span> <span class="o">=</span> <span class="n">c</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;/?tequila=42&#39;</span><span class="p">)</span>
+ <span class="k">assert</span> <span class="n">request</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s">&#39;tequila&#39;</span><span class="p">]</span> <span class="o">==</span> <span class="s">&#39;42&#39;</span>
+</pre></div>
+</div>
+<p>If you were to use just the <a class="reference internal" href="api.html#flask.Flask.test_client" title="flask.Flask.test_client"><tt class="xref py py-meth docutils literal"><span class="pre">test_client()</span></tt></a> without
+the <cite>with</cite> block, the <cite>assert</cite> would fail with an error because <cite>request</cite>
+is no longer available (because you are trying to use it outside of the actual request).
+However, keep in mind that any <a class="reference internal" href="api.html#flask.Flask.after_request" title="flask.Flask.after_request"><tt class="xref py py-meth docutils literal"><span class="pre">after_request()</span></tt></a> functions
+are already called at this point so your database connection and
+everything involved is probably already closed down.</p>
+</div>
+<div class="section" id="accessing-and-modifying-sessions">
+<h2>Accessing and Modifying Sessions<a class="headerlink" href="#accessing-and-modifying-sessions" title="Permalink to this headline">¶</a></h2>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.8.</span></p>
+<p>Sometimes it can be very helpful to access or modify the sessions from the
+test client. Generally there are two ways for this. If you just want to
+ensure that a session has certain keys set to certain values you can just
+keep the context around and access <a class="reference internal" href="api.html#flask.session" title="flask.session"><tt class="xref py py-data docutils literal"><span class="pre">flask.session</span></tt></a>:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">with</span> <span class="n">app</span><span class="o">.</span><span class="n">test_client</span><span class="p">()</span> <span class="k">as</span> <span class="n">c</span><span class="p">:</span>
+ <span class="n">rv</span> <span class="o">=</span> <span class="n">c</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;/&#39;</span><span class="p">)</span>
+ <span class="k">assert</span> <span class="n">flask</span><span class="o">.</span><span class="n">session</span><span class="p">[</span><span class="s">&#39;foo&#39;</span><span class="p">]</span> <span class="o">==</span> <span class="mi">42</span>
+</pre></div>
+</div>
+<p>This however does not make it possible to also modify the session or to
+access the session before a request was fired. Starting with Flask 0.8 we
+provide a so called “session transaction” which simulates the appropriate
+calls to open a session in the context of the test client and to modify
+it. At the end of the transaction the session is stored. This works
+independently of the session backend used:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">with</span> <span class="n">app</span><span class="o">.</span><span class="n">test_client</span><span class="p">()</span> <span class="k">as</span> <span class="n">c</span><span class="p">:</span>
+ <span class="k">with</span> <span class="n">c</span><span class="o">.</span><span class="n">session_transaction</span><span class="p">()</span> <span class="k">as</span> <span class="n">sess</span><span class="p">:</span>
+ <span class="n">sess</span><span class="p">[</span><span class="s">&#39;a_key&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&#39;a value&#39;</span>
+
+ <span class="c"># once this is reached the session was stored</span>
+</pre></div>
+</div>
+<p>Note that in this case you have to use the <tt class="docutils literal"><span class="pre">sess</span></tt> object instead of the
+<a class="reference internal" href="api.html#flask.session" title="flask.session"><tt class="xref py py-data docutils literal"><span class="pre">flask.session</span></tt></a> proxy. The object however itself will provide the
+same interface.</p>
+</div>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="index.html">
+ <img class="logo" src="_static/flask.png" alt="Logo"/>
+</a></p>
+ <h3><a href="index.html">Table Of Contents</a></h3>
+ <ul>
+<li><a class="reference internal" href="#">Testing Flask Applications</a><ul>
+<li><a class="reference internal" href="#the-application">The Application</a></li>
+<li><a class="reference internal" href="#the-testing-skeleton">The Testing Skeleton</a></li>
+<li><a class="reference internal" href="#the-first-test">The First Test</a></li>
+<li><a class="reference internal" href="#logging-in-and-out">Logging In and Out</a></li>
+<li><a class="reference internal" href="#test-adding-messages">Test Adding Messages</a></li>
+<li><a class="reference internal" href="#other-testing-tricks">Other Testing Tricks</a></li>
+<li><a class="reference internal" href="#keeping-the-context-around">Keeping the Context Around</a></li>
+<li><a class="reference internal" href="#accessing-and-modifying-sessions">Accessing and Modifying Sessions</a></li>
+</ul>
+</li>
+</ul>
+<h3>Related Topics</h3>
+<ul>
+ <li><a href="index.html">Documentation overview</a><ul>
+ <li>Previous: <a href="templating.html" title="previous chapter">Templates</a></li>
+ <li>Next: <a href="errorhandling.html" title="next chapter">Handling Application Errors</a></li>
+ </ul></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="_sources/testing.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/tutorial/css.html b/app/static/doc/flask-docs/tutorial/css.html
new file mode 100644
index 0000000..e226e94
--- /dev/null
+++ b/app/static/doc/flask-docs/tutorial/css.html
@@ -0,0 +1,132 @@
+
+<!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>Step 7: Adding Style &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="../index.html" />
+ <link rel="up" title="Tutorial" href="index.html" />
+ <link rel="next" title="Bonus: Testing the Application" href="testing.html" />
+ <link rel="prev" title="Step 6: The Templates" href="templates.html" />
+
+
+ <link rel="apple-touch-icon" href="../_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="../_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <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="testing.html" title="Bonus: Testing the Application"
+ accesskey="N">next</a> |</li>
+ <li class="right" >
+ <a href="templates.html" title="Step 6: The Templates"
+ accesskey="P">previous</a> |</li>
+ <li><a href="../index.html">Flask 0.8 documentation</a> &raquo;</li>
+ <li><a href="index.html" accesskey="U">Tutorial</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="step-7-adding-style">
+<span id="tutorial-css"></span><h1>Step 7: Adding Style<a class="headerlink" href="#step-7-adding-style" title="Permalink to this headline">¶</a></h1>
+<p>Now that everything else works, it&#8217;s time to add some style to the
+application. Just create a stylesheet called <cite>style.css</cite> in the <cite>static</cite>
+folder we created before:</p>
+<div class="highlight-css"><div class="highlight"><pre><span class="nt">body</span> <span class="p">{</span> <span class="k">font-family</span><span class="o">:</span> <span class="k">sans-serif</span><span class="p">;</span> <span class="k">background</span><span class="o">:</span> <span class="m">#eee</span><span class="p">;</span> <span class="p">}</span>
+<span class="nt">a</span><span class="o">,</span> <span class="nt">h1</span><span class="o">,</span> <span class="nt">h2</span> <span class="p">{</span> <span class="k">color</span><span class="o">:</span> <span class="m">#377BA8</span><span class="p">;</span> <span class="p">}</span>
+<span class="nt">h1</span><span class="o">,</span> <span class="nt">h2</span> <span class="p">{</span> <span class="k">font-family</span><span class="o">:</span> <span class="s1">&#39;Georgia&#39;</span><span class="o">,</span> <span class="k">serif</span><span class="p">;</span> <span class="k">margin</span><span class="o">:</span> <span class="m">0</span><span class="p">;</span> <span class="p">}</span>
+<span class="nt">h1</span> <span class="p">{</span> <span class="k">border-bottom</span><span class="o">:</span> <span class="m">2px</span> <span class="k">solid</span> <span class="m">#eee</span><span class="p">;</span> <span class="p">}</span>
+<span class="nt">h2</span> <span class="p">{</span> <span class="k">font-size</span><span class="o">:</span> <span class="m">1.2em</span><span class="p">;</span> <span class="p">}</span>
+
+<span class="nc">.page</span> <span class="p">{</span> <span class="k">margin</span><span class="o">:</span> <span class="m">2em</span> <span class="k">auto</span><span class="p">;</span> <span class="k">width</span><span class="o">:</span> <span class="m">35em</span><span class="p">;</span> <span class="k">border</span><span class="o">:</span> <span class="m">5px</span> <span class="k">solid</span> <span class="m">#ccc</span><span class="p">;</span>
+ <span class="k">padding</span><span class="o">:</span> <span class="m">0.8em</span><span class="p">;</span> <span class="k">background</span><span class="o">:</span> <span class="nb">white</span><span class="p">;</span> <span class="p">}</span>
+<span class="nc">.entries</span> <span class="p">{</span> <span class="k">list-style</span><span class="o">:</span> <span class="k">none</span><span class="p">;</span> <span class="k">margin</span><span class="o">:</span> <span class="m">0</span><span class="p">;</span> <span class="k">padding</span><span class="o">:</span> <span class="m">0</span><span class="p">;</span> <span class="p">}</span>
+<span class="nc">.entries</span> <span class="nt">li</span> <span class="p">{</span> <span class="k">margin</span><span class="o">:</span> <span class="m">0.8em</span> <span class="m">1.2em</span><span class="p">;</span> <span class="p">}</span>
+<span class="nc">.entries</span> <span class="nt">li</span> <span class="nt">h2</span> <span class="p">{</span> <span class="k">margin-left</span><span class="o">:</span> <span class="m">-1em</span><span class="p">;</span> <span class="p">}</span>
+<span class="nc">.add-entry</span> <span class="p">{</span> <span class="k">font-size</span><span class="o">:</span> <span class="m">0.9em</span><span class="p">;</span> <span class="k">border-bottom</span><span class="o">:</span> <span class="m">1px</span> <span class="k">solid</span> <span class="m">#ccc</span><span class="p">;</span> <span class="p">}</span>
+<span class="nc">.add-entry</span> <span class="nt">dl</span> <span class="p">{</span> <span class="k">font-weight</span><span class="o">:</span> <span class="k">bold</span><span class="p">;</span> <span class="p">}</span>
+<span class="nc">.metanav</span> <span class="p">{</span> <span class="k">text-align</span><span class="o">:</span> <span class="k">right</span><span class="p">;</span> <span class="k">font-size</span><span class="o">:</span> <span class="m">0.8em</span><span class="p">;</span> <span class="k">padding</span><span class="o">:</span> <span class="m">0.3em</span><span class="p">;</span>
+ <span class="k">margin-bottom</span><span class="o">:</span> <span class="m">1em</span><span class="p">;</span> <span class="k">background</span><span class="o">:</span> <span class="m">#fafafa</span><span class="p">;</span> <span class="p">}</span>
+<span class="nc">.flash</span> <span class="p">{</span> <span class="k">background</span><span class="o">:</span> <span class="m">#CEE5F5</span><span class="p">;</span> <span class="k">padding</span><span class="o">:</span> <span class="m">0.5em</span><span class="p">;</span>
+ <span class="k">border</span><span class="o">:</span> <span class="m">1px</span> <span class="k">solid</span> <span class="m">#AACBE2</span><span class="p">;</span> <span class="p">}</span>
+<span class="nc">.error</span> <span class="p">{</span> <span class="k">background</span><span class="o">:</span> <span class="m">#F0D6D6</span><span class="p">;</span> <span class="k">padding</span><span class="o">:</span> <span class="m">0.5em</span><span class="p">;</span> <span class="p">}</span>
+</pre></div>
+</div>
+<p>Continue with <a class="reference internal" href="testing.html#tutorial-testing"><em>Bonus: Testing the Application</em></a>.</p>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="../index.html">
+ <img class="logo" src="../_static/flask.png" alt="Logo"/>
+</a></p><h3>Related Topics</h3>
+<ul>
+ <li><a href="../index.html">Documentation overview</a><ul>
+ <li><a href="index.html">Tutorial</a><ul>
+ <li>Previous: <a href="templates.html" title="previous chapter">Step 6: The Templates</a></li>
+ <li>Next: <a href="testing.html" title="next chapter">Bonus: Testing the Application</a></li>
+ </ul></li>
+ </ul></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="../_sources/tutorial/css.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/tutorial/dbcon.html b/app/static/doc/flask-docs/tutorial/dbcon.html
new file mode 100644
index 0000000..91ed599
--- /dev/null
+++ b/app/static/doc/flask-docs/tutorial/dbcon.html
@@ -0,0 +1,154 @@
+
+<!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>Step 4: Request Database Connections &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="../index.html" />
+ <link rel="up" title="Tutorial" href="index.html" />
+ <link rel="next" title="Step 5: The View Functions" href="views.html" />
+ <link rel="prev" title="Step 3: Creating The Database" href="dbinit.html" />
+
+
+ <link rel="apple-touch-icon" href="../_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="../_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <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="views.html" title="Step 5: The View Functions"
+ accesskey="N">next</a> |</li>
+ <li class="right" >
+ <a href="dbinit.html" title="Step 3: Creating The Database"
+ accesskey="P">previous</a> |</li>
+ <li><a href="../index.html">Flask 0.8 documentation</a> &raquo;</li>
+ <li><a href="index.html" accesskey="U">Tutorial</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="step-4-request-database-connections">
+<span id="tutorial-dbcon"></span><h1>Step 4: Request Database Connections<a class="headerlink" href="#step-4-request-database-connections" title="Permalink to this headline">¶</a></h1>
+<p>Now we know how we can open database connections and use them for scripts,
+but how can we elegantly do that for requests? We will need the database
+connection in all our functions so it makes sense to initialize them
+before each request and shut them down afterwards.</p>
+<p>Flask allows us to do that with the <a class="reference internal" href="../api.html#flask.Flask.before_request" title="flask.Flask.before_request"><tt class="xref py py-meth docutils literal"><span class="pre">before_request()</span></tt></a>,
+<a class="reference internal" href="../api.html#flask.Flask.after_request" title="flask.Flask.after_request"><tt class="xref py py-meth docutils literal"><span class="pre">after_request()</span></tt></a> and <a class="reference internal" href="../api.html#flask.Flask.teardown_request" title="flask.Flask.teardown_request"><tt class="xref py py-meth docutils literal"><span class="pre">teardown_request()</span></tt></a>
+decorators:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="nd">@app.before_request</span>
+<span class="k">def</span> <span class="nf">before_request</span><span class="p">():</span>
+ <span class="n">g</span><span class="o">.</span><span class="n">db</span> <span class="o">=</span> <span class="n">connect_db</span><span class="p">()</span>
+
+<span class="nd">@app.teardown_request</span>
+<span class="k">def</span> <span class="nf">teardown_request</span><span class="p">(</span><span class="n">exception</span><span class="p">):</span>
+ <span class="n">g</span><span class="o">.</span><span class="n">db</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
+</pre></div>
+</div>
+<p>Functions marked with <a class="reference internal" href="../api.html#flask.Flask.before_request" title="flask.Flask.before_request"><tt class="xref py py-meth docutils literal"><span class="pre">before_request()</span></tt></a> are called before
+a request and passed no arguments. Functions marked with
+<a class="reference internal" href="../api.html#flask.Flask.after_request" title="flask.Flask.after_request"><tt class="xref py py-meth docutils literal"><span class="pre">after_request()</span></tt></a> are called after a request and
+passed the response that will be sent to the client. They have to return
+that response object or a different one. They are however not guaranteed
+to be executed if an exception is raised, this is where functions marked with
+<a class="reference internal" href="../api.html#flask.Flask.teardown_request" title="flask.Flask.teardown_request"><tt class="xref py py-meth docutils literal"><span class="pre">teardown_request()</span></tt></a> come in. They get called after the
+response has been constructed. They are not allowed to modify the request, and
+their return values are ignored. If an exception occurred while the request was
+being processed, it is passed to each function; otherwise, <cite>None</cite> is passed in.</p>
+<p>We store our current database connection on the special <a class="reference internal" href="../api.html#flask.g" title="flask.g"><tt class="xref py py-data docutils literal"><span class="pre">g</span></tt></a>
+object that Flask provides for us. This object stores information for one
+request only and is available from within each function. Never store such
+things on other objects because this would not work with threaded
+environments. That special <a class="reference internal" href="../api.html#flask.g" title="flask.g"><tt class="xref py py-data docutils literal"><span class="pre">g</span></tt></a> object does some magic behind
+the scenes to ensure it does the right thing.</p>
+<p>Continue to <a class="reference internal" href="views.html#tutorial-views"><em>Step 5: The View Functions</em></a>.</p>
+<div class="admonition hint">
+<p class="first admonition-title">Hint</p>
+<p>Where do I put this code?</p>
+<p>If you&#8217;ve been following along in this tutorial, you might be wondering
+where to put the code from this step and the next. A logical place is to
+group these module-level functions together, and put your new
+<tt class="docutils literal"><span class="pre">before_request</span></tt> and <tt class="docutils literal"><span class="pre">teardown_request</span></tt> functions below your existing
+<tt class="docutils literal"><span class="pre">init_db</span></tt> function (following the tutorial line-by-line).</p>
+<p class="last">If you need a moment to find your bearings, take a look at how the <a class="reference external" href="http://github.com/mitsuhiko/flask/tree/master/examples/flaskr/">example
+source</a> is organized. In Flask, you can put all of your application code
+into a single Python module. You don&#8217;t have to, and if your app <a class="reference internal" href="../patterns/packages.html#larger-applications"><em>grows
+larger</em></a>, it&#8217;s a good idea not to.</p>
+</div>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="../index.html">
+ <img class="logo" src="../_static/flask.png" alt="Logo"/>
+</a></p><h3>Related Topics</h3>
+<ul>
+ <li><a href="../index.html">Documentation overview</a><ul>
+ <li><a href="index.html">Tutorial</a><ul>
+ <li>Previous: <a href="dbinit.html" title="previous chapter">Step 3: Creating The Database</a></li>
+ <li>Next: <a href="views.html" title="next chapter">Step 5: The View Functions</a></li>
+ </ul></li>
+ </ul></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="../_sources/tutorial/dbcon.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/tutorial/dbinit.html b/app/static/doc/flask-docs/tutorial/dbinit.html
new file mode 100644
index 0000000..413914e
--- /dev/null
+++ b/app/static/doc/flask-docs/tutorial/dbinit.html
@@ -0,0 +1,166 @@
+
+<!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>Step 3: Creating The Database &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="../index.html" />
+ <link rel="up" title="Tutorial" href="index.html" />
+ <link rel="next" title="Step 4: Request Database Connections" href="dbcon.html" />
+ <link rel="prev" title="Step 2: Application Setup Code" href="setup.html" />
+
+
+ <link rel="apple-touch-icon" href="../_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="../_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <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="dbcon.html" title="Step 4: Request Database Connections"
+ accesskey="N">next</a> |</li>
+ <li class="right" >
+ <a href="setup.html" title="Step 2: Application Setup Code"
+ accesskey="P">previous</a> |</li>
+ <li><a href="../index.html">Flask 0.8 documentation</a> &raquo;</li>
+ <li><a href="index.html" accesskey="U">Tutorial</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="step-3-creating-the-database">
+<span id="tutorial-dbinit"></span><h1>Step 3: Creating The Database<a class="headerlink" href="#step-3-creating-the-database" title="Permalink to this headline">¶</a></h1>
+<p>Flaskr is a database powered application as outlined earlier, and more
+precisely, an application powered by a relational database system. Such
+systems need a schema that tells them how to store that information. So
+before starting the server for the first time it&#8217;s important to create
+that schema.</p>
+<p>Such a schema can be created by piping the <cite>schema.sql</cite> file into the
+<cite>sqlite3</cite> command as follows:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="n">sqlite3</span> <span class="o">/</span><span class="n">tmp</span><span class="o">/</span><span class="n">flaskr</span><span class="o">.</span><span class="n">db</span> <span class="o">&lt;</span> <span class="n">schema</span><span class="o">.</span><span class="n">sql</span>
+</pre></div>
+</div>
+<p>The downside of this is that it requires the sqlite3 command to be
+installed which is not necessarily the case on every system. Also one has
+to provide the path to the database there which leaves some place for
+errors. It&#8217;s a good idea to add a function that initializes the database
+for you to the application.</p>
+<p>If you want to do that, you first have to import the
+<a class="reference external" href="http://docs.python.org/dev/library/contextlib.html#contextlib.closing" title="(in Python v3.3)"><tt class="xref py py-func docutils literal"><span class="pre">contextlib.closing()</span></tt></a> function from the contextlib package. If you
+want to use Python 2.5 it&#8217;s also necessary to enable the <cite>with</cite> statement
+first (<cite>__future__</cite> imports must be the very first import):</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">__future__</span> <span class="kn">import</span> <span class="n">with_statement</span>
+<span class="kn">from</span> <span class="nn">contextlib</span> <span class="kn">import</span> <span class="n">closing</span>
+</pre></div>
+</div>
+<p>Next we can create a function called <cite>init_db</cite> that initializes the
+database. For this we can use the <cite>connect_db</cite> function we defined
+earlier. Just add that function below the <cite>connect_db</cite> function:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">def</span> <span class="nf">init_db</span><span class="p">():</span>
+ <span class="k">with</span> <span class="n">closing</span><span class="p">(</span><span class="n">connect_db</span><span class="p">())</span> <span class="k">as</span> <span class="n">db</span><span class="p">:</span>
+ <span class="k">with</span> <span class="n">app</span><span class="o">.</span><span class="n">open_resource</span><span class="p">(</span><span class="s">&#39;schema.sql&#39;</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
+ <span class="n">db</span><span class="o">.</span><span class="n">cursor</span><span class="p">()</span><span class="o">.</span><span class="n">executescript</span><span class="p">(</span><span class="n">f</span><span class="o">.</span><span class="n">read</span><span class="p">())</span>
+ <span class="n">db</span><span class="o">.</span><span class="n">commit</span><span class="p">()</span>
+</pre></div>
+</div>
+<p>The <a class="reference external" href="http://docs.python.org/dev/library/contextlib.html#contextlib.closing" title="(in Python v3.3)"><tt class="xref py py-func docutils literal"><span class="pre">closing()</span></tt></a> helper function allows us to keep a
+connection open for the duration of the <cite>with</cite> block. The
+<a class="reference internal" href="../api.html#flask.Flask.open_resource" title="flask.Flask.open_resource"><tt class="xref py py-func docutils literal"><span class="pre">open_resource()</span></tt></a> method of the application object
+supports that functionality out of the box, so it can be used in the
+<cite>with</cite> block directly. This function opens a file from the resource
+location (your <cite>flaskr</cite> folder) and allows you to read from it. We are
+using this here to execute a script on the database connection.</p>
+<p>When we connect to a database we get a connection object (here called
+<cite>db</cite>) that can give us a cursor. On that cursor there is a method to
+execute a complete script. Finally we only have to commit the changes.
+SQLite 3 and other transactional databases will not commit unless you
+explicitly tell it to.</p>
+<p>Now it is possible to create a database by starting up a Python shell and
+importing and calling that function:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">flaskr</span> <span class="kn">import</span> <span class="n">init_db</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">init_db</span><span class="p">()</span>
+</pre></div>
+</div>
+<div class="admonition-troubleshooting admonition ">
+<p class="first admonition-title">Troubleshooting</p>
+<p class="last">If you get an exception later that a table cannot be found check that
+you did call the <cite>init_db</cite> function and that your table names are
+correct (singular vs. plural for example).</p>
+</div>
+<p>Continue with <a class="reference internal" href="dbcon.html#tutorial-dbcon"><em>Step 4: Request Database Connections</em></a></p>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="../index.html">
+ <img class="logo" src="../_static/flask.png" alt="Logo"/>
+</a></p><h3>Related Topics</h3>
+<ul>
+ <li><a href="../index.html">Documentation overview</a><ul>
+ <li><a href="index.html">Tutorial</a><ul>
+ <li>Previous: <a href="setup.html" title="previous chapter">Step 2: Application Setup Code</a></li>
+ <li>Next: <a href="dbcon.html" title="next chapter">Step 4: Request Database Connections</a></li>
+ </ul></li>
+ </ul></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="../_sources/tutorial/dbinit.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/tutorial/folders.html b/app/static/doc/flask-docs/tutorial/folders.html
new file mode 100644
index 0000000..a711ab9
--- /dev/null
+++ b/app/static/doc/flask-docs/tutorial/folders.html
@@ -0,0 +1,122 @@
+
+<!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>Step 0: Creating The Folders &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="../index.html" />
+ <link rel="up" title="Tutorial" href="index.html" />
+ <link rel="next" title="Step 1: Database Schema" href="schema.html" />
+ <link rel="prev" title="Introducing Flaskr" href="introduction.html" />
+
+
+ <link rel="apple-touch-icon" href="../_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="../_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <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="schema.html" title="Step 1: Database Schema"
+ accesskey="N">next</a> |</li>
+ <li class="right" >
+ <a href="introduction.html" title="Introducing Flaskr"
+ accesskey="P">previous</a> |</li>
+ <li><a href="../index.html">Flask 0.8 documentation</a> &raquo;</li>
+ <li><a href="index.html" accesskey="U">Tutorial</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="step-0-creating-the-folders">
+<span id="tutorial-folders"></span><h1>Step 0: Creating The Folders<a class="headerlink" href="#step-0-creating-the-folders" title="Permalink to this headline">¶</a></h1>
+<p>Before we get started, let&#8217;s create the folders needed for this
+application:</p>
+<div class="highlight-python"><pre>/flaskr
+ /static
+ /templates</pre>
+</div>
+<p>The <cite>flaskr</cite> folder is not a python package, but just something where we
+drop our files. Directly into this folder we will then put our database
+schema as well as main module in the following steps. The files inside
+the <cite>static</cite> folder are available to users of the application via <cite>HTTP</cite>.
+This is the place where css and javascript files go. Inside the
+<cite>templates</cite> folder Flask will look for <a class="reference external" href="http://jinja.pocoo.org/2/">Jinja2</a> templates. The
+templates you create later in the tutorial will go in this directory.</p>
+<p>Continue with <a class="reference internal" href="schema.html#tutorial-schema"><em>Step 1: Database Schema</em></a>.</p>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="../index.html">
+ <img class="logo" src="../_static/flask.png" alt="Logo"/>
+</a></p><h3>Related Topics</h3>
+<ul>
+ <li><a href="../index.html">Documentation overview</a><ul>
+ <li><a href="index.html">Tutorial</a><ul>
+ <li>Previous: <a href="introduction.html" title="previous chapter">Introducing Flaskr</a></li>
+ <li>Next: <a href="schema.html" title="next chapter">Step 1: Database Schema</a></li>
+ </ul></li>
+ </ul></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="../_sources/tutorial/folders.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/tutorial/index.html b/app/static/doc/flask-docs/tutorial/index.html
new file mode 100644
index 0000000..cc010cb
--- /dev/null
+++ b/app/static/doc/flask-docs/tutorial/index.html
@@ -0,0 +1,137 @@
+
+<!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>Tutorial &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="../index.html" />
+ <link rel="next" title="Introducing Flaskr" href="introduction.html" />
+ <link rel="prev" title="Quickstart" href="../quickstart.html" />
+
+
+ <link rel="apple-touch-icon" href="../_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="../_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <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="introduction.html" title="Introducing Flaskr"
+ accesskey="N">next</a> |</li>
+ <li class="right" >
+ <a href="../quickstart.html" title="Quickstart"
+ accesskey="P">previous</a> |</li>
+ <li><a href="../index.html">Flask 0.8 documentation</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="tutorial">
+<span id="id1"></span><h1>Tutorial<a class="headerlink" href="#tutorial" title="Permalink to this headline">¶</a></h1>
+<p>You want to develop an application with Python and Flask? Here you have
+the chance to learn that by example. In this tutorial we will create a
+simple microblog application. It only supports one user that can create
+text-only entries and there are no feeds or comments, but it still
+features everything you need to get started. We will use Flask and SQLite
+as database which comes out of the box with Python, so there is nothing
+else you need.</p>
+<p>If you want the full sourcecode in advance or for comparison, check out
+the <a class="reference external" href="http://github.com/mitsuhiko/flask/tree/master/examples/flaskr/">example source</a>.</p>
+<div class="toctree-wrapper compound">
+<ul>
+<li class="toctree-l1"><a class="reference internal" href="introduction.html">Introducing Flaskr</a></li>
+<li class="toctree-l1"><a class="reference internal" href="folders.html">Step 0: Creating The Folders</a></li>
+<li class="toctree-l1"><a class="reference internal" href="schema.html">Step 1: Database Schema</a></li>
+<li class="toctree-l1"><a class="reference internal" href="setup.html">Step 2: Application Setup Code</a></li>
+<li class="toctree-l1"><a class="reference internal" href="dbinit.html">Step 3: Creating The Database</a></li>
+<li class="toctree-l1"><a class="reference internal" href="dbcon.html">Step 4: Request Database Connections</a></li>
+<li class="toctree-l1"><a class="reference internal" href="views.html">Step 5: The View Functions</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="views.html#show-entries">Show Entries</a></li>
+<li class="toctree-l2"><a class="reference internal" href="views.html#add-new-entry">Add New Entry</a></li>
+<li class="toctree-l2"><a class="reference internal" href="views.html#login-and-logout">Login and Logout</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="templates.html">Step 6: The Templates</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="templates.html#layout-html">layout.html</a></li>
+<li class="toctree-l2"><a class="reference internal" href="templates.html#show-entries-html">show_entries.html</a></li>
+<li class="toctree-l2"><a class="reference internal" href="templates.html#login-html">login.html</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="css.html">Step 7: Adding Style</a></li>
+<li class="toctree-l1"><a class="reference internal" href="testing.html">Bonus: Testing the Application</a></li>
+</ul>
+</div>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="../index.html">
+ <img class="logo" src="../_static/flask.png" alt="Logo"/>
+</a></p><h3>Related Topics</h3>
+<ul>
+ <li><a href="../index.html">Documentation overview</a><ul>
+ <li>Previous: <a href="../quickstart.html" title="previous chapter">Quickstart</a></li>
+ <li>Next: <a href="introduction.html" title="next chapter">Introducing Flaskr</a></li>
+ </ul></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="../_sources/tutorial/index.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/tutorial/introduction.html b/app/static/doc/flask-docs/tutorial/introduction.html
new file mode 100644
index 0000000..3598713
--- /dev/null
+++ b/app/static/doc/flask-docs/tutorial/introduction.html
@@ -0,0 +1,128 @@
+
+<!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>Introducing Flaskr &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="../index.html" />
+ <link rel="up" title="Tutorial" href="index.html" />
+ <link rel="next" title="Step 0: Creating The Folders" href="folders.html" />
+ <link rel="prev" title="Tutorial" href="index.html" />
+
+
+ <link rel="apple-touch-icon" href="../_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="../_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <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="folders.html" title="Step 0: Creating The Folders"
+ accesskey="N">next</a> |</li>
+ <li class="right" >
+ <a href="index.html" title="Tutorial"
+ accesskey="P">previous</a> |</li>
+ <li><a href="../index.html">Flask 0.8 documentation</a> &raquo;</li>
+ <li><a href="index.html" accesskey="U">Tutorial</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="introducing-flaskr">
+<span id="tutorial-introduction"></span><h1>Introducing Flaskr<a class="headerlink" href="#introducing-flaskr" title="Permalink to this headline">¶</a></h1>
+<p>We will call our blogging application flaskr here, feel free to chose a
+less web-2.0-ish name ;) Basically we want it to do the following things:</p>
+<ol class="arabic simple">
+<li>let the user sign in and out with credentials specified in the
+configuration. Only one user is supported.</li>
+<li>when the user is logged in they can add new entries to the page
+consisting of a text-only title and some HTML for the text. This HTML
+is not sanitized because we trust the user here.</li>
+<li>the page shows all entries so far in reverse order (newest on top) and
+the user can add new ones from there if logged in.</li>
+</ol>
+<p>We will be using SQLite3 directly for that application because it&#8217;s good
+enough for an application of that size. For larger applications however
+it makes a lot of sense to use <a class="reference external" href="http://www.sqlalchemy.org/">SQLAlchemy</a> that handles database
+connections in a more intelligent way, allows you to target different
+relational databases at once and more. You might also want to consider
+one of the popular NoSQL databases if your data is more suited for those.</p>
+<p>Here a screenshot from the final application:</p>
+<img alt="screenshot of the final application" class="screenshot align-center" src="../_images/flaskr.png" />
+<p>Continue with <a class="reference internal" href="folders.html#tutorial-folders"><em>Step 0: Creating The Folders</em></a>.</p>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="../index.html">
+ <img class="logo" src="../_static/flask.png" alt="Logo"/>
+</a></p><h3>Related Topics</h3>
+<ul>
+ <li><a href="../index.html">Documentation overview</a><ul>
+ <li><a href="index.html">Tutorial</a><ul>
+ <li>Previous: <a href="index.html" title="previous chapter">Tutorial</a></li>
+ <li>Next: <a href="folders.html" title="next chapter">Step 0: Creating The Folders</a></li>
+ </ul></li>
+ </ul></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="../_sources/tutorial/introduction.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/tutorial/schema.html b/app/static/doc/flask-docs/tutorial/schema.html
new file mode 100644
index 0000000..9794054
--- /dev/null
+++ b/app/static/doc/flask-docs/tutorial/schema.html
@@ -0,0 +1,125 @@
+
+<!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>Step 1: Database Schema &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="../index.html" />
+ <link rel="up" title="Tutorial" href="index.html" />
+ <link rel="next" title="Step 2: Application Setup Code" href="setup.html" />
+ <link rel="prev" title="Step 0: Creating The Folders" href="folders.html" />
+
+
+ <link rel="apple-touch-icon" href="../_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="../_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <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="setup.html" title="Step 2: Application Setup Code"
+ accesskey="N">next</a> |</li>
+ <li class="right" >
+ <a href="folders.html" title="Step 0: Creating The Folders"
+ accesskey="P">previous</a> |</li>
+ <li><a href="../index.html">Flask 0.8 documentation</a> &raquo;</li>
+ <li><a href="index.html" accesskey="U">Tutorial</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="step-1-database-schema">
+<span id="tutorial-schema"></span><h1>Step 1: Database Schema<a class="headerlink" href="#step-1-database-schema" title="Permalink to this headline">¶</a></h1>
+<p>First we want to create the database schema. For this application only a
+single table is needed and we only want to support SQLite so that is quite
+easy. Just put the following contents into a file named <cite>schema.sql</cite> in
+the just created <cite>flaskr</cite> folder:</p>
+<div class="highlight-sql"><div class="highlight"><pre><span class="k">drop</span> <span class="k">table</span> <span class="n">if</span> <span class="k">exists</span> <span class="n">entries</span><span class="p">;</span>
+<span class="k">create</span> <span class="k">table</span> <span class="n">entries</span> <span class="p">(</span>
+ <span class="n">id</span> <span class="nb">integer</span> <span class="k">primary</span> <span class="k">key</span> <span class="n">autoincrement</span><span class="p">,</span>
+ <span class="n">title</span> <span class="n">string</span> <span class="k">not</span> <span class="k">null</span><span class="p">,</span>
+ <span class="nb">text</span> <span class="n">string</span> <span class="k">not</span> <span class="k">null</span>
+<span class="p">);</span>
+</pre></div>
+</div>
+<p>This schema consists of a single table called <cite>entries</cite> and each row in
+this table has an <cite>id</cite>, a <cite>title</cite> and a <cite>text</cite>. The <cite>id</cite> is an
+automatically incrementing integer and a primary key, the other two are
+strings that must not be null.</p>
+<p>Continue with <a class="reference internal" href="setup.html#tutorial-setup"><em>Step 2: Application Setup Code</em></a>.</p>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="../index.html">
+ <img class="logo" src="../_static/flask.png" alt="Logo"/>
+</a></p><h3>Related Topics</h3>
+<ul>
+ <li><a href="../index.html">Documentation overview</a><ul>
+ <li><a href="index.html">Tutorial</a><ul>
+ <li>Previous: <a href="folders.html" title="previous chapter">Step 0: Creating The Folders</a></li>
+ <li>Next: <a href="setup.html" title="next chapter">Step 2: Application Setup Code</a></li>
+ </ul></li>
+ </ul></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="../_sources/tutorial/schema.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/tutorial/setup.html b/app/static/doc/flask-docs/tutorial/setup.html
new file mode 100644
index 0000000..142281d
--- /dev/null
+++ b/app/static/doc/flask-docs/tutorial/setup.html
@@ -0,0 +1,183 @@
+
+<!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>Step 2: Application Setup Code &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="../index.html" />
+ <link rel="up" title="Tutorial" href="index.html" />
+ <link rel="next" title="Step 3: Creating The Database" href="dbinit.html" />
+ <link rel="prev" title="Step 1: Database Schema" href="schema.html" />
+
+
+ <link rel="apple-touch-icon" href="../_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="../_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <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="dbinit.html" title="Step 3: Creating The Database"
+ accesskey="N">next</a> |</li>
+ <li class="right" >
+ <a href="schema.html" title="Step 1: Database Schema"
+ accesskey="P">previous</a> |</li>
+ <li><a href="../index.html">Flask 0.8 documentation</a> &raquo;</li>
+ <li><a href="index.html" accesskey="U">Tutorial</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="step-2-application-setup-code">
+<span id="tutorial-setup"></span><h1>Step 2: Application Setup Code<a class="headerlink" href="#step-2-application-setup-code" title="Permalink to this headline">¶</a></h1>
+<p>Now that we have the schema in place we can create the application module.
+Let&#8217;s call it <cite>flaskr.py</cite> inside the <cite>flaskr</cite> folder. For starters we
+will add the imports we will need as well as the config section. For
+small applications it&#8217;s a possibility to drop the configuration directly
+into the module which we will be doing here. However a cleaner solution
+would be to create a separate <cite>.ini</cite> or <cite>.py</cite> file and load that or import
+the values from there.</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="c"># all the imports</span>
+<span class="kn">import</span> <span class="nn">sqlite3</span>
+<span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">Flask</span><span class="p">,</span> <span class="n">request</span><span class="p">,</span> <span class="n">session</span><span class="p">,</span> <span class="n">g</span><span class="p">,</span> <span class="n">redirect</span><span class="p">,</span> <span class="n">url_for</span><span class="p">,</span> \
+ <span class="n">abort</span><span class="p">,</span> <span class="n">render_template</span><span class="p">,</span> <span class="n">flash</span>
+
+<span class="c"># configuration</span>
+<span class="n">DATABASE</span> <span class="o">=</span> <span class="s">&#39;/tmp/flaskr.db&#39;</span>
+<span class="n">DEBUG</span> <span class="o">=</span> <span class="bp">True</span>
+<span class="n">SECRET_KEY</span> <span class="o">=</span> <span class="s">&#39;development key&#39;</span>
+<span class="n">USERNAME</span> <span class="o">=</span> <span class="s">&#39;admin&#39;</span>
+<span class="n">PASSWORD</span> <span class="o">=</span> <span class="s">&#39;default&#39;</span>
+</pre></div>
+</div>
+<p>Next we can create our actual application and initialize it with the
+config from the same file:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="c"># create our little application :)</span>
+<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">app</span><span class="o">.</span><span class="n">config</span><span class="o">.</span><span class="n">from_object</span><span class="p">(</span><span class="n">__name__</span><span class="p">)</span>
+</pre></div>
+</div>
+<p><a class="reference internal" href="../api.html#flask.Config.from_object" title="flask.Config.from_object"><tt class="xref py py-meth docutils literal"><span class="pre">from_object()</span></tt></a> will look at the given object (if it&#8217;s a
+string it will import it) and then look for all uppercase variables
+defined there. In our case, the configuration we just wrote a few lines
+of code above. You can also move that into a separate file.</p>
+<p>It is also a good idea to be able to load a configuration from a
+configurable file. This is what <a class="reference internal" href="../api.html#flask.Config.from_envvar" title="flask.Config.from_envvar"><tt class="xref py py-meth docutils literal"><span class="pre">from_envvar()</span></tt></a> can
+do:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="n">app</span><span class="o">.</span><span class="n">config</span><span class="o">.</span><span class="n">from_envvar</span><span class="p">(</span><span class="s">&#39;FLASKR_SETTINGS&#39;</span><span class="p">,</span> <span class="n">silent</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>That way someone can set an environment variable called
+<span class="target" id="index-0"></span><tt class="xref std std-envvar docutils literal"><span class="pre">FLASKR_SETTINGS</span></tt> to specify a config file to be loaded which will
+then override the default values. The silent switch just tells Flask to
+not complain if no such environment key is set.</p>
+<p>The <cite>secret_key</cite> is needed to keep the client-side sessions secure.
+Choose that key wisely and as hard to guess and complex as possible. The
+debug flag enables or disables the interactive debugger. Never leave
+debug mode activated in a production system because it will allow users to
+execute code on the server!</p>
+<p>We also add a method to easily connect to the database specified. That
+can be used to open a connection on request and also from the interactive
+Python shell or a script. This will come in handy later.</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">def</span> <span class="nf">connect_db</span><span class="p">():</span>
+ <span class="k">return</span> <span class="n">sqlite3</span><span class="o">.</span><span class="n">connect</span><span class="p">(</span><span class="n">app</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s">&#39;DATABASE&#39;</span><span class="p">])</span>
+</pre></div>
+</div>
+<p>Finally we just add a line to the bottom of the file that fires up the
+server if we want to run that file as a standalone application:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">&#39;__main__&#39;</span><span class="p">:</span>
+ <span class="n">app</span><span class="o">.</span><span class="n">run</span><span class="p">()</span>
+</pre></div>
+</div>
+<p>With that out of the way you should be able to start up the application
+without problems. Do this with the following command:</p>
+<div class="highlight-python"><pre>python flaskr.py</pre>
+</div>
+<p>You will see a message telling you that server has started along with
+the address at which you can access it.</p>
+<p>When you head over to the server in your browser you will get an 404
+page not found error because we don&#8217;t have any views yet. But we will
+focus on that a little later. First we should get the database working.</p>
+<div class="admonition-externally-visible-server admonition ">
+<p class="first admonition-title">Externally Visible Server</p>
+<p class="last">Want your server to be publicly available? Check out the
+<a class="reference internal" href="../quickstart.html#public-server"><em>externally visible server</em></a> section for more
+information.</p>
+</div>
+<p>Continue with <a class="reference internal" href="dbinit.html#tutorial-dbinit"><em>Step 3: Creating The Database</em></a>.</p>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="../index.html">
+ <img class="logo" src="../_static/flask.png" alt="Logo"/>
+</a></p><h3>Related Topics</h3>
+<ul>
+ <li><a href="../index.html">Documentation overview</a><ul>
+ <li><a href="index.html">Tutorial</a><ul>
+ <li>Previous: <a href="schema.html" title="previous chapter">Step 1: Database Schema</a></li>
+ <li>Next: <a href="dbinit.html" title="next chapter">Step 3: Creating The Database</a></li>
+ </ul></li>
+ </ul></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="../_sources/tutorial/setup.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/tutorial/templates.html b/app/static/doc/flask-docs/tutorial/templates.html
new file mode 100644
index 0000000..9c99a35
--- /dev/null
+++ b/app/static/doc/flask-docs/tutorial/templates.html
@@ -0,0 +1,212 @@
+
+<!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>Step 6: The Templates &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="../index.html" />
+ <link rel="up" title="Tutorial" href="index.html" />
+ <link rel="next" title="Step 7: Adding Style" href="css.html" />
+ <link rel="prev" title="Step 5: The View Functions" href="views.html" />
+
+
+ <link rel="apple-touch-icon" href="../_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="../_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <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="css.html" title="Step 7: Adding Style"
+ accesskey="N">next</a> |</li>
+ <li class="right" >
+ <a href="views.html" title="Step 5: The View Functions"
+ accesskey="P">previous</a> |</li>
+ <li><a href="../index.html">Flask 0.8 documentation</a> &raquo;</li>
+ <li><a href="index.html" accesskey="U">Tutorial</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="step-6-the-templates">
+<span id="tutorial-templates"></span><h1>Step 6: The Templates<a class="headerlink" href="#step-6-the-templates" title="Permalink to this headline">¶</a></h1>
+<p>Now we should start working on the templates. If we request the URLs now
+we would only get an exception that Flask cannot find the templates. The
+templates are using <a class="reference external" href="http://jinja.pocoo.org/2/documentation/templates">Jinja2</a> syntax and have autoescaping enabled by
+default. This means that unless you mark a value in the code with
+<a class="reference internal" href="../api.html#flask.Markup" title="flask.Markup"><tt class="xref py py-class docutils literal"><span class="pre">Markup</span></tt></a> or with the <tt class="docutils literal"><span class="pre">|safe</span></tt> filter in the template,
+Jinja2 will ensure that special characters such as <tt class="docutils literal"><span class="pre">&lt;</span></tt> or <tt class="docutils literal"><span class="pre">&gt;</span></tt> are
+escaped with their XML equivalents.</p>
+<p>We are also using template inheritance which makes it possible to reuse
+the layout of the website in all pages.</p>
+<p>Put the following templates into the <cite>templates</cite> folder:</p>
+<div class="section" id="layout-html">
+<h2>layout.html<a class="headerlink" href="#layout-html" title="Permalink to this headline">¶</a></h2>
+<p>This template contains the HTML skeleton, the header and a link to log in
+(or log out if the user was already logged in). It also displays the
+flashed messages if there are any. The <tt class="docutils literal"><span class="pre">{%</span> <span class="pre">block</span> <span class="pre">body</span> <span class="pre">%}</span></tt> block can be
+replaced by a block of the same name (<tt class="docutils literal"><span class="pre">body</span></tt>) in a child template.</p>
+<p>The <a class="reference internal" href="../api.html#flask.session" title="flask.session"><tt class="xref py py-class docutils literal"><span class="pre">session</span></tt></a> dict is available in the template as well and
+you can use that to check if the user is logged in or not. Note that in
+Jinja you can access missing attributes and items of objects / dicts which
+makes the following code work, even if there is no <tt class="docutils literal"><span class="pre">'logged_in'</span></tt> key in
+the session:</p>
+<div class="highlight-html+jinja"><div class="highlight"><pre><span class="cp">&lt;!doctype html&gt;</span>
+<span class="nt">&lt;title&gt;</span>Flaskr<span class="nt">&lt;/title&gt;</span>
+<span class="nt">&lt;link</span> <span class="na">rel=</span><span class="s">stylesheet</span> <span class="na">type=</span><span class="s">text/css</span> <span class="na">href=</span><span class="s">&quot;</span><span class="cp">{{</span> <span class="nv">url_for</span><span class="o">(</span><span class="s1">&#39;static&#39;</span><span class="o">,</span> <span class="nv">filename</span><span class="o">=</span><span class="s1">&#39;style.css&#39;</span><span class="o">)</span> <span class="cp">}}</span><span class="s">&quot;</span><span class="nt">&gt;</span>
+<span class="nt">&lt;div</span> <span class="na">class=</span><span class="s">page</span><span class="nt">&gt;</span>
+ <span class="nt">&lt;h1&gt;</span>Flaskr<span class="nt">&lt;/h1&gt;</span>
+ <span class="nt">&lt;div</span> <span class="na">class=</span><span class="s">metanav</span><span class="nt">&gt;</span>
+ <span class="cp">{%</span> <span class="k">if</span> <span class="k">not</span> <span class="nv">session.logged_in</span> <span class="cp">%}</span>
+ <span class="nt">&lt;a</span> <span class="na">href=</span><span class="s">&quot;</span><span class="cp">{{</span> <span class="nv">url_for</span><span class="o">(</span><span class="s1">&#39;login&#39;</span><span class="o">)</span> <span class="cp">}}</span><span class="s">&quot;</span><span class="nt">&gt;</span>log in<span class="nt">&lt;/a&gt;</span>
+ <span class="cp">{%</span> <span class="k">else</span> <span class="cp">%}</span>
+ <span class="nt">&lt;a</span> <span class="na">href=</span><span class="s">&quot;</span><span class="cp">{{</span> <span class="nv">url_for</span><span class="o">(</span><span class="s1">&#39;logout&#39;</span><span class="o">)</span> <span class="cp">}}</span><span class="s">&quot;</span><span class="nt">&gt;</span>log out<span class="nt">&lt;/a&gt;</span>
+ <span class="cp">{%</span> <span class="k">endif</span> <span class="cp">%}</span>
+ <span class="nt">&lt;/div&gt;</span>
+ <span class="cp">{%</span> <span class="k">for</span> <span class="nv">message</span> <span class="k">in</span> <span class="nv">get_flashed_messages</span><span class="o">()</span> <span class="cp">%}</span>
+ <span class="nt">&lt;div</span> <span class="na">class=</span><span class="s">flash</span><span class="nt">&gt;</span><span class="cp">{{</span> <span class="nv">message</span> <span class="cp">}}</span><span class="nt">&lt;/div&gt;</span>
+ <span class="cp">{%</span> <span class="k">endfor</span> <span class="cp">%}</span>
+ <span class="cp">{%</span> <span class="k">block</span> <span class="nv">body</span> <span class="cp">%}{%</span> <span class="k">endblock</span> <span class="cp">%}</span>
+<span class="nt">&lt;/div&gt;</span>
+</pre></div>
+</div>
+</div>
+<div class="section" id="show-entries-html">
+<h2>show_entries.html<a class="headerlink" href="#show-entries-html" title="Permalink to this headline">¶</a></h2>
+<p>This template extends the <cite>layout.html</cite> template from above to display the
+messages. Note that the <cite>for</cite> loop iterates over the messages we passed
+in with the <a class="reference internal" href="../api.html#flask.render_template" title="flask.render_template"><tt class="xref py py-func docutils literal"><span class="pre">render_template()</span></tt></a> function. We also tell the
+form to submit to your <cite>add_entry</cite> function and use <cite>POST</cite> as <cite>HTTP</cite>
+method:</p>
+<div class="highlight-html+jinja"><div class="highlight"><pre><span class="cp">{%</span> <span class="k">extends</span> <span class="s2">&quot;layout.html&quot;</span> <span class="cp">%}</span>
+<span class="cp">{%</span> <span class="k">block</span> <span class="nv">body</span> <span class="cp">%}</span>
+ <span class="cp">{%</span> <span class="k">if</span> <span class="nv">session.logged_in</span> <span class="cp">%}</span>
+ <span class="nt">&lt;form</span> <span class="na">action=</span><span class="s">&quot;</span><span class="cp">{{</span> <span class="nv">url_for</span><span class="o">(</span><span class="s1">&#39;add_entry&#39;</span><span class="o">)</span> <span class="cp">}}</span><span class="s">&quot;</span> <span class="na">method=</span><span class="s">post</span> <span class="na">class=</span><span class="s">add-entry</span><span class="nt">&gt;</span>
+ <span class="nt">&lt;dl&gt;</span>
+ <span class="nt">&lt;dt&gt;</span>Title:
+ <span class="nt">&lt;dd&gt;&lt;input</span> <span class="na">type=</span><span class="s">text</span> <span class="na">size=</span><span class="s">30</span> <span class="na">name=</span><span class="s">title</span><span class="nt">&gt;</span>
+ <span class="nt">&lt;dt&gt;</span>Text:
+ <span class="nt">&lt;dd&gt;&lt;textarea</span> <span class="na">name=</span><span class="s">text</span> <span class="na">rows=</span><span class="s">5</span> <span class="na">cols=</span><span class="s">40</span><span class="nt">&gt;&lt;/textarea&gt;</span>
+ <span class="nt">&lt;dd&gt;&lt;input</span> <span class="na">type=</span><span class="s">submit</span> <span class="na">value=</span><span class="s">Share</span><span class="nt">&gt;</span>
+ <span class="nt">&lt;/dl&gt;</span>
+ <span class="nt">&lt;/form&gt;</span>
+ <span class="cp">{%</span> <span class="k">endif</span> <span class="cp">%}</span>
+ <span class="nt">&lt;ul</span> <span class="na">class=</span><span class="s">entries</span><span class="nt">&gt;</span>
+ <span class="cp">{%</span> <span class="k">for</span> <span class="nv">entry</span> <span class="k">in</span> <span class="nv">entries</span> <span class="cp">%}</span>
+ <span class="nt">&lt;li&gt;&lt;h2&gt;</span><span class="cp">{{</span> <span class="nv">entry.title</span> <span class="cp">}}</span><span class="nt">&lt;/h2&gt;</span><span class="cp">{{</span> <span class="nv">entry.text</span><span class="o">|</span><span class="nf">safe</span> <span class="cp">}}</span>
+ <span class="cp">{%</span> <span class="k">else</span> <span class="cp">%}</span>
+ <span class="nt">&lt;li&gt;&lt;em&gt;</span>Unbelievable. No entries here so far<span class="nt">&lt;/em&gt;</span>
+ <span class="cp">{%</span> <span class="k">endfor</span> <span class="cp">%}</span>
+ <span class="nt">&lt;/ul&gt;</span>
+<span class="cp">{%</span> <span class="k">endblock</span> <span class="cp">%}</span>
+</pre></div>
+</div>
+</div>
+<div class="section" id="login-html">
+<h2>login.html<a class="headerlink" href="#login-html" title="Permalink to this headline">¶</a></h2>
+<p>Finally the login template which basically just displays a form to allow
+the user to login:</p>
+<div class="highlight-html+jinja"><div class="highlight"><pre><span class="cp">{%</span> <span class="k">extends</span> <span class="s2">&quot;layout.html&quot;</span> <span class="cp">%}</span>
+<span class="cp">{%</span> <span class="k">block</span> <span class="nv">body</span> <span class="cp">%}</span>
+ <span class="nt">&lt;h2&gt;</span>Login<span class="nt">&lt;/h2&gt;</span>
+ <span class="cp">{%</span> <span class="k">if</span> <span class="nv">error</span> <span class="cp">%}</span><span class="nt">&lt;p</span> <span class="na">class=</span><span class="s">error</span><span class="nt">&gt;&lt;strong&gt;</span>Error:<span class="nt">&lt;/strong&gt;</span> <span class="cp">{{</span> <span class="nv">error</span> <span class="cp">}}{%</span> <span class="k">endif</span> <span class="cp">%}</span>
+ <span class="nt">&lt;form</span> <span class="na">action=</span><span class="s">&quot;</span><span class="cp">{{</span> <span class="nv">url_for</span><span class="o">(</span><span class="s1">&#39;login&#39;</span><span class="o">)</span> <span class="cp">}}</span><span class="s">&quot;</span> <span class="na">method=</span><span class="s">post</span><span class="nt">&gt;</span>
+ <span class="nt">&lt;dl&gt;</span>
+ <span class="nt">&lt;dt&gt;</span>Username:
+ <span class="nt">&lt;dd&gt;&lt;input</span> <span class="na">type=</span><span class="s">text</span> <span class="na">name=</span><span class="s">username</span><span class="nt">&gt;</span>
+ <span class="nt">&lt;dt&gt;</span>Password:
+ <span class="nt">&lt;dd&gt;&lt;input</span> <span class="na">type=</span><span class="s">password</span> <span class="na">name=</span><span class="s">password</span><span class="nt">&gt;</span>
+ <span class="nt">&lt;dd&gt;&lt;input</span> <span class="na">type=</span><span class="s">submit</span> <span class="na">value=</span><span class="s">Login</span><span class="nt">&gt;</span>
+ <span class="nt">&lt;/dl&gt;</span>
+ <span class="nt">&lt;/form&gt;</span>
+<span class="cp">{%</span> <span class="k">endblock</span> <span class="cp">%}</span>
+</pre></div>
+</div>
+<p>Continue with <a class="reference internal" href="css.html#tutorial-css"><em>Step 7: Adding Style</em></a>.</p>
+</div>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="../index.html">
+ <img class="logo" src="../_static/flask.png" alt="Logo"/>
+</a></p>
+ <h3><a href="../index.html">Table Of Contents</a></h3>
+ <ul>
+<li><a class="reference internal" href="#">Step 6: The Templates</a><ul>
+<li><a class="reference internal" href="#layout-html">layout.html</a></li>
+<li><a class="reference internal" href="#show-entries-html">show_entries.html</a></li>
+<li><a class="reference internal" href="#login-html">login.html</a></li>
+</ul>
+</li>
+</ul>
+<h3>Related Topics</h3>
+<ul>
+ <li><a href="../index.html">Documentation overview</a><ul>
+ <li><a href="index.html">Tutorial</a><ul>
+ <li>Previous: <a href="views.html" title="previous chapter">Step 5: The View Functions</a></li>
+ <li>Next: <a href="css.html" title="next chapter">Step 7: Adding Style</a></li>
+ </ul></li>
+ </ul></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="../_sources/tutorial/templates.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/tutorial/testing.html b/app/static/doc/flask-docs/tutorial/testing.html
new file mode 100644
index 0000000..ba82db6
--- /dev/null
+++ b/app/static/doc/flask-docs/tutorial/testing.html
@@ -0,0 +1,113 @@
+
+<!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>Bonus: Testing the Application &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="../index.html" />
+ <link rel="up" title="Tutorial" href="index.html" />
+ <link rel="next" title="Templates" href="../templating.html" />
+ <link rel="prev" title="Step 7: Adding Style" href="css.html" />
+
+
+ <link rel="apple-touch-icon" href="../_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="../_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <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="../templating.html" title="Templates"
+ accesskey="N">next</a> |</li>
+ <li class="right" >
+ <a href="css.html" title="Step 7: Adding Style"
+ accesskey="P">previous</a> |</li>
+ <li><a href="../index.html">Flask 0.8 documentation</a> &raquo;</li>
+ <li><a href="index.html" accesskey="U">Tutorial</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="bonus-testing-the-application">
+<span id="tutorial-testing"></span><h1>Bonus: Testing the Application<a class="headerlink" href="#bonus-testing-the-application" title="Permalink to this headline">¶</a></h1>
+<p>Now that you have finished the application and everything works as
+expected, it&#8217;s probably not a bad idea to add automated tests to simplify
+modifications in the future. The application above is used as a basic
+example of how to perform unittesting in the <a class="reference internal" href="../testing.html#testing"><em>Testing Flask Applications</em></a> section of the
+documentation. Go there to see how easy it is to test Flask applications.</p>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="../index.html">
+ <img class="logo" src="../_static/flask.png" alt="Logo"/>
+</a></p><h3>Related Topics</h3>
+<ul>
+ <li><a href="../index.html">Documentation overview</a><ul>
+ <li><a href="index.html">Tutorial</a><ul>
+ <li>Previous: <a href="css.html" title="previous chapter">Step 7: Adding Style</a></li>
+ <li>Next: <a href="../templating.html" title="next chapter">Templates</a></li>
+ </ul></li>
+ </ul></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="../_sources/tutorial/testing.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/tutorial/views.html b/app/static/doc/flask-docs/tutorial/views.html
new file mode 100644
index 0000000..feed988
--- /dev/null
+++ b/app/static/doc/flask-docs/tutorial/views.html
@@ -0,0 +1,206 @@
+
+<!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>Step 5: The View Functions &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="../index.html" />
+ <link rel="up" title="Tutorial" href="index.html" />
+ <link rel="next" title="Step 6: The Templates" href="templates.html" />
+ <link rel="prev" title="Step 4: Request Database Connections" href="dbcon.html" />
+
+
+ <link rel="apple-touch-icon" href="../_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="../_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <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="templates.html" title="Step 6: The Templates"
+ accesskey="N">next</a> |</li>
+ <li class="right" >
+ <a href="dbcon.html" title="Step 4: Request Database Connections"
+ accesskey="P">previous</a> |</li>
+ <li><a href="../index.html">Flask 0.8 documentation</a> &raquo;</li>
+ <li><a href="index.html" accesskey="U">Tutorial</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="step-5-the-view-functions">
+<span id="tutorial-views"></span><h1>Step 5: The View Functions<a class="headerlink" href="#step-5-the-view-functions" title="Permalink to this headline">¶</a></h1>
+<p>Now that the database connections are working we can start writing the
+view functions. We will need four of them:</p>
+<div class="section" id="show-entries">
+<h2>Show Entries<a class="headerlink" href="#show-entries" title="Permalink to this headline">¶</a></h2>
+<p>This view shows all the entries stored in the database. It listens on the
+root of the application and will select title and text from the database.
+The one with the highest id (the newest entry) will be on top. The rows
+returned from the cursor are tuples with the columns ordered like specified
+in the select statement. This is good enough for small applications like
+here, but you might want to convert them into a dict. If you are
+interested in how to do that, check out the <a class="reference internal" href="../patterns/sqlite3.html#easy-querying"><em>Easy Querying</em></a> example.</p>
+<p>The view function will pass the entries as dicts to the
+<cite>show_entries.html</cite> template and return the rendered one:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/&#39;</span><span class="p">)</span>
+<span class="k">def</span> <span class="nf">show_entries</span><span class="p">():</span>
+ <span class="n">cur</span> <span class="o">=</span> <span class="n">g</span><span class="o">.</span><span class="n">db</span><span class="o">.</span><span class="n">execute</span><span class="p">(</span><span class="s">&#39;select title, text from entries order by id desc&#39;</span><span class="p">)</span>
+ <span class="n">entries</span> <span class="o">=</span> <span class="p">[</span><span class="nb">dict</span><span class="p">(</span><span class="n">title</span><span class="o">=</span><span class="n">row</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">text</span><span class="o">=</span><span class="n">row</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span> <span class="k">for</span> <span class="n">row</span> <span class="ow">in</span> <span class="n">cur</span><span class="o">.</span><span class="n">fetchall</span><span class="p">()]</span>
+ <span class="k">return</span> <span class="n">render_template</span><span class="p">(</span><span class="s">&#39;show_entries.html&#39;</span><span class="p">,</span> <span class="n">entries</span><span class="o">=</span><span class="n">entries</span><span class="p">)</span>
+</pre></div>
+</div>
+</div>
+<div class="section" id="add-new-entry">
+<h2>Add New Entry<a class="headerlink" href="#add-new-entry" title="Permalink to this headline">¶</a></h2>
+<p>This view lets the user add new entries if they are logged in. This only
+responds to <cite>POST</cite> requests, the actual form is shown on the
+<cite>show_entries</cite> page. If everything worked out well we will
+<a class="reference internal" href="../api.html#flask.flash" title="flask.flash"><tt class="xref py py-func docutils literal"><span class="pre">flash()</span></tt></a> an information message to the next request and
+redirect back to the <cite>show_entries</cite> page:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/add&#39;</span><span class="p">,</span> <span class="n">methods</span><span class="o">=</span><span class="p">[</span><span class="s">&#39;POST&#39;</span><span class="p">])</span>
+<span class="k">def</span> <span class="nf">add_entry</span><span class="p">():</span>
+ <span class="k">if</span> <span class="ow">not</span> <span class="n">session</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;logged_in&#39;</span><span class="p">):</span>
+ <span class="n">abort</span><span class="p">(</span><span class="mi">401</span><span class="p">)</span>
+ <span class="n">g</span><span class="o">.</span><span class="n">db</span><span class="o">.</span><span class="n">execute</span><span class="p">(</span><span class="s">&#39;insert into entries (title, text) values (?, ?)&#39;</span><span class="p">,</span>
+ <span class="p">[</span><span class="n">request</span><span class="o">.</span><span class="n">form</span><span class="p">[</span><span class="s">&#39;title&#39;</span><span class="p">],</span> <span class="n">request</span><span class="o">.</span><span class="n">form</span><span class="p">[</span><span class="s">&#39;text&#39;</span><span class="p">]])</span>
+ <span class="n">g</span><span class="o">.</span><span class="n">db</span><span class="o">.</span><span class="n">commit</span><span class="p">()</span>
+ <span class="n">flash</span><span class="p">(</span><span class="s">&#39;New entry was successfully posted&#39;</span><span class="p">)</span>
+ <span class="k">return</span> <span class="n">redirect</span><span class="p">(</span><span class="n">url_for</span><span class="p">(</span><span class="s">&#39;show_entries&#39;</span><span class="p">))</span>
+</pre></div>
+</div>
+<p>Note that we check that the user is logged in here (the <cite>logged_in</cite> key is
+present in the session and <cite>True</cite>).</p>
+<div class="admonition-security-note admonition ">
+<p class="first admonition-title">Security Note</p>
+<p class="last">Be sure to use question marks when building SQL statements, as done in the
+example above. Otherwise, your app will be vulnerable to SQL injection when
+you use string formatting to build SQL statements.
+See <a class="reference internal" href="../patterns/sqlite3.html#sqlite3"><em>Using SQLite 3 with Flask</em></a> for more.</p>
+</div>
+</div>
+<div class="section" id="login-and-logout">
+<h2>Login and Logout<a class="headerlink" href="#login-and-logout" title="Permalink to this headline">¶</a></h2>
+<p>These functions are used to sign the user in and out. Login checks the
+username and password against the ones from the configuration and sets the
+<cite>logged_in</cite> key in the session. If the user logged in successfully, that
+key is set to <cite>True</cite>, and the user is redirected back to the <cite>show_entries</cite>
+page. In addition, a message is flashed that informs the user that he or
+she was logged in successfully. If an error occurred, the template is
+notified about that, and the user is asked again:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/login&#39;</span><span class="p">,</span> <span class="n">methods</span><span class="o">=</span><span class="p">[</span><span class="s">&#39;GET&#39;</span><span class="p">,</span> <span class="s">&#39;POST&#39;</span><span class="p">])</span>
+<span class="k">def</span> <span class="nf">login</span><span class="p">():</span>
+ <span class="n">error</span> <span class="o">=</span> <span class="bp">None</span>
+ <span class="k">if</span> <span class="n">request</span><span class="o">.</span><span class="n">method</span> <span class="o">==</span> <span class="s">&#39;POST&#39;</span><span class="p">:</span>
+ <span class="k">if</span> <span class="n">request</span><span class="o">.</span><span class="n">form</span><span class="p">[</span><span class="s">&#39;username&#39;</span><span class="p">]</span> <span class="o">!=</span> <span class="n">app</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s">&#39;USERNAME&#39;</span><span class="p">]:</span>
+ <span class="n">error</span> <span class="o">=</span> <span class="s">&#39;Invalid username&#39;</span>
+ <span class="k">elif</span> <span class="n">request</span><span class="o">.</span><span class="n">form</span><span class="p">[</span><span class="s">&#39;password&#39;</span><span class="p">]</span> <span class="o">!=</span> <span class="n">app</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s">&#39;PASSWORD&#39;</span><span class="p">]:</span>
+ <span class="n">error</span> <span class="o">=</span> <span class="s">&#39;Invalid password&#39;</span>
+ <span class="k">else</span><span class="p">:</span>
+ <span class="n">session</span><span class="p">[</span><span class="s">&#39;logged_in&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="bp">True</span>
+ <span class="n">flash</span><span class="p">(</span><span class="s">&#39;You were logged in&#39;</span><span class="p">)</span>
+ <span class="k">return</span> <span class="n">redirect</span><span class="p">(</span><span class="n">url_for</span><span class="p">(</span><span class="s">&#39;show_entries&#39;</span><span class="p">))</span>
+ <span class="k">return</span> <span class="n">render_template</span><span class="p">(</span><span class="s">&#39;login.html&#39;</span><span class="p">,</span> <span class="n">error</span><span class="o">=</span><span class="n">error</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>The logout function, on the other hand, removes that key from the session
+again. We use a neat trick here: if you use the <a class="reference external" href="http://docs.python.org/dev/library/stdtypes.html#dict.pop" title="(in Python v3.3)"><tt class="xref py py-meth docutils literal"><span class="pre">pop()</span></tt></a> method
+of the dict and pass a second parameter to it (the default), the method
+will delete the key from the dictionary if present or do nothing when that
+key is not in there. This is helpful because now we don&#8217;t have to check
+if the user was logged in.</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/logout&#39;</span><span class="p">)</span>
+<span class="k">def</span> <span class="nf">logout</span><span class="p">():</span>
+ <span class="n">session</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s">&#39;logged_in&#39;</span><span class="p">,</span> <span class="bp">None</span><span class="p">)</span>
+ <span class="n">flash</span><span class="p">(</span><span class="s">&#39;You were logged out&#39;</span><span class="p">)</span>
+ <span class="k">return</span> <span class="n">redirect</span><span class="p">(</span><span class="n">url_for</span><span class="p">(</span><span class="s">&#39;show_entries&#39;</span><span class="p">))</span>
+</pre></div>
+</div>
+<p>Continue with <a class="reference internal" href="templates.html#tutorial-templates"><em>Step 6: The Templates</em></a>.</p>
+</div>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="../index.html">
+ <img class="logo" src="../_static/flask.png" alt="Logo"/>
+</a></p>
+ <h3><a href="../index.html">Table Of Contents</a></h3>
+ <ul>
+<li><a class="reference internal" href="#">Step 5: The View Functions</a><ul>
+<li><a class="reference internal" href="#show-entries">Show Entries</a></li>
+<li><a class="reference internal" href="#add-new-entry">Add New Entry</a></li>
+<li><a class="reference internal" href="#login-and-logout">Login and Logout</a></li>
+</ul>
+</li>
+</ul>
+<h3>Related Topics</h3>
+<ul>
+ <li><a href="../index.html">Documentation overview</a><ul>
+ <li><a href="index.html">Tutorial</a><ul>
+ <li>Previous: <a href="dbcon.html" title="previous chapter">Step 4: Request Database Connections</a></li>
+ <li>Next: <a href="templates.html" title="next chapter">Step 6: The Templates</a></li>
+ </ul></li>
+ </ul></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="../_sources/tutorial/views.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/unicode.html b/app/static/doc/flask-docs/unicode.html
new file mode 100644
index 0000000..d5e4800
--- /dev/null
+++ b/app/static/doc/flask-docs/unicode.html
@@ -0,0 +1,215 @@
+
+<!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>Unicode in Flask &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="index.html" />
+ <link rel="next" title="Flask Extension Development" href="extensiondev.html" />
+ <link rel="prev" title="Security Considerations" href="security.html" />
+
+
+ <link rel="apple-touch-icon" href="_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <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="extensiondev.html" title="Flask Extension Development"
+ accesskey="N">next</a> |</li>
+ <li class="right" >
+ <a href="security.html" title="Security Considerations"
+ accesskey="P">previous</a> |</li>
+ <li><a href="index.html">Flask 0.8 documentation</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="unicode-in-flask">
+<h1>Unicode in Flask<a class="headerlink" href="#unicode-in-flask" title="Permalink to this headline">¶</a></h1>
+<p>Flask like Jinja2 and Werkzeug is totally Unicode based when it comes to
+text. Not only these libraries, also the majority of web related Python
+libraries that deal with text. If you don&#8217;t know Unicode so far, you
+should probably read <a class="reference external" href="http://www.joelonsoftware.com/articles/Unicode.html">The Absolute Minimum Every Software Developer
+Absolutely, Positively Must Know About Unicode and Character Sets</a>. This part of the
+documentation just tries to cover the very basics so that you have a
+pleasant experience with Unicode related things.</p>
+<div class="section" id="automatic-conversion">
+<h2>Automatic Conversion<a class="headerlink" href="#automatic-conversion" title="Permalink to this headline">¶</a></h2>
+<p>Flask has a few assumptions about your application (which you can change
+of course) that give you basic and painless Unicode support:</p>
+<ul class="simple">
+<li>the encoding for text on your website is UTF-8</li>
+<li>internally you will always use Unicode exclusively for text except
+for literal strings with only ASCII character points.</li>
+<li>encoding and decoding happens whenever you are talking over a protocol
+that requires bytes to be transmitted.</li>
+</ul>
+<p>So what does this mean to you?</p>
+<p>HTTP is based on bytes. Not only the protocol, also the system used to
+address documents on servers (so called URIs or URLs). However HTML which
+is usually transmitted on top of HTTP supports a large variety of
+character sets and which ones are used, are transmitted in an HTTP header.
+To not make this too complex Flask just assumes that if you are sending
+Unicode out you want it to be UTF-8 encoded. Flask will do the encoding
+and setting of the appropriate headers for you.</p>
+<p>The same is true if you are talking to databases with the help of
+SQLAlchemy or a similar ORM system. Some databases have a protocol that
+already transmits Unicode and if they do not, SQLAlchemy or your other ORM
+should take care of that.</p>
+</div>
+<div class="section" id="the-golden-rule">
+<h2>The Golden Rule<a class="headerlink" href="#the-golden-rule" title="Permalink to this headline">¶</a></h2>
+<p>So the rule of thumb: if you are not dealing with binary data, work with
+Unicode. What does working with Unicode in Python 2.x mean?</p>
+<ul class="simple">
+<li>as long as you are using ASCII charpoints only (basically numbers,
+some special characters of latin letters without umlauts or anything
+fancy) you can use regular string literals (<tt class="docutils literal"><span class="pre">'Hello</span> <span class="pre">World'</span></tt>).</li>
+<li>if you need anything else than ASCII in a string you have to mark
+this string as Unicode string by prefixing it with a lowercase <cite>u</cite>.
+(like <tt class="docutils literal"><span class="pre">u'Hänsel</span> <span class="pre">und</span> <span class="pre">Gretel'</span></tt>)</li>
+<li>if you are using non-Unicode characters in your Python files you have
+to tell Python which encoding your file uses. Again, I recommend
+UTF-8 for this purpose. To tell the interpreter your encoding you can
+put the <tt class="docutils literal"><span class="pre">#</span> <span class="pre">-*-</span> <span class="pre">coding:</span> <span class="pre">utf-8</span> <span class="pre">-*-</span></tt> into the first or second line of
+your Python source file.</li>
+<li>Jinja is configured to decode the template files from UTF-8. So make
+sure to tell your editor to save the file as UTF-8 there as well.</li>
+</ul>
+</div>
+<div class="section" id="encoding-and-decoding-yourself">
+<h2>Encoding and Decoding Yourself<a class="headerlink" href="#encoding-and-decoding-yourself" title="Permalink to this headline">¶</a></h2>
+<p>If you are talking with a filesystem or something that is not really based
+on Unicode you will have to ensure that you decode properly when working
+with Unicode interface. So for example if you want to load a file on the
+filesystem and embed it into a Jinja2 template you will have to decode it
+from the encoding of that file. Here the old problem that text files do
+not specify their encoding comes into play. So do yourself a favour and
+limit yourself to UTF-8 for text files as well.</p>
+<p>Anyways. To load such a file with Unicode you can use the built-in
+<tt class="xref py py-meth docutils literal"><span class="pre">str.decode()</span></tt> method:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">def</span> <span class="nf">read_file</span><span class="p">(</span><span class="n">filename</span><span class="p">,</span> <span class="n">charset</span><span class="o">=</span><span class="s">&#39;utf-8&#39;</span><span class="p">):</span>
+ <span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">filename</span><span class="p">,</span> <span class="s">&#39;r&#39;</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
+ <span class="k">return</span> <span class="n">f</span><span class="o">.</span><span class="n">read</span><span class="p">()</span><span class="o">.</span><span class="n">decode</span><span class="p">(</span><span class="n">charset</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>To go from Unicode into a specific charset such as UTF-8 you can use the
+<tt class="xref py py-meth docutils literal"><span class="pre">unicode.encode()</span></tt> method:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">def</span> <span class="nf">write_file</span><span class="p">(</span><span class="n">filename</span><span class="p">,</span> <span class="n">contents</span><span class="p">,</span> <span class="n">charset</span><span class="o">=</span><span class="s">&#39;utf-8&#39;</span><span class="p">):</span>
+ <span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">filename</span><span class="p">,</span> <span class="s">&#39;w&#39;</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
+ <span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">contents</span><span class="o">.</span><span class="n">encode</span><span class="p">(</span><span class="n">charset</span><span class="p">))</span>
+</pre></div>
+</div>
+</div>
+<div class="section" id="configuring-editors">
+<h2>Configuring Editors<a class="headerlink" href="#configuring-editors" title="Permalink to this headline">¶</a></h2>
+<p>Most editors save as UTF-8 by default nowadays but in case your editor is
+not configured to do this you have to change it. Here some common ways to
+set your editor to store as UTF-8:</p>
+<ul>
+<li><p class="first">Vim: put <tt class="docutils literal"><span class="pre">set</span> <span class="pre">enc=utf-8</span></tt> to your <tt class="docutils literal"><span class="pre">.vimrc</span></tt> file.</p>
+</li>
+<li><p class="first">Emacs: either use an encoding cookie or put this into your <tt class="docutils literal"><span class="pre">.emacs</span></tt>
+file:</p>
+<div class="highlight-python"><pre>(prefer-coding-system 'utf-8)
+(setq default-buffer-file-coding-system 'utf-8)</pre>
+</div>
+</li>
+<li><p class="first">Notepad++:</p>
+<ol class="arabic simple">
+<li>Go to <em>Settings -&gt; Preferences ...</em></li>
+<li>Select the &#8220;New Document/Default Directory&#8221; tab</li>
+<li>Select &#8220;UTF-8 without BOM&#8221; as encoding</li>
+</ol>
+<p>It is also recommended to use the Unix newline format, you can select
+it in the same panel but this is not a requirement.</p>
+</li>
+</ul>
+</div>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="index.html">
+ <img class="logo" src="_static/flask.png" alt="Logo"/>
+</a></p>
+ <h3><a href="index.html">Table Of Contents</a></h3>
+ <ul>
+<li><a class="reference internal" href="#">Unicode in Flask</a><ul>
+<li><a class="reference internal" href="#automatic-conversion">Automatic Conversion</a></li>
+<li><a class="reference internal" href="#the-golden-rule">The Golden Rule</a></li>
+<li><a class="reference internal" href="#encoding-and-decoding-yourself">Encoding and Decoding Yourself</a></li>
+<li><a class="reference internal" href="#configuring-editors">Configuring Editors</a></li>
+</ul>
+</li>
+</ul>
+<h3>Related Topics</h3>
+<ul>
+ <li><a href="index.html">Documentation overview</a><ul>
+ <li>Previous: <a href="security.html" title="previous chapter">Security Considerations</a></li>
+ <li>Next: <a href="extensiondev.html" title="next chapter">Flask Extension Development</a></li>
+ </ul></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="_sources/unicode.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/upgrading.html b/app/static/doc/flask-docs/upgrading.html
new file mode 100644
index 0000000..258ab34
--- /dev/null
+++ b/app/static/doc/flask-docs/upgrading.html
@@ -0,0 +1,421 @@
+
+<!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>Upgrading to Newer Releases &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="index.html" />
+ <link rel="next" title="Flask Changelog" href="changelog.html" />
+ <link rel="prev" title="Pocoo Styleguide" href="styleguide.html" />
+
+
+ <link rel="apple-touch-icon" href="_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <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="changelog.html" title="Flask Changelog"
+ accesskey="N">next</a> |</li>
+ <li class="right" >
+ <a href="styleguide.html" title="Pocoo Styleguide"
+ accesskey="P">previous</a> |</li>
+ <li><a href="index.html">Flask 0.8 documentation</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="upgrading-to-newer-releases">
+<h1>Upgrading to Newer Releases<a class="headerlink" href="#upgrading-to-newer-releases" title="Permalink to this headline">¶</a></h1>
+<p>Flask itself is changing like any software is changing over time. Most of
+the changes are the nice kind, the kind where you don&#8217;t have to change
+anything in your code to profit from a new release.</p>
+<p>However every once in a while there are changes that do require some
+changes in your code or there are changes that make it possible for you to
+improve your own code quality by taking advantage of new features in
+Flask.</p>
+<p>This section of the documentation enumerates all the changes in Flask from
+release to release and how you can change your code to have a painless
+updating experience.</p>
+<p>If you want to use the <cite>easy_install</cite> command to upgrade your Flask
+installation, make sure to pass it the <tt class="docutils literal"><span class="pre">-U</span></tt> parameter:</p>
+<div class="highlight-python"><pre>$ easy_install -U Flask</pre>
+</div>
+<div class="section" id="version-0-8">
+<h2>Version 0.8<a class="headerlink" href="#version-0-8" title="Permalink to this headline">¶</a></h2>
+<p>Flask introduced a new session interface system. We also noticed that
+there was a naming collision between <cite>flask.session</cite> the module that
+implements sessions and <a class="reference internal" href="api.html#flask.session" title="flask.session"><tt class="xref py py-data docutils literal"><span class="pre">flask.session</span></tt></a> which is the global session
+object. With that introduction we moved the implementation details for
+the session system into a new module called <tt class="xref py py-mod docutils literal"><span class="pre">flask.sessions</span></tt>. If you
+used the previously undocumented session support we urge you to upgrade.</p>
+<p>If invalid JSON data was submitted Flask will now raise a
+<a class="reference external" href="http://werkzeug.pocoo.org/docs/exceptions/#werkzeug.exceptions.BadRequest" title="(in Werkzeug v0.7)"><tt class="xref py py-exc docutils literal"><span class="pre">BadRequest</span></tt></a> exception instead of letting the
+default <a class="reference external" href="http://docs.python.org/dev/library/exceptions.html#ValueError" title="(in Python v3.3)"><tt class="xref py py-exc docutils literal"><span class="pre">ValueError</span></tt></a> bubble up. This has the advantage that you no
+longer have to handle that error to avoid an internal server error showing
+up for the user. If you were catching this down explicitly in the past
+as <cite>ValueError</cite> you will need to change this.</p>
+<p>Due to a bug in the test client Flask 0.7 did not trigger teardown
+handlers when the test client was used in a with statement. This was
+since fixed but might require some changes in your testsuites if you
+relied on this behavior.</p>
+</div>
+<div class="section" id="version-0-7">
+<h2>Version 0.7<a class="headerlink" href="#version-0-7" title="Permalink to this headline">¶</a></h2>
+<p>In Flask 0.7 we cleaned up the code base internally a lot and did some
+backwards incompatible changes that make it easier to implement larger
+applications with Flask. Because we want to make upgrading as easy as
+possible we tried to counter the problems arising from these changes by
+providing a script that can ease the transition.</p>
+<p>The script scans your whole application and generates an unified diff with
+changes it assumes are safe to apply. However as this is an automated
+tool it won&#8217;t be able to find all use cases and it might miss some. We
+internally spread a lot of deprecation warnings all over the place to make
+it easy to find pieces of code that it was unable to upgrade.</p>
+<p>We strongly recommend that you hand review the generated patchfile and
+only apply the chunks that look good.</p>
+<p>If you are using git as version control system for your project we
+recommend applying the patch with <tt class="docutils literal"><span class="pre">path</span> <span class="pre">-p1</span> <span class="pre">&lt;</span> <span class="pre">patchfile.diff</span></tt> and then
+using the interactive commit feature to only apply the chunks that look
+good.</p>
+<p>To apply the upgrade script do the following:</p>
+<ol class="arabic">
+<li><p class="first">Download the script: <a class="reference external" href="https://raw.github.com/mitsuhiko/flask/master/scripts/flask-07-upgrade.py">flask-07-upgrade.py</a></p>
+</li>
+<li><p class="first">Run it in the directory of your application:</p>
+<div class="highlight-python"><pre>python flask-07-upgrade.py &gt; patchfile.diff</pre>
+</div>
+</li>
+<li><p class="first">Review the generated patchfile.</p>
+</li>
+<li><p class="first">Apply the patch:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="n">patch</span> <span class="o">-</span><span class="n">p1</span> <span class="o">&lt;</span> <span class="n">patchfile</span><span class="o">.</span><span class="n">diff</span>
+</pre></div>
+</div>
+</li>
+<li><p class="first">If you were using per-module template folders you need to move some
+templates around. Previously if you had a folder named <tt class="docutils literal"><span class="pre">templates</span></tt>
+next to a blueprint named <tt class="docutils literal"><span class="pre">admin</span></tt> the implicit template path
+automatically was <tt class="docutils literal"><span class="pre">admin/index.html</span></tt> for a template file called
+<tt class="docutils literal"><span class="pre">templates/index.html</span></tt>. This no longer is the case. Now you need
+to name the template <tt class="docutils literal"><span class="pre">templates/admin/index.html</span></tt>. The tool will
+not detect this so you will have to do that on your own.</p>
+</li>
+</ol>
+<p>Please note that deprecation warnings are disabled by default starting
+with Python 2.7. In order to see the deprecation warnings that might be
+emitted you have to enabled them with the <a class="reference external" href="http://docs.python.org/dev/library/warnings.html#warnings" title="(in Python v3.3)"><tt class="xref py py-mod docutils literal"><span class="pre">warnings</span></tt></a> module.</p>
+<p>If you are working with windows and you lack the <cite>patch</cite> command line
+utility you can get it as part of various Unix runtime environments for
+windows including cygwin, msysgit or ming32. Also source control systems
+like svn, hg or git have builtin support for applying unified diffs as
+generated by the tool. Check the manual of your version control system
+for more information.</p>
+<div class="section" id="bug-in-request-locals">
+<h3>Bug in Request Locals<a class="headerlink" href="#bug-in-request-locals" title="Permalink to this headline">¶</a></h3>
+<p>Due to a bug in earlier implementations the request local proxies now
+raise a <a class="reference external" href="http://docs.python.org/dev/library/exceptions.html#RuntimeError" title="(in Python v3.3)"><tt class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></tt></a> instead of an <a class="reference external" href="http://docs.python.org/dev/library/exceptions.html#AttributeError" title="(in Python v3.3)"><tt class="xref py py-exc docutils literal"><span class="pre">AttributeError</span></tt></a> when they
+are unbound. If you caught these exceptions with <a class="reference external" href="http://docs.python.org/dev/library/exceptions.html#AttributeError" title="(in Python v3.3)"><tt class="xref py py-exc docutils literal"><span class="pre">AttributeError</span></tt></a>
+before, you should catch them with <a class="reference external" href="http://docs.python.org/dev/library/exceptions.html#RuntimeError" title="(in Python v3.3)"><tt class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></tt></a> now.</p>
+<p>Additionally the <a class="reference internal" href="api.html#flask.send_file" title="flask.send_file"><tt class="xref py py-func docutils literal"><span class="pre">send_file()</span></tt></a> function is now issuing
+deprecation warnings if you depend on functionality that will be removed
+in Flask 1.0. Previously it was possible to use etags and mimetypes
+when file objects were passed. This was unreliable and caused issues
+for a few setups. If you get a deprecation warning, make sure to
+update your application to work with either filenames there or disable
+etag attaching and attach them yourself.</p>
+<p>Old code:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">return</span> <span class="n">send_file</span><span class="p">(</span><span class="n">my_file_object</span><span class="p">)</span>
+<span class="k">return</span> <span class="n">send_file</span><span class="p">(</span><span class="n">my_file_object</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>New code:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">return</span> <span class="n">send_file</span><span class="p">(</span><span class="n">my_file_object</span><span class="p">,</span> <span class="n">add_etags</span><span class="o">=</span><span class="bp">False</span><span class="p">)</span>
+</pre></div>
+</div>
+</div>
+<div class="section" id="upgrading-to-new-teardown-handling">
+<span id="id1"></span><h3>Upgrading to new Teardown Handling<a class="headerlink" href="#upgrading-to-new-teardown-handling" title="Permalink to this headline">¶</a></h3>
+<p>We streamlined the behavior of the callbacks for request handling. For
+things that modify the response the <a class="reference internal" href="api.html#flask.Flask.after_request" title="flask.Flask.after_request"><tt class="xref py py-meth docutils literal"><span class="pre">after_request()</span></tt></a>
+decorators continue to work as expected, but for things that absolutely
+must happen at the end of request we introduced the new
+<a class="reference internal" href="api.html#flask.Flask.teardown_request" title="flask.Flask.teardown_request"><tt class="xref py py-meth docutils literal"><span class="pre">teardown_request()</span></tt></a> decorator. Unfortunately that
+change also made after-request work differently under error conditions.
+It&#8217;s not consistently skipped if exceptions happen whereas previously it
+might have been called twice to ensure it is executed at the end of the
+request.</p>
+<p>If you have database connection code that looks like this:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="nd">@app.after_request</span>
+<span class="k">def</span> <span class="nf">after_request</span><span class="p">(</span><span class="n">response</span><span class="p">):</span>
+ <span class="n">g</span><span class="o">.</span><span class="n">db</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
+ <span class="k">return</span> <span class="n">response</span>
+</pre></div>
+</div>
+<p>You are now encouraged to use this instead:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="nd">@app.teardown_request</span>
+<span class="k">def</span> <span class="nf">after_request</span><span class="p">(</span><span class="n">exception</span><span class="p">):</span>
+ <span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="n">g</span><span class="p">,</span> <span class="s">&#39;db&#39;</span><span class="p">):</span>
+ <span class="n">g</span><span class="o">.</span><span class="n">db</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
+</pre></div>
+</div>
+<p>On the upside this change greatly improves the internal code flow and
+makes it easier to customize the dispatching and error handling. This
+makes it now a lot easier to write unit tests as you can prevent closing
+down of database connections for a while. You can take advantage of the
+fact that the teardown callbacks are called when the response context is
+removed from the stack so a test can query the database after request
+handling:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">with</span> <span class="n">app</span><span class="o">.</span><span class="n">test_client</span><span class="p">()</span> <span class="k">as</span> <span class="n">client</span><span class="p">:</span>
+ <span class="n">resp</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;/&#39;</span><span class="p">)</span>
+ <span class="c"># g.db is still bound if there is such a thing</span>
+
+<span class="c"># and here it&#39;s gone</span>
+</pre></div>
+</div>
+</div>
+<div class="section" id="manual-error-handler-attaching">
+<h3>Manual Error Handler Attaching<a class="headerlink" href="#manual-error-handler-attaching" title="Permalink to this headline">¶</a></h3>
+<p>While it is still possible to attach error handlers to
+<tt class="xref py py-attr docutils literal"><span class="pre">Flask.error_handlers</span></tt> it&#8217;s discouraged to do so and in fact
+deprecated. In generaly we no longer recommend custom error handler
+attaching via assignments to the underlying dictionary due to the more
+complex internal handling to support arbitrary exception classes and
+blueprints. See <tt class="xref py py-meth docutils literal"><span class="pre">Flask.errorhandler()</span></tt> for more information.</p>
+<p>The proper upgrade is to change this:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="n">app</span><span class="o">.</span><span class="n">error_handlers</span><span class="p">[</span><span class="mi">403</span><span class="p">]</span> <span class="o">=</span> <span class="n">handle_error</span>
+</pre></div>
+</div>
+<p>Into this:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="n">app</span><span class="o">.</span><span class="n">register_error_handler</span><span class="p">(</span><span class="mi">403</span><span class="p">,</span> <span class="n">handle_error</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>Alternatively you should just attach the function with a decorator:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="nd">@app.errorhandler</span><span class="p">(</span><span class="mi">403</span><span class="p">)</span>
+<span class="k">def</span> <span class="nf">handle_error</span><span class="p">(</span><span class="n">e</span><span class="p">):</span>
+ <span class="o">...</span>
+</pre></div>
+</div>
+<p>(Note that <tt class="xref py py-meth docutils literal"><span class="pre">register_error_handler()</span></tt> is new in Flask 0.7)</p>
+</div>
+<div class="section" id="blueprint-support">
+<h3>Blueprint Support<a class="headerlink" href="#blueprint-support" title="Permalink to this headline">¶</a></h3>
+<p>Blueprints replace the previous concept of “Modules” in Flask. They
+provide better semantics for various features and work better with large
+applications. The update script provided should be able to upgrade your
+applications automatically, but there might be some cases where it fails
+to upgrade. What changed?</p>
+<ul class="simple">
+<li>Blueprints need explicit names. Modules had an automatic name
+guesssing scheme where the shortname for the module was taken from the
+last part of the import module. The upgrade script tries to guess
+that name but it might fail as this information could change at
+runtime.</li>
+<li>Blueprints have an inverse behavior for <tt class="xref py py-meth docutils literal"><span class="pre">url_for()</span></tt>. Previously
+<tt class="docutils literal"><span class="pre">.foo</span></tt> told <tt class="xref py py-meth docutils literal"><span class="pre">url_for()</span></tt> that it should look for the endpoint
+<cite>foo</cite> on the application. Now it means “relative to current module”.
+The script will inverse all calls to <tt class="xref py py-meth docutils literal"><span class="pre">url_for()</span></tt> automatically for
+you. It will do this in a very eager way so you might end up with
+some unnecessary leading dots in your code if you&#8217;re not using
+modules.</li>
+<li>Blueprints do not automatically provide static folders. They will
+also no longer automatically export templates from a folder called
+<cite>templates</cite> next to their location however but it can be enabled from
+the constructor. Same with static files: if you want to continue
+serving static files you need to tell the constructor explicitly the
+path to the static folder (which can be relative to the blueprint&#8217;s
+module path).</li>
+<li>Rendering templates was simplified. Now the blueprints can provide
+template folders which are added to a general template searchpath.
+This means that you need to add another subfolder with the blueprint&#8217;s
+name into that folder if you want <tt class="docutils literal"><span class="pre">blueprintname/template.html</span></tt> as
+the template name.</li>
+</ul>
+<p>If you continue to use the <cite>Module</cite> object which is deprecated, Flask will
+restore the previous behavior as good as possible. However we strongly
+recommend upgrading to the new blueprints as they provide a lot of useful
+improvement such as the ability to attach a blueprint multiple times,
+blueprint specific error handlers and a lot more.</p>
+</div>
+</div>
+<div class="section" id="version-0-6">
+<h2>Version 0.6<a class="headerlink" href="#version-0-6" title="Permalink to this headline">¶</a></h2>
+<p>Flask 0.6 comes with a backwards incompatible change which affects the
+order of after-request handlers. Previously they were called in the order
+of the registration, now they are called in reverse order. This change
+was made so that Flask behaves more like people expected it to work and
+how other systems handle request pre- and postprocessing. If you
+depend on the order of execution of post-request functions, be sure to
+change the order.</p>
+<p>Another change that breaks backwards compatibility is that context
+processors will no longer override values passed directly to the template
+rendering function. If for example <cite>request</cite> is as variable passed
+directly to the template, the default context processor will not override
+it with the current request object. This makes it easier to extend
+context processors later to inject additional variables without breaking
+existing template not expecting them.</p>
+</div>
+<div class="section" id="version-0-5">
+<h2>Version 0.5<a class="headerlink" href="#version-0-5" title="Permalink to this headline">¶</a></h2>
+<p>Flask 0.5 is the first release that comes as a Python package instead of a
+single module. There were a couple of internal refactoring so if you
+depend on undocumented internal details you probably have to adapt the
+imports.</p>
+<p>The following changes may be relevant to your application:</p>
+<ul class="simple">
+<li>autoescaping no longer happens for all templates. Instead it is
+configured to only happen on files ending with <tt class="docutils literal"><span class="pre">.html</span></tt>, <tt class="docutils literal"><span class="pre">.htm</span></tt>,
+<tt class="docutils literal"><span class="pre">.xml</span></tt> and <tt class="docutils literal"><span class="pre">.xhtml</span></tt>. If you have templates with different
+extensions you should override the
+<a class="reference internal" href="api.html#flask.Flask.select_jinja_autoescape" title="flask.Flask.select_jinja_autoescape"><tt class="xref py py-meth docutils literal"><span class="pre">select_jinja_autoescape()</span></tt></a> method.</li>
+<li>Flask no longer supports zipped applications in this release. This
+functionality might come back in future releases if there is demand
+for this feature. Removing support for this makes the Flask internal
+code easier to understand and fixes a couple of small issues that make
+debugging harder than necessary.</li>
+<li>The <cite>create_jinja_loader</cite> function is gone. If you want to customize
+the Jinja loader now, use the
+<a class="reference internal" href="api.html#flask.Flask.create_jinja_environment" title="flask.Flask.create_jinja_environment"><tt class="xref py py-meth docutils literal"><span class="pre">create_jinja_environment()</span></tt></a> method instead.</li>
+</ul>
+</div>
+<div class="section" id="version-0-4">
+<h2>Version 0.4<a class="headerlink" href="#version-0-4" title="Permalink to this headline">¶</a></h2>
+<p>For application developers there are no changes that require changes in
+your code. In case you are developing on a Flask extension however, and
+that extension has a unittest-mode you might want to link the activation
+of that mode to the new <tt class="docutils literal"><span class="pre">TESTING</span></tt> flag.</p>
+</div>
+<div class="section" id="version-0-3">
+<h2>Version 0.3<a class="headerlink" href="#version-0-3" title="Permalink to this headline">¶</a></h2>
+<p>Flask 0.3 introduces configuration support and logging as well as
+categories for flashing messages. All these are features that are 100%
+backwards compatible but you might want to take advantage of them.</p>
+<div class="section" id="configuration-support">
+<h3>Configuration Support<a class="headerlink" href="#configuration-support" title="Permalink to this headline">¶</a></h3>
+<p>The configuration support makes it easier to write any kind of application
+that requires some sort of configuration. (Which most likely is the case
+for any application out there).</p>
+<p>If you previously had code like this:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="n">app</span><span class="o">.</span><span class="n">debug</span> <span class="o">=</span> <span class="n">DEBUG</span>
+<span class="n">app</span><span class="o">.</span><span class="n">secret_key</span> <span class="o">=</span> <span class="n">SECRET_KEY</span>
+</pre></div>
+</div>
+<p>You no longer have to do that, instead you can just load a configuration
+into the config object. How this works is outlined in <a class="reference internal" href="config.html#config"><em>Configuration Handling</em></a>.</p>
+</div>
+<div class="section" id="logging-integration">
+<h3>Logging Integration<a class="headerlink" href="#logging-integration" title="Permalink to this headline">¶</a></h3>
+<p>Flask now configures a logger for you with some basic and useful defaults.
+If you run your application in production and want to profit from
+automatic error logging, you might be interested in attaching a proper log
+handler. Also you can start logging warnings and errors into the logger
+when appropriately. For more information on that, read
+<a class="reference internal" href="errorhandling.html#application-errors"><em>Handling Application Errors</em></a>.</p>
+</div>
+<div class="section" id="categories-for-flash-messages">
+<h3>Categories for Flash Messages<a class="headerlink" href="#categories-for-flash-messages" title="Permalink to this headline">¶</a></h3>
+<p>Flash messages can now have categories attached. This makes it possible
+to render errors, warnings or regular messages differently for example.
+This is an opt-in feature because it requires some rethinking in the code.</p>
+<p>Read all about that in the <a class="reference internal" href="patterns/flashing.html#message-flashing-pattern"><em>Message Flashing</em></a> pattern.</p>
+</div>
+</div>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="index.html">
+ <img class="logo" src="_static/flask.png" alt="Logo"/>
+</a></p>
+ <h3><a href="index.html">Table Of Contents</a></h3>
+ <ul>
+<li><a class="reference internal" href="#">Upgrading to Newer Releases</a><ul>
+<li><a class="reference internal" href="#version-0-8">Version 0.8</a></li>
+<li><a class="reference internal" href="#version-0-7">Version 0.7</a><ul>
+<li><a class="reference internal" href="#bug-in-request-locals">Bug in Request Locals</a></li>
+<li><a class="reference internal" href="#upgrading-to-new-teardown-handling">Upgrading to new Teardown Handling</a></li>
+<li><a class="reference internal" href="#manual-error-handler-attaching">Manual Error Handler Attaching</a></li>
+<li><a class="reference internal" href="#blueprint-support">Blueprint Support</a></li>
+</ul>
+</li>
+<li><a class="reference internal" href="#version-0-6">Version 0.6</a></li>
+<li><a class="reference internal" href="#version-0-5">Version 0.5</a></li>
+<li><a class="reference internal" href="#version-0-4">Version 0.4</a></li>
+<li><a class="reference internal" href="#version-0-3">Version 0.3</a><ul>
+<li><a class="reference internal" href="#configuration-support">Configuration Support</a></li>
+<li><a class="reference internal" href="#logging-integration">Logging Integration</a></li>
+<li><a class="reference internal" href="#categories-for-flash-messages">Categories for Flash Messages</a></li>
+</ul>
+</li>
+</ul>
+</li>
+</ul>
+<h3>Related Topics</h3>
+<ul>
+ <li><a href="index.html">Documentation overview</a><ul>
+ <li>Previous: <a href="styleguide.html" title="previous chapter">Pocoo Styleguide</a></li>
+ <li>Next: <a href="changelog.html" title="next chapter">Flask Changelog</a></li>
+ </ul></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="_sources/upgrading.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/static/doc/flask-docs/views.html b/app/static/doc/flask-docs/views.html
new file mode 100644
index 0000000..e8aa4ae
--- /dev/null
+++ b/app/static/doc/flask-docs/views.html
@@ -0,0 +1,355 @@
+
+<!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>Pluggable Views &mdash; Flask 0.8 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.8',
+ 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 0.8 documentation" href="index.html" />
+ <link rel="next" title="The Request Context" href="reqcontext.html" />
+ <link rel="prev" title="Signals" href="signals.html" />
+
+
+ <link rel="apple-touch-icon" href="_static/touch-icon.png" />
+
+ <link media="only screen and (max-device-width: 480px)" href="_static/small_flask.css" type= "text/css" rel="stylesheet" />
+
+ </head>
+ <body>
+ <div class="related">
+ <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="reqcontext.html" title="The Request Context"
+ accesskey="N">next</a> |</li>
+ <li class="right" >
+ <a href="signals.html" title="Signals"
+ accesskey="P">previous</a> |</li>
+ <li><a href="index.html">Flask 0.8 documentation</a> &raquo;</li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body">
+
+ <div class="section" id="pluggable-views">
+<span id="views"></span><h1>Pluggable Views<a class="headerlink" href="#pluggable-views" title="Permalink to this headline">¶</a></h1>
+<p class="versionadded">
+<span class="versionmodified">New in version 0.7.</span></p>
+<p>Flask 0.7 introduces pluggable views inspired by the generic views from
+Django which are based on classes instead of functions. The main
+intention is that you can replace parts of the implementations and this
+way have customizable pluggable views.</p>
+<div class="section" id="basic-principle">
+<h2>Basic Principle<a class="headerlink" href="#basic-principle" title="Permalink to this headline">¶</a></h2>
+<p>Consider you have a function that loads a list of objects from the
+database and renders into a template:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="nd">@app.route</span><span class="p">(</span><span class="s">&#39;/users/&#39;</span><span class="p">)</span>
+<span class="k">def</span> <span class="nf">show_users</span><span class="p">(</span><span class="n">page</span><span class="p">):</span>
+ <span class="n">users</span> <span class="o">=</span> <span class="n">User</span><span class="o">.</span><span class="n">query</span><span class="o">.</span><span class="n">all</span><span class="p">()</span>
+ <span class="k">return</span> <span class="n">render_template</span><span class="p">(</span><span class="s">&#39;users.html&#39;</span><span class="p">,</span> <span class="n">users</span><span class="o">=</span><span class="n">users</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>This is simple and flexible, but if you want to provide this view in a
+generic fashion that can be adapted to other models and templates as well
+you might want more flexibility. This is where pluggable class based
+views come into place. As the first step to convert this into a class
+based view you would do this:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">flask.views</span> <span class="kn">import</span> <span class="n">View</span>
+
+<span class="k">class</span> <span class="nc">ShowUsers</span><span class="p">(</span><span class="n">View</span><span class="p">):</span>
+
+ <span class="k">def</span> <span class="nf">dispatch_request</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+ <span class="n">users</span> <span class="o">=</span> <span class="n">User</span><span class="o">.</span><span class="n">query</span><span class="o">.</span><span class="n">all</span><span class="p">()</span>
+ <span class="k">return</span> <span class="n">render_template</span><span class="p">(</span><span class="s">&#39;users.html&#39;</span><span class="p">,</span> <span class="n">objects</span><span class="o">=</span><span class="n">users</span><span class="p">)</span>
+
+<span class="n">app</span><span class="o">.</span><span class="n">add_url_rule</span><span class="p">(</span><span class="s">&#39;/users/&#39;</span><span class="p">,</span> <span class="n">ShowUsers</span><span class="o">.</span><span class="n">as_view</span><span class="p">(</span><span class="s">&#39;show_users&#39;</span><span class="p">))</span>
+</pre></div>
+</div>
+<p>As you can see what you have to do is to create a subclass of
+<a class="reference internal" href="api.html#flask.views.View" title="flask.views.View"><tt class="xref py py-class docutils literal"><span class="pre">flask.views.View</span></tt></a> and implement
+<a class="reference internal" href="api.html#flask.views.View.dispatch_request" title="flask.views.View.dispatch_request"><tt class="xref py py-meth docutils literal"><span class="pre">dispatch_request()</span></tt></a>. Then we have to convert that
+class into an actual view function by using the
+<a class="reference internal" href="api.html#flask.views.View.as_view" title="flask.views.View.as_view"><tt class="xref py py-meth docutils literal"><span class="pre">as_view()</span></tt></a> class method. The string you pass to
+that function is the name of the endpoint that view will then have. But
+this by itself is not helpful, so let&#8217;s refactor the code a bit:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">flask.views</span> <span class="kn">import</span> <span class="n">View</span>
+
+<span class="k">class</span> <span class="nc">ListView</span><span class="p">(</span><span class="n">View</span><span class="p">):</span>
+
+ <span class="k">def</span> <span class="nf">get_template_name</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+ <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">()</span>
+
+ <span class="k">def</span> <span class="nf">render_template</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">context</span><span class="p">):</span>
+ <span class="k">return</span> <span class="n">render_template</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">get_template_name</span><span class="p">(),</span> <span class="o">**</span><span class="n">context</span><span class="p">)</span>
+
+ <span class="k">def</span> <span class="nf">dispatch_request</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+ <span class="n">context</span> <span class="o">=</span> <span class="p">{</span><span class="s">&#39;objects&#39;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_objects</span><span class="p">()}</span>
+ <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">render_template</span><span class="p">(</span><span class="n">context</span><span class="p">)</span>
+
+<span class="k">class</span> <span class="nc">UserView</span><span class="p">(</span><span class="n">ListView</span><span class="p">):</span>
+
+ <span class="k">def</span> <span class="nf">get_template_name</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+ <span class="k">return</span> <span class="s">&#39;users.html&#39;</span>
+
+ <span class="k">def</span> <span class="nf">get_objects</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+ <span class="k">return</span> <span class="n">User</span><span class="o">.</span><span class="n">query</span><span class="o">.</span><span class="n">all</span><span class="p">()</span>
+</pre></div>
+</div>
+<p>This of course is not that helpful for such a small example, but it&#8217;s good
+enough to explain the basic principle. When you have a class based view
+the question comes up what <cite>self</cite> points to. The way this works is that
+whenever the request is dispatched a new instance of the class is created
+and the <a class="reference internal" href="api.html#flask.views.View.dispatch_request" title="flask.views.View.dispatch_request"><tt class="xref py py-meth docutils literal"><span class="pre">dispatch_request()</span></tt></a> method is called with
+the parameters from the URL rule. The class itself is instanciated with
+the parameters passed to the <a class="reference internal" href="api.html#flask.views.View.as_view" title="flask.views.View.as_view"><tt class="xref py py-meth docutils literal"><span class="pre">as_view()</span></tt></a> function.
+For instance you can write a class like this:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">class</span> <span class="nc">RenderTemplateView</span><span class="p">(</span><span class="n">View</span><span class="p">):</span>
+ <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">template_name</span><span class="p">):</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">template_name</span> <span class="o">=</span> <span class="n">template_name</span>
+ <span class="k">def</span> <span class="nf">dispatch_request</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+ <span class="k">return</span> <span class="n">render_template</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">template_name</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>And then you can register it like this:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="n">app</span><span class="o">.</span><span class="n">add_url_rule</span><span class="p">(</span><span class="s">&#39;/about&#39;</span><span class="p">,</span> <span class="n">view_func</span><span class="o">=</span><span class="n">RenderTemplateView</span><span class="o">.</span><span class="n">as_view</span><span class="p">(</span>
+ <span class="s">&#39;about_page&#39;</span><span class="p">,</span> <span class="n">template_name</span><span class="o">=</span><span class="s">&#39;about.html&#39;</span><span class="p">))</span>
+</pre></div>
+</div>
+</div>
+<div class="section" id="method-hints">
+<h2>Method Hints<a class="headerlink" href="#method-hints" title="Permalink to this headline">¶</a></h2>
+<p>Pluggable views are attached to the application like a regular function by
+either using <a class="reference internal" href="api.html#flask.Flask.route" title="flask.Flask.route"><tt class="xref py py-func docutils literal"><span class="pre">route()</span></tt></a> or better
+<a class="reference internal" href="api.html#flask.Flask.add_url_rule" title="flask.Flask.add_url_rule"><tt class="xref py py-meth docutils literal"><span class="pre">add_url_rule()</span></tt></a>. That however also means that you would
+have to provide the names of the HTTP methods the view supports when you
+attach this. In order to move that information to the class you can
+provide a <a class="reference internal" href="api.html#flask.views.View.methods" title="flask.views.View.methods"><tt class="xref py py-attr docutils literal"><span class="pre">methods</span></tt></a> attribute that has this
+information:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">class</span> <span class="nc">MyView</span><span class="p">(</span><span class="n">View</span><span class="p">):</span>
+ <span class="n">methods</span> <span class="o">=</span> <span class="p">[</span><span class="s">&#39;GET&#39;</span><span class="p">,</span> <span class="s">&#39;POST&#39;</span><span class="p">]</span>
+
+ <span class="k">def</span> <span class="nf">dispatch_request</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+ <span class="k">if</span> <span class="n">request</span><span class="o">.</span><span class="n">method</span> <span class="o">==</span> <span class="s">&#39;POST&#39;</span><span class="p">:</span>
+ <span class="o">...</span>
+ <span class="o">...</span>
+
+<span class="n">app</span><span class="o">.</span><span class="n">add_url_rule</span><span class="p">(</span><span class="s">&#39;/myview&#39;</span><span class="p">,</span> <span class="n">view_func</span><span class="o">=</span><span class="n">MyView</span><span class="o">.</span><span class="n">as_view</span><span class="p">(</span><span class="s">&#39;myview&#39;</span><span class="p">))</span>
+</pre></div>
+</div>
+</div>
+<div class="section" id="method-based-dispatching">
+<h2>Method Based Dispatching<a class="headerlink" href="#method-based-dispatching" title="Permalink to this headline">¶</a></h2>
+<p>For RESTful APIs it&#8217;s especially helpful to execute a different function
+for each HTTP method. With the <a class="reference internal" href="api.html#flask.views.MethodView" title="flask.views.MethodView"><tt class="xref py py-class docutils literal"><span class="pre">flask.views.MethodView</span></tt></a> you can
+easily do that. Each HTTP method maps to a function with the same name
+(just in lowercase):</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">flask.views</span> <span class="kn">import</span> <span class="n">MethodView</span>
+
+<span class="k">class</span> <span class="nc">UserAPI</span><span class="p">(</span><span class="n">MethodView</span><span class="p">):</span>
+
+ <span class="k">def</span> <span class="nf">get</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+ <span class="n">users</span> <span class="o">=</span> <span class="n">User</span><span class="o">.</span><span class="n">query</span><span class="o">.</span><span class="n">all</span><span class="p">()</span>
+ <span class="o">...</span>
+
+ <span class="k">def</span> <span class="nf">post</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+ <span class="n">user</span> <span class="o">=</span> <span class="n">User</span><span class="o">.</span><span class="n">from_form_data</span><span class="p">(</span><span class="n">request</span><span class="o">.</span><span class="n">form</span><span class="p">)</span>
+ <span class="o">...</span>
+
+<span class="n">app</span><span class="o">.</span><span class="n">add_url_rule</span><span class="p">(</span><span class="s">&#39;/users/&#39;</span><span class="p">,</span> <span class="n">view_func</span><span class="o">=</span><span class="n">UserAPI</span><span class="o">.</span><span class="n">as_view</span><span class="p">(</span><span class="s">&#39;users&#39;</span><span class="p">))</span>
+</pre></div>
+</div>
+<p>That way you also don&#8217;t have to provide the
+<a class="reference internal" href="api.html#flask.views.View.methods" title="flask.views.View.methods"><tt class="xref py py-attr docutils literal"><span class="pre">methods</span></tt></a> attribute. It&#8217;s automatically set based
+on the methods defined in the class.</p>
+</div>
+<div class="section" id="decorating-views">
+<h2>Decorating Views<a class="headerlink" href="#decorating-views" title="Permalink to this headline">¶</a></h2>
+<p>Since the view class itself is not the view function that is added to the
+routing system it does not make much sense to decorate the class itself.
+Instead you either have to decorate the return value of
+<a class="reference internal" href="api.html#flask.views.View.as_view" title="flask.views.View.as_view"><tt class="xref py py-meth docutils literal"><span class="pre">as_view()</span></tt></a> by hand:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="n">view</span> <span class="o">=</span> <span class="n">rate_limited</span><span class="p">(</span><span class="n">UserAPI</span><span class="o">.</span><span class="n">as_view</span><span class="p">(</span><span class="s">&#39;users&#39;</span><span class="p">))</span>
+<span class="n">app</span><span class="o">.</span><span class="n">add_url_rule</span><span class="p">(</span><span class="s">&#39;/users/&#39;</span><span class="p">,</span> <span class="n">view_func</span><span class="o">=</span><span class="n">view</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>Starting with Flask 0.8 there is also an alternative way where you can
+specify a list of decorators to apply in the class declaration:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">class</span> <span class="nc">UserAPI</span><span class="p">(</span><span class="n">MethodView</span><span class="p">):</span>
+ <span class="n">decorators</span> <span class="o">=</span> <span class="p">[</span><span class="n">rate_limited</span><span class="p">]</span>
+</pre></div>
+</div>
+<p>Due to the implicit self from the caller&#8217;s perspective you cannot use
+regular view decorators on the individual methods of the view however,
+keep this in mind.</p>
+</div>
+<div class="section" id="method-views-for-apis">
+<h2>Method Views for APIs<a class="headerlink" href="#method-views-for-apis" title="Permalink to this headline">¶</a></h2>
+<p>Web APIs are often working very closely with HTTP verbs so it makes a lot
+of sense to implement such an API based on the
+<a class="reference internal" href="api.html#flask.views.MethodView" title="flask.views.MethodView"><tt class="xref py py-class docutils literal"><span class="pre">MethodView</span></tt></a>. That said, you will notice that the API
+will require different URL rules that go to the same method view most of
+the time. For instance consider that you are exposing a user object on
+the web:</p>
+<table border="1" class="docutils">
+<colgroup>
+<col width="22%" />
+<col width="22%" />
+<col width="56%" />
+</colgroup>
+<tbody valign="top">
+<tr class="row-odd"><td>URL</td>
+<td>Method</td>
+<td>Description</td>
+</tr>
+<tr class="row-even"><td><tt class="docutils literal"><span class="pre">/users/</span></tt></td>
+<td><tt class="docutils literal"><span class="pre">GET</span></tt></td>
+<td>Gives a list of all users</td>
+</tr>
+<tr class="row-odd"><td><tt class="docutils literal"><span class="pre">/users/</span></tt></td>
+<td><tt class="docutils literal"><span class="pre">POST</span></tt></td>
+<td>Creates a new user</td>
+</tr>
+<tr class="row-even"><td><tt class="docutils literal"><span class="pre">/users/&lt;id&gt;</span></tt></td>
+<td><tt class="docutils literal"><span class="pre">GET</span></tt></td>
+<td>Shows a single user</td>
+</tr>
+<tr class="row-odd"><td><tt class="docutils literal"><span class="pre">/users/&lt;id&gt;</span></tt></td>
+<td><tt class="docutils literal"><span class="pre">PUT</span></tt></td>
+<td>Updates a single user</td>
+</tr>
+<tr class="row-even"><td><tt class="docutils literal"><span class="pre">/users/&lt;id&gt;</span></tt></td>
+<td><tt class="docutils literal"><span class="pre">DELETE</span></tt></td>
+<td>Deletes a single user</td>
+</tr>
+</tbody>
+</table>
+<p>So how would you go about doing that with the
+<a class="reference internal" href="api.html#flask.views.MethodView" title="flask.views.MethodView"><tt class="xref py py-class docutils literal"><span class="pre">MethodView</span></tt></a>? The trick is to take advantage of the
+fact that you can provide multiple rules to the same view.</p>
+<p>Let&#8217;s assume for the moment the view would look like this:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">class</span> <span class="nc">UserAPI</span><span class="p">(</span><span class="n">MethodView</span><span class="p">):</span>
+
+ <span class="k">def</span> <span class="nf">get</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">user_id</span><span class="p">):</span>
+ <span class="k">if</span> <span class="n">user_id</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+ <span class="c"># return a list of users</span>
+ <span class="k">pass</span>
+ <span class="k">else</span><span class="p">:</span>
+ <span class="c"># expose a single user</span>
+ <span class="k">pass</span>
+
+ <span class="k">def</span> <span class="nf">post</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+ <span class="c"># create a new user</span>
+ <span class="k">pass</span>
+
+ <span class="k">def</span> <span class="nf">delete</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">user_id</span><span class="p">):</span>
+ <span class="c"># delete a single user</span>
+ <span class="k">pass</span>
+
+ <span class="k">def</span> <span class="nf">put</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">user_id</span><span class="p">):</span>
+ <span class="c"># update a single user</span>
+ <span class="k">pass</span>
+</pre></div>
+</div>
+<p>So how do we hook this up with the routing system? By adding two rules
+and explicitly mentioning the methods for each:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="n">user_view</span> <span class="o">=</span> <span class="n">UserAPI</span><span class="o">.</span><span class="n">as_view</span><span class="p">(</span><span class="s">&#39;user_api&#39;</span><span class="p">)</span>
+<span class="n">app</span><span class="o">.</span><span class="n">add_url_rule</span><span class="p">(</span><span class="s">&#39;/users/&#39;</span><span class="p">,</span> <span class="n">defaults</span><span class="o">=</span><span class="p">{</span><span class="s">&#39;user_id&#39;</span><span class="p">:</span> <span class="bp">None</span><span class="p">},</span>
+ <span class="n">view_func</span><span class="o">=</span><span class="n">user_view</span><span class="p">,</span> <span class="n">methods</span><span class="o">=</span><span class="p">[</span><span class="s">&#39;GET&#39;</span><span class="p">,</span> <span class="s">&#39;POST&#39;</span><span class="p">])</span>
+<span class="n">app</span><span class="o">.</span><span class="n">add_url_rule</span><span class="p">(</span><span class="s">&#39;/users/&lt;int:user_id&gt;&#39;</span><span class="p">,</span> <span class="n">view_func</span><span class="o">=</span><span class="n">user_view</span><span class="p">,</span>
+ <span class="n">methods</span><span class="o">=</span><span class="p">[</span><span class="s">&#39;GET&#39;</span><span class="p">,</span> <span class="s">&#39;PUT&#39;</span><span class="p">,</span> <span class="s">&#39;DELETE&#39;</span><span class="p">])</span>
+</pre></div>
+</div>
+<p>If you have a lot of APIs that look similar you can refactor that
+registration code:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">def</span> <span class="nf">register_api</span><span class="p">(</span><span class="n">view</span><span class="p">,</span> <span class="n">endpoint</span><span class="p">,</span> <span class="n">url</span><span class="p">,</span> <span class="n">pk</span><span class="o">=</span><span class="s">&#39;id&#39;</span><span class="p">,</span> <span class="n">pk_type</span><span class="o">=</span><span class="s">&#39;int&#39;</span><span class="p">):</span>
+ <span class="n">view_func</span> <span class="o">=</span> <span class="n">view</span><span class="o">.</span><span class="n">as_view</span><span class="p">(</span><span class="n">endpoint</span><span class="p">)</span>
+ <span class="n">app</span><span class="o">.</span><span class="n">add_url_rule</span><span class="p">(</span><span class="n">url</span><span class="p">,</span> <span class="n">defaults</span><span class="o">=</span><span class="p">{</span><span class="n">pk</span><span class="p">:</span> <span class="bp">None</span><span class="p">},</span>
+ <span class="n">view_func</span><span class="o">=</span><span class="n">view_func</span><span class="p">,</span> <span class="n">methods</span><span class="o">=</span><span class="p">[</span><span class="s">&#39;GET&#39;</span><span class="p">,</span> <span class="s">&#39;POST&#39;</span><span class="p">])</span>
+ <span class="n">app</span><span class="o">.</span><span class="n">add_url_rule</span><span class="p">(</span><span class="s">&#39;</span><span class="si">%s</span><span class="s">&lt;</span><span class="si">%s</span><span class="s">:</span><span class="si">%s</span><span class="s">&gt;&#39;</span> <span class="o">%</span> <span class="p">(</span><span class="n">url</span><span class="p">,</span> <span class="n">pk</span><span class="p">),</span> <span class="n">view_func</span><span class="o">=</span><span class="n">view_func</span><span class="p">,</span>
+ <span class="n">methods</span><span class="o">=</span><span class="p">[</span><span class="s">&#39;GET&#39;</span><span class="p">,</span> <span class="s">&#39;PUT&#39;</span><span class="p">,</span> <span class="s">&#39;DELETE&#39;</span><span class="p">])</span>
+
+<span class="n">register_api</span><span class="p">(</span><span class="n">UserAPI</span><span class="p">,</span> <span class="s">&#39;user_api&#39;</span><span class="p">,</span> <span class="s">&#39;/users/&#39;</span><span class="p">,</span> <span class="n">pk</span><span class="o">=</span><span class="s">&#39;user_id&#39;</span><span class="p">)</span>
+</pre></div>
+</div>
+</div>
+</div>
+
+
+ </div>
+ </div>
+ </div>
+ <div class="sphinxsidebar">
+ <div class="sphinxsidebarwrapper"><p class="logo"><a href="index.html">
+ <img class="logo" src="_static/flask.png" alt="Logo"/>
+</a></p>
+ <h3><a href="index.html">Table Of Contents</a></h3>
+ <ul>
+<li><a class="reference internal" href="#">Pluggable Views</a><ul>
+<li><a class="reference internal" href="#basic-principle">Basic Principle</a></li>
+<li><a class="reference internal" href="#method-hints">Method Hints</a></li>
+<li><a class="reference internal" href="#method-based-dispatching">Method Based Dispatching</a></li>
+<li><a class="reference internal" href="#decorating-views">Decorating Views</a></li>
+<li><a class="reference internal" href="#method-views-for-apis">Method Views for APIs</a></li>
+</ul>
+</li>
+</ul>
+<h3>Related Topics</h3>
+<ul>
+ <li><a href="index.html">Documentation overview</a><ul>
+ <li>Previous: <a href="signals.html" title="previous chapter">Signals</a></li>
+ <li>Next: <a href="reqcontext.html" title="next chapter">The Request Context</a></li>
+ </ul></li>
+</ul>
+ <h3>This Page</h3>
+ <ul class="this-page-menu">
+ <li><a href="_sources/views.txt"
+ rel="nofollow">Show Source</a></li>
+ </ul>
+<div id="searchbox" style="display: none">
+ <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, Armin Ronacher.
+ Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
+ </div>
+ </body>
+</html> \ No newline at end of file