forked from orbit-oss/flask
Merge pull request #1225 from s3rvac/typo-and-cosmetic-fixes
Typo and cosmetic fixes
This commit is contained in:
commit
84efebd6be
19 changed files with 26 additions and 28 deletions
2
CHANGES
2
CHANGES
|
|
@ -49,7 +49,7 @@ Version 1.0
|
||||||
users debug when the wrong templates are loaded.
|
users debug when the wrong templates are loaded.
|
||||||
- Enforce blueprint handling in the order they were registered for template
|
- Enforce blueprint handling in the order they were registered for template
|
||||||
loading.
|
loading.
|
||||||
- Ported testsuite to py.test.
|
- Ported test suite to py.test.
|
||||||
- Deprecated ``request.json`` in favour of ``request.get_json()``.
|
- Deprecated ``request.json`` in favour of ``request.get_json()``.
|
||||||
- Add "pretty" and "compressed" separators definitions in jsonify() method.
|
- Add "pretty" and "compressed" separators definitions in jsonify() method.
|
||||||
Reduces JSON response size when JSONIFY_PRETTYPRINT_REGULAR=False by removing
|
Reduces JSON response size when JSONIFY_PRETTYPRINT_REGULAR=False by removing
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ documentation.
|
||||||
- "AUTHORS" hereby refers to all the authors listed in the
|
- "AUTHORS" hereby refers to all the authors listed in the
|
||||||
:ref:`authors` section.
|
:ref:`authors` section.
|
||||||
|
|
||||||
- The ":ref:`flask-license`" applies to all the sourcecode shipped as
|
- The ":ref:`flask-license`" applies to all the source code shipped as
|
||||||
part of Flask (Flask itself as well as the examples and the unittests)
|
part of Flask (Flask itself as well as the examples and the unittests)
|
||||||
as well as documentation.
|
as well as documentation.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ 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.
|
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
|
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
|
source code to the server and install it into a pre-existing
|
||||||
virtual environment::
|
virtual environment::
|
||||||
|
|
||||||
from fabric.api import *
|
from fabric.api import *
|
||||||
|
|
@ -186,7 +186,7 @@ deployment actually fun:
|
||||||
out the latest version on the server and then install. That way you
|
out the latest version on the server and then install. That way you
|
||||||
can also easily go back to older versions.
|
can also easily go back to older versions.
|
||||||
- hook in testing functionality so that you can deploy to an external
|
- hook in testing functionality so that you can deploy to an external
|
||||||
server and run the testsuite.
|
server and run the test suite.
|
||||||
|
|
||||||
Working with Fabric is fun and you will notice that it's quite magical to
|
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
|
type ``fab deploy`` and see your application being deployed automatically
|
||||||
|
|
|
||||||
|
|
@ -222,7 +222,7 @@ The following converters exist:
|
||||||
Though they look rather similar, they differ in their use of the trailing
|
Though they look rather similar, they differ in their use of the trailing
|
||||||
slash in the URL *definition*. In the first case, the canonical URL for the
|
slash in the URL *definition*. In the first case, the canonical URL for the
|
||||||
`projects` endpoint has a trailing slash. In that sense, it is similar to
|
`projects` endpoint has a trailing slash. In that sense, it is similar to
|
||||||
a folder on a file system. Accessing it without a trailing slash will cause
|
a folder on a filesystem. Accessing it without a trailing slash will cause
|
||||||
Flask to redirect to the canonical URL with the trailing slash.
|
Flask to redirect to the canonical URL with the trailing slash.
|
||||||
|
|
||||||
In the second case, however, the URL is defined without a trailing slash,
|
In the second case, however, the URL is defined without a trailing slash,
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ 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
|
as database which comes out of the box with Python, so there is nothing
|
||||||
else you need.
|
else you need.
|
||||||
|
|
||||||
If you want the full sourcecode in advance or for comparison, check out
|
If you want the full source code in advance or for comparison, check out
|
||||||
the `example source`_.
|
the `example source`_.
|
||||||
|
|
||||||
.. _example source:
|
.. _example source:
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@ as `ValueError` you will need to change this.
|
||||||
|
|
||||||
Due to a bug in the test client Flask 0.7 did not trigger teardown
|
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
|
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
|
since fixed but might require some changes in your test suites if you
|
||||||
relied on this behavior.
|
relied on this behavior.
|
||||||
|
|
||||||
Version 0.7
|
Version 0.7
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
<h1>This is blueprint example</h1>
|
<h1>This is blueprint example</h1>
|
||||||
<p>
|
<p>
|
||||||
A simple page blueprint is registered under / and /pages
|
A simple page blueprint is registered under / and /pages
|
||||||
you can access it using this urls:
|
you can access it using this URLs:
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="{{ url_for('simple_page.show', page='hello') }}">/hello</a>
|
<li><a href="{{ url_for('simple_page.show', page='hello') }}">/hello</a>
|
||||||
<li><a href="{{ url_for('simple_page.show', page='world') }}">/world</a>
|
<li><a href="{{ url_for('simple_page.show', page='world') }}">/world</a>
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ class Flask(_PackageBoundObject):
|
||||||
|
|
||||||
The idea of the first parameter is to give Flask an idea of what
|
The idea of the first parameter is to give Flask an idea of what
|
||||||
belongs to your application. This name is used to find resources
|
belongs to your application. This name is used to find resources
|
||||||
on the file system, can be used by extensions to improve debugging
|
on the filesystem, can be used by extensions to improve debugging
|
||||||
information and a lot more.
|
information and a lot more.
|
||||||
|
|
||||||
So it's important what you provide there. If you are using a single
|
So it's important what you provide there. If you are using a single
|
||||||
|
|
@ -289,7 +289,7 @@ class Flask(_PackageBoundObject):
|
||||||
'SESSION_COOKIE_SECURE': False,
|
'SESSION_COOKIE_SECURE': False,
|
||||||
'SESSION_REFRESH_EACH_REQUEST': True,
|
'SESSION_REFRESH_EACH_REQUEST': True,
|
||||||
'MAX_CONTENT_LENGTH': None,
|
'MAX_CONTENT_LENGTH': None,
|
||||||
'SEND_FILE_MAX_AGE_DEFAULT': 12 * 60 * 60, # 12 hours
|
'SEND_FILE_MAX_AGE_DEFAULT': 12 * 60 * 60, # 12 hours
|
||||||
'TRAP_BAD_REQUEST_ERRORS': False,
|
'TRAP_BAD_REQUEST_ERRORS': False,
|
||||||
'TRAP_HTTP_EXCEPTIONS': False,
|
'TRAP_HTTP_EXCEPTIONS': False,
|
||||||
'EXPLAIN_TEMPLATE_LOADING': False,
|
'EXPLAIN_TEMPLATE_LOADING': False,
|
||||||
|
|
|
||||||
|
|
@ -257,10 +257,10 @@ class AppGroup(click.Group):
|
||||||
|
|
||||||
|
|
||||||
class FlaskGroup(AppGroup):
|
class FlaskGroup(AppGroup):
|
||||||
"""Special subclass of the the :class:`AppGroup` group that supports
|
"""Special subclass of the :class:`AppGroup` group that supports
|
||||||
loading more commands from the configured Flask app. Normally a
|
loading more commands from the configured Flask app. Normally a
|
||||||
developer does not have to interface with this class but there are
|
developer does not have to interface with this class but there are
|
||||||
some very advanced usecases for which it makes sense to create an
|
some very advanced use cases for which it makes sense to create an
|
||||||
instance of this.
|
instance of this.
|
||||||
|
|
||||||
For information as of why this is useful see :ref:`custom-scripts`.
|
For information as of why this is useful see :ref:`custom-scripts`.
|
||||||
|
|
|
||||||
|
|
@ -291,7 +291,7 @@ class RequestContext(object):
|
||||||
# information under debug situations. However if someone forgets to
|
# information under debug situations. However if someone forgets to
|
||||||
# pop that context again we want to make sure that on the next push
|
# pop that context again we want to make sure that on the next push
|
||||||
# it's invalidated, otherwise we run at risk that something leaks
|
# it's invalidated, otherwise we run at risk that something leaks
|
||||||
# memory. This is usually only a problem in testsuite since this
|
# memory. This is usually only a problem in test suite since this
|
||||||
# functionality is not active in production environments.
|
# functionality is not active in production environments.
|
||||||
top = _request_ctx_stack.top
|
top = _request_ctx_stack.top
|
||||||
if top is not None and top.preserved:
|
if top is not None and top.preserved:
|
||||||
|
|
|
||||||
|
|
@ -264,7 +264,7 @@ def url_for(endpoint, **values):
|
||||||
'executed when application context is available.')
|
'executed when application context is available.')
|
||||||
|
|
||||||
# If request specific information is available we have some extra
|
# If request specific information is available we have some extra
|
||||||
# features that support "relative" urls.
|
# features that support "relative" URLs.
|
||||||
if reqctx is not None:
|
if reqctx is not None:
|
||||||
url_adapter = reqctx.url_adapter
|
url_adapter = reqctx.url_adapter
|
||||||
blueprint_name = request.blueprint
|
blueprint_name = request.blueprint
|
||||||
|
|
@ -284,7 +284,7 @@ def url_for(endpoint, **values):
|
||||||
external = values.pop('_external', False)
|
external = values.pop('_external', False)
|
||||||
|
|
||||||
# Otherwise go with the url adapter from the appctx and make
|
# Otherwise go with the url adapter from the appctx and make
|
||||||
# the urls external by default.
|
# the URLs external by default.
|
||||||
else:
|
else:
|
||||||
url_adapter = appctx.url_adapter
|
url_adapter = appctx.url_adapter
|
||||||
if url_adapter is None:
|
if url_adapter is None:
|
||||||
|
|
@ -529,7 +529,7 @@ def send_file(filename_or_fp, mimetype=None, as_attachment=False,
|
||||||
rv = current_app.response_class(data, mimetype=mimetype, headers=headers,
|
rv = current_app.response_class(data, mimetype=mimetype, headers=headers,
|
||||||
direct_passthrough=True)
|
direct_passthrough=True)
|
||||||
|
|
||||||
# if we know the file modification date, we can store it as the
|
# if we know the file modification date, we can store it as
|
||||||
# the time of the last modification.
|
# the time of the last modification.
|
||||||
if mtime is not None:
|
if mtime is not None:
|
||||||
rv.last_modified = int(mtime)
|
rv.last_modified = int(mtime)
|
||||||
|
|
@ -573,7 +573,7 @@ def safe_join(directory, filename):
|
||||||
def wiki_page(filename):
|
def wiki_page(filename):
|
||||||
filename = safe_join(app.config['WIKI_FOLDER'], filename)
|
filename = safe_join(app.config['WIKI_FOLDER'], filename)
|
||||||
with open(filename, 'rb') as fd:
|
with open(filename, 'rb') as fd:
|
||||||
content = fd.read() # Read and process the file content...
|
content = fd.read() # Read and process the file content...
|
||||||
|
|
||||||
:param directory: the base directory.
|
:param directory: the base directory.
|
||||||
:param filename: the untrusted filename relative to that directory.
|
:param filename: the untrusted filename relative to that directory.
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,7 @@ session_json_serializer = TaggedJSONSerializer()
|
||||||
|
|
||||||
|
|
||||||
class SecureCookieSession(CallbackDict, SessionMixin):
|
class SecureCookieSession(CallbackDict, SessionMixin):
|
||||||
"""Baseclass for sessions based on signed cookies."""
|
"""Base class for sessions based on signed cookies."""
|
||||||
|
|
||||||
def __init__(self, initial=None):
|
def __init__(self, initial=None):
|
||||||
def on_update(self):
|
def on_update(self):
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
~~~~~~~~~~~~~
|
~~~~~~~~~~~~~
|
||||||
|
|
||||||
Implements signals based on blinker if available, otherwise
|
Implements signals based on blinker if available, otherwise
|
||||||
falls silently back to a noop
|
falls silently back to a noop.
|
||||||
|
|
||||||
:copyright: (c) 2014 by Armin Ronacher.
|
:copyright: (c) 2014 by Armin Ronacher.
|
||||||
:license: BSD, see LICENSE for more details.
|
:license: BSD, see LICENSE for more details.
|
||||||
|
|
@ -42,7 +42,7 @@ except ImportError:
|
||||||
_signals = Namespace()
|
_signals = Namespace()
|
||||||
|
|
||||||
|
|
||||||
# Core signals. For usage examples grep the sourcecode or consult
|
# Core signals. For usage examples grep the source code or consult
|
||||||
# the API documentation in docs/api.rst as well as docs/signals.rst
|
# the API documentation in docs/api.rst as well as docs/signals.rst
|
||||||
template_rendered = _signals.signal('template-rendered')
|
template_rendered = _signals.signal('template-rendered')
|
||||||
request_started = _signals.signal('request-started')
|
request_started = _signals.signal('request-started')
|
||||||
|
|
|
||||||
|
|
@ -127,7 +127,7 @@ def render_template_string(source, **context):
|
||||||
"""Renders a template from the given template source string
|
"""Renders a template from the given template source string
|
||||||
with the given context.
|
with the given context.
|
||||||
|
|
||||||
:param source: the sourcecode of the template to be
|
:param source: the source code of the template to be
|
||||||
rendered
|
rendered
|
||||||
:param context: the variables that should be available in the
|
:param context: the variables that should be available in the
|
||||||
context of the template.
|
context of the template.
|
||||||
|
|
|
||||||
|
|
@ -113,7 +113,7 @@ class MethodViewType(type):
|
||||||
methods.add(key.upper())
|
methods.add(key.upper())
|
||||||
# If we have no method at all in there we don't want to
|
# If we have no method at all in there we don't want to
|
||||||
# add a method list. (This is for instance the case for
|
# add a method list. (This is for instance the case for
|
||||||
# the baseclass or another subclass of a base method view
|
# the base class or another subclass of a base method view
|
||||||
# that does not introduce new methods).
|
# that does not introduce new methods).
|
||||||
if methods:
|
if methods:
|
||||||
rv.methods = sorted(methods)
|
rv.methods = sorted(methods)
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,6 @@ def leak_detector(request):
|
||||||
request.addfinalizer(ensure_clean_request_context)
|
request.addfinalizer(ensure_clean_request_context)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(params=(True, False))
|
@pytest.fixture(params=(True, False))
|
||||||
def limit_loader(request, monkeypatch):
|
def limit_loader(request, monkeypatch):
|
||||||
"""Patch pkgutil.get_loader to give loader without get_filename or archive.
|
"""Patch pkgutil.get_loader to give loader without get_filename or archive.
|
||||||
|
|
|
||||||
|
|
@ -41,13 +41,13 @@ def test_request_context_means_app_context():
|
||||||
app = flask.Flask(__name__)
|
app = flask.Flask(__name__)
|
||||||
with app.test_request_context():
|
with app.test_request_context():
|
||||||
assert flask.current_app._get_current_object() == app
|
assert flask.current_app._get_current_object() == app
|
||||||
assert flask._app_ctx_stack.top == None
|
assert flask._app_ctx_stack.top is None
|
||||||
|
|
||||||
def test_app_context_provides_current_app():
|
def test_app_context_provides_current_app():
|
||||||
app = flask.Flask(__name__)
|
app = flask.Flask(__name__)
|
||||||
with app.app_context():
|
with app.app_context():
|
||||||
assert flask.current_app._get_current_object() == app
|
assert flask.current_app._get_current_object() == app
|
||||||
assert flask._app_ctx_stack.top == None
|
assert flask._app_ctx_stack.top is None
|
||||||
|
|
||||||
def test_app_tearing_down():
|
def test_app_tearing_down():
|
||||||
cleanup_stuff = []
|
cleanup_stuff = []
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@ except ImportError:
|
||||||
import flask
|
import flask
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
pytestmark = pytest.mark.skipif(
|
pytestmark = pytest.mark.skipif(
|
||||||
blinker is None,
|
blinker is None,
|
||||||
reason='Signals require the blinker library.'
|
reason='Signals require the blinker library.'
|
||||||
|
|
|
||||||
|
|
@ -287,8 +287,8 @@ def test_iterable_loader():
|
||||||
@app.route('/')
|
@app.route('/')
|
||||||
def index():
|
def index():
|
||||||
return flask.render_template(
|
return flask.render_template(
|
||||||
['no_template.xml', # should skip this one
|
['no_template.xml', # should skip this one
|
||||||
'simple_template.html', # should render this
|
'simple_template.html', # should render this
|
||||||
'context_template.html'],
|
'context_template.html'],
|
||||||
value=23)
|
value=23)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue