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 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

13 files+24 added−16 removed

modified:docs/deploying/fastcgi.rst+1 added-1 removed
126 unmodified lines
127 "/static/" => "/path/to/your/static"128 )129130 url.rewrite-once = (131 "^(/static.*)$" => "$1",131 "^(/static($|/.*))$" => "$1",132 "^(/.*)$" => "/yourapplication.fcgi$1"133134Remember to enable the FastCGI, alias and rewrite modules. This configuration135binds the application to `/yourapplication`. If you want the application to
84 unmodified lines
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/becomingbig.rst+1 added-1 removed
24 unmodified lines
25response objects. Dig deeper on the APIs you use, and look for the26customizations which are available out of the box in a Flask release. Look for27ways in which your project can be refactored into a collection of utilities and28Flask 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 to30build your own extensions if you do not find the tools you need.3132Subclass.33---------
68 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:docs/views.rst+1 added-1 removed
34 unmodified lines
35 def dispatch_request(self):36 users = User.query.all()37 return render_template('users.html', objects=users)3839 app.add_url_rule('/users/', ShowUsers.as_view('show_users'))39 app.add_url_rule('/users/', view_func=ShowUsers.as_view('show_users'))4041As 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 that
194 unmodified lines
modified:flask/__init__.py+1 added-1 removed
8 unmodified lines
9 :copyright: (c) 2011 by Armin Ronacher.10 :license: BSD, see LICENSE for more details.11"""1213__version__ = '0.9'13__version__ = '0.10-dev'1415# utilities we import from Werkzeug and Jinja2 that are unused16# in the module but are exported as public interface.17from werkzeug.exceptions import abort
27 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+5 added
1 unmodified line
2===============34Here you can see the full list of changes between each Flask release.56Version 0.107------------89Release date to be decided.1011Version 0.912-----------1314Released on July 1st 2012, codename Campari.
364 unmodified lines
modified:setup.py+1 added-1 removed
75 unmodified lines
76 print "No problems found in sourcecode."7778setup(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