Skip to content
Myr

Merge branch 'master' of github.com:mitsuhiko/flask

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Armin Ronacher · committed by Armin Ronacher · parents b879193, 9a0f651 · Browse files · 8 files+16 added−13 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

8 files+16 added−13 removed

  • other:+16 added−13 removed

8 files+16 added−13 removed

modified:docs/tutorial/dbinit.rst+4 added-2 removed
21 unmodified lines
2223If you want to do that, you first have to import the24:func:`contextlib.closing` function from the contextlib package. If you25want to use Python 2.5 it's also necessary to enable the `with` statement26first (`__future__` imports must be the very first import)::26first (`__future__` imports must be the very first import). Accordingly,27add the following lines to your existing imports in `flaskr.py`::2829 from __future__ import with_statement30 from contextlib import closing3132Next we can create a function called `init_db` that initializes the33database. For this we can use the `connect_db` function we defined33earlier. Just add that function below the `connect_db` function::34earlier. Just add that function below the `connect_db` function in35`flask.py`::3637 def init_db():38 with closing(connect_db()) as db:39 with app.open_resource('schema.sql') as f:
30 unmodified lines
modified:docs/tutorial/introduction.rst+1 added-1 removed
1 unmodified line
23Introducing Flaskr4==================56We will call our blogging application flaskr here, feel free to chose a6We will call our blogging application flaskr here, feel free to choose a7less web-2.0-ish name ;) Basically we want it to do the following things:891. let the user sign in and out with credentials specified in the10 configuration. Only one user is supported.
23 unmodified lines
modified:docs/appcontext.rst+1 added-2 removed
42 unmodified lines
43you can have more than one application in the same Python process.4445So how does the code find the “right” application? In the past we46recommended passing applications around explicitly, but that caused issues47with libraries that were not designed with that in mind for libraries for48which it was too inconvenient to make this work.47with libraries that were not designed with that in mind.4849A common workaround for that problem was to use the50:data:`~flask.current_app` proxy later on, which was bound to the current51request's application reference. Since however creating such a request
36 unmodified lines
modified:docs/design.rst+3 added-3 removed
88 unmodified lines
89since decorators could be fired in undefined order when the application is90split into multiple modules.9192Another design decision with the Werkzeug routing system is that routes93in Werkzeug try to ensure that there is that URLs are unique. Werkzeug94will go quite far with that in that it will automatically redirect to a95canonical URL if a route is ambiguous.93in Werkzeug try to ensure that URLs are unique. Werkzeug will go quite far94with that in that it will automatically redirect to a canonical URL if a route95is ambiguous.969798One Template Engine99-------------------
92 unmodified lines
modified:docs/quickstart.rst+1 added-1 removed
375 unmodified lines
376 /templates377 /hello.html378379For templates you can use the full power of Jinja2 templates. Head over380to the the official `Jinja2 Template Documentation380to the official `Jinja2 Template Documentation381<http://jinja.pocoo.org/2/documentation/templates>`_ for more information.382383Here is an example template:384
469 unmodified lines
modified:flask/app.py+1 added-1 removed
1466 unmodified lines
1467 .. versionadded:: 0.614681469 .. versionchanged:: 0.91470 This can now also be called without a request object when the1471 UR adapter is created for the application context.1471 URL adapter is created for the application context.1472 """1473 if request is not None:1474 return self.url_map.bind_to_environ(request.environ,1475 server_name=self.config['SERVER_NAME'])
226 unmodified lines
modified:flask/helpers.py+3 added-1 removed
303 unmodified lines
304 :exc:`~werkzeug.routing.BuildError`.305306 :param endpoint: the endpoint of the URL (name of the function)307 :param values: the variable arguments of the URL rule308 :param _external: if set to `True`, an absolute URL is generated.308 :param _external: if set to `True`, an absolute URL is generated. Server309 address can be changed via `SERVER_NAME` configuration variable which310 defaults to `localhost`.311 :param _anchor: if provided this is added as anchor to the URL.312 :param _method: if provided this explicitly specifies an HTTP method.313 """314 appctx = _app_ctx_stack.top
581 unmodified lines
modified:CHANGES+2 added-2 removed
9 unmodified lines
1011Version 0.912-----------1314Released on July 1st 2012, codename Camapri.14Released on July 1st 2012, codename Campari.1516- The :func:`flask.Request.on_json_loading_failed` now returns a JSON formatted17 response by default.18- The :func:`flask.url_for` function now can generate anchors to the
62 unmodified lines
8182Version 0.8.183-------------8485Bugfix release, released on July 1th 201285Bugfix release, released on July 1st 20128687- Fixed an issue with the undocumented `flask.session` module to not88 work properly on Python 2.5. It should not be used but did cause89 some problems for package managers.
289 unmodified lines