Merge branch 'master' of git://github.com/mitsuhiko/flask
This commit is contained in:
commit
7596f83bc5
10 changed files with 17 additions and 15 deletions
10
docs/api.rst
10
docs/api.rst
|
|
@ -187,12 +187,12 @@ To access the current session you can use the :class:`session` object:
|
||||||
# so mark it as modified yourself
|
# so mark it as modified yourself
|
||||||
session.modified = True
|
session.modified = True
|
||||||
|
|
||||||
.. attribute:: permanent
|
.. attribute:: permanent
|
||||||
|
|
||||||
If set to `True` the session life for
|
If set to `True` the session life for
|
||||||
:attr:`~flask.Flask.permanent_session_lifetime` seconds. The
|
:attr:`~flask.Flask.permanent_session_lifetime` seconds. The
|
||||||
default is 31 days. If set to `False` (which is the default) 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 will be deleted when the user closes the browser.
|
||||||
|
|
||||||
|
|
||||||
Application Globals
|
Application Globals
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ static files are in subdirectories within the Python source tree of the
|
||||||
application.
|
application.
|
||||||
|
|
||||||
The main reason however why Flask is called a "microframework" is the idea
|
The main reason however why Flask is called a "microframework" is the idea
|
||||||
to keep the core simple but extensible. There is database abstraction
|
to keep the core simple but extensible. There is no database abstraction
|
||||||
layer, no form validation or anything else where different libraries
|
layer, no form validation or anything else where different libraries
|
||||||
already exist that can handle that. However Flask knows the concept of
|
already exist that can handle that. However Flask knows the concept of
|
||||||
extensions that can add this functionality into your application as if it
|
extensions that can add this functionality into your application as if it
|
||||||
|
|
|
||||||
|
|
@ -147,7 +147,7 @@ To just get the development version without git, do this instead::
|
||||||
`easy_install` on Windows
|
`easy_install` on Windows
|
||||||
-------------------------
|
-------------------------
|
||||||
|
|
||||||
On Windows, installation of `easy_install` is a little bit tricker because
|
On Windows, installation of `easy_install` is a little bit trickier because
|
||||||
slightly different rules apply on Windows than on Unix-like systems, but
|
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
|
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
|
`ez_setup.py`_ file and run it. The easiest way to run the file is to
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ Cross-Site Scripting (XSS)
|
||||||
--------------------------
|
--------------------------
|
||||||
|
|
||||||
Cross site scripting is the concept of injecting arbitrary HTML (and with
|
Cross site scripting is the concept of injecting arbitrary HTML (and with
|
||||||
it JavaScript) into the context of a website. To rememdy this, developers
|
it JavaScript) into the context of a website. To remedy this, developers
|
||||||
have to properly escape text so that it cannot include arbitrary HTML
|
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
|
tags. For more information on that have a look at the Wikipedia article
|
||||||
on `Cross-Site Scripting
|
on `Cross-Site Scripting
|
||||||
|
|
|
||||||
|
|
@ -179,8 +179,8 @@ The following signals exist in Flask:
|
||||||
template.name or 'string template',
|
template.name or 'string template',
|
||||||
context)
|
context)
|
||||||
|
|
||||||
from flask import request_started
|
from flask import template_rendered
|
||||||
request_started.connect(log_template_renders, app)
|
template_rendered.connect(log_template_renders, app)
|
||||||
|
|
||||||
.. data:: flask.request_started
|
.. data:: flask.request_started
|
||||||
:noindex:
|
:noindex:
|
||||||
|
|
|
||||||
|
|
@ -173,7 +173,7 @@ like this::
|
||||||
text='<strong>HTML</strong> allowed here'
|
text='<strong>HTML</strong> allowed here'
|
||||||
), follow_redirects=True)
|
), follow_redirects=True)
|
||||||
assert 'No entries here so far' not in rv.data
|
assert 'No entries here so far' not in rv.data
|
||||||
assert '<Hello>' in rv.data
|
assert '<Hello>' in rv.data
|
||||||
assert '<strong>HTML</strong> allowed here' 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,
|
Here we check that HTML is allowed in the text but not in the title,
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ less web-2.0-ish name ;) Basically we want it to do the following things:
|
||||||
3. the page shows all entries so far in reverse order (newest on top) and
|
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.
|
the user can add new ones from there if logged in.
|
||||||
|
|
||||||
We will be using SQlite3 directly for that application because it's good
|
We will be using SQLite3 directly for that application because it's good
|
||||||
enough for an application of that size. For larger applications however
|
enough for an application of that size. For larger applications however
|
||||||
it makes a lot of sense to use `SQLAlchemy`_ that handles database
|
it makes a lot of sense to use `SQLAlchemy`_ that handles database
|
||||||
connections in a more intelligent way, allows you to target different
|
connections in a more intelligent way, allows you to target different
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ execute code on the server!
|
||||||
|
|
||||||
We also add a method to easily connect to the database specified. That
|
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
|
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
|
Python shell or a script. This will come in handy later.
|
||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ class FlaskrTestCase(unittest.TestCase):
|
||||||
text='<strong>HTML</strong> allowed here'
|
text='<strong>HTML</strong> allowed here'
|
||||||
), follow_redirects=True)
|
), follow_redirects=True)
|
||||||
assert 'No entries here so far' not in rv.data
|
assert 'No entries here so far' not in rv.data
|
||||||
assert '<Hello>' in rv.data
|
assert '<Hello>' in rv.data
|
||||||
assert '<strong>HTML</strong> allowed here' in rv.data
|
assert '<strong>HTML</strong> allowed here' in rv.data
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -287,7 +287,9 @@ def send_file(filename_or_fp, mimetype=None, as_attachment=False,
|
||||||
relative path is specified.
|
relative path is specified.
|
||||||
Alternatively a file object might be provided
|
Alternatively a file object might be provided
|
||||||
in which case `X-Sendfile` might not work and
|
in which case `X-Sendfile` might not work and
|
||||||
fall back to the traditional method.
|
fall back to the traditional method. Make sure
|
||||||
|
that the file pointer is positioned at the start
|
||||||
|
of data to send before calling :func:`send_file`.
|
||||||
:param mimetype: the mimetype of the file if provided, otherwise
|
:param mimetype: the mimetype of the file if provided, otherwise
|
||||||
auto detection happens.
|
auto detection happens.
|
||||||
:param as_attachment: set to `True` if you want to send this file with
|
:param as_attachment: set to `True` if you want to send this file with
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue