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 1beb0f2, 80b2689 · Browse files · 13 files·+24 added−16 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
13 files+24 added−16 removed
- other:+24 added−16 removed
Provenance
- Commit
7fc0ddb- Tree
50a615f- Author
Armin Ronacher <armin.ronacher@active-4.com>- Committer
Armin Ronacher <armin.ronacher@active-4.com>- Parent 1
1beb0f2- Parent 2
80b2689
13 files changed+24 added−16 removed
modified:docs/deploying/fastcgi.rst+1 added-1 removed
126 unmodified lines127 "/static/" => "/path/to/your/static"128 )129 130 url.rewrite-once = (131- "^(/static.*)$" => "$1",131+ "^(/static($|/.*))$" => "$1",132 "^(/.*)$" => "/yourapplication.fcgi$1"133 134 Remember to enable the FastCGI, alias and rewrite modules. This configuration135 binds the application to `/yourapplication`. If you want the application to84 unmodified linesmodified:docs/tutorial/dbinit.rst+4 added-2 removed
21 unmodified lines22 23 If you want to do that, you first have to import the24 :func:`contextlib.closing` function from the contextlib package. If you25 want to use Python 2.5 it's also necessary to enable the `with` statement26-first (`__future__` imports must be the very first import)::26+first (`__future__` imports must be the very first import). Accordingly,27+add the following lines to your existing imports in `flaskr.py`::28 29 from __future__ import with_statement30 from contextlib import closing31 32 Next we can create a function called `init_db` that initializes the33 database. For this we can use the `connect_db` function we defined33-earlier. Just add that function below the `connect_db` function::34+earlier. Just add that function below the `connect_db` function in35+`flask.py`::36 37 def init_db():38 with closing(connect_db()) as db:39 with app.open_resource('schema.sql') as f:30 unmodified linesmodified:docs/tutorial/introduction.rst+1 added-1 removed
1 unmodified line2 3 Introducing Flaskr4 ==================5 6-We will call our blogging application flaskr here, feel free to chose a6+We will call our blogging application flaskr here, feel free to choose a7 less web-2.0-ish name ;) Basically we want it to do the following things:8 9 1. let the user sign in and out with credentials specified in the10 configuration. Only one user is supported.23 unmodified linesmodified:docs/appcontext.rst+1 added-2 removed
42 unmodified lines43 you can have more than one application in the same Python process.44 45 So how does the code find the “right” application? In the past we46 recommended passing applications around explicitly, but that caused issues47-with libraries that were not designed with that in mind for libraries for48-which it was too inconvenient to make this work.47+with libraries that were not designed with that in mind.48 49 A common workaround for that problem was to use the50 :data:`~flask.current_app` proxy later on, which was bound to the current51 request's application reference. Since however creating such a request36 unmodified linesmodified:docs/becomingbig.rst+1 added-1 removed
24 unmodified lines25 response objects. Dig deeper on the APIs you use, and look for the26 customizations which are available out of the box in a Flask release. Look for27 ways in which your project can be refactored into a collection of utilities and28 Flask extensions. Explore the many `extensions29-<http://flask.pocoo.org/extensions/>` in the community, and look for patterns to29+<http://flask.pocoo.org/extensions/>`_ in the community, and look for patterns to30 build your own extensions if you do not find the tools you need.31 32 Subclass.33 ---------68 unmodified linesmodified:docs/design.rst+3 added-3 removed
88 unmodified lines89 since decorators could be fired in undefined order when the application is90 split into multiple modules.91 92 Another design decision with the Werkzeug routing system is that routes93-in Werkzeug try to ensure that there is that URLs are unique. Werkzeug94-will go quite far with that in that it will automatically redirect to a95-canonical URL if a route is ambiguous.93+in Werkzeug try to ensure that URLs are unique. Werkzeug will go quite far94+with that in that it will automatically redirect to a canonical URL if a route95+is ambiguous.96 97 98 One Template Engine99 -------------------92 unmodified linesmodified:docs/quickstart.rst+1 added-1 removed
375 unmodified lines376 /templates377 /hello.html378 379 For templates you can use the full power of Jinja2 templates. Head over380-to the the official `Jinja2 Template Documentation380+to the official `Jinja2 Template Documentation381 <http://jinja.pocoo.org/2/documentation/templates>`_ for more information.382 383 Here is an example template:384 469 unmodified linesmodified:docs/views.rst+1 added-1 removed
34 unmodified lines35 def dispatch_request(self):36 users = User.query.all()37 return render_template('users.html', objects=users)38 39- app.add_url_rule('/users/', ShowUsers.as_view('show_users'))39+ app.add_url_rule('/users/', view_func=ShowUsers.as_view('show_users'))40 41 As you can see what you have to do is to create a subclass of42 :class:`flask.views.View` and implement43 :meth:`~flask.views.View.dispatch_request`. Then we have to convert that194 unmodified linesmodified:flask/__init__.py+1 added-1 removed
8 unmodified lines9 :copyright: (c) 2011 by Armin Ronacher.10 :license: BSD, see LICENSE for more details.11 """12 13-__version__ = '0.9'13+__version__ = '0.10-dev'14 15 # utilities we import from Werkzeug and Jinja2 that are unused16 # in the module but are exported as public interface.17 from werkzeug.exceptions import abort27 unmodified linesmodified:flask/app.py+1 added-1 removed
1466 unmodified lines1467 .. versionadded:: 0.61468 1469 .. 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 linesmodified:flask/helpers.py+3 added-1 removed
303 unmodified lines304 :exc:`~werkzeug.routing.BuildError`.305 306 :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.top581 unmodified linesmodified:CHANGES+5 added
1 unmodified line2 ===============3 4 Here you can see the full list of changes between each Flask release.5 6+Version 0.107+------------8+9+Release date to be decided.10+11 Version 0.912 -----------13 14 Released on July 1st 2012, codename Campari.364 unmodified linesmodified:setup.py+1 added-1 removed
75 unmodified lines76 print "No problems found in sourcecode."77 78 setup(79 name='Flask',80- version='0.9',80+ version='0.10-dev',81 url='http://github.com/mitsuhiko/flask/',82 license='BSD',83 author='Armin Ronacher',84 author_email='armin.ronacher@active-4.com',27 unmodified lines