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 e9d1fc4, c73d740 · Browse files · 24 files+38 added−33 removed
This commit

State

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

Diff stats

24 files+38 added−33 removed

  • other:+38 added−33 removed

24 files+38 added−33 removed

modified:docs/deploying/mod_wsgi.rst+1 added-1 removed
107 unmodified lines
108For more information consult the `mod_wsgi wiki`_.109110.. _mod_wsgi: http://code.google.com/p/modwsgi/111.. _installation instructions: http://code.google.com/p/modwsgi/wiki/QuickInstallationGuide112.. _virtual python: http://pypi.python.org/pypi/virtualenv112.. _virtual python: https://pypi.python.org/pypi/virtualenv113.. _mod_wsgi wiki: http://code.google.com/p/modwsgi/wiki/114115Troubleshooting116---------------
70 unmodified lines
modified:docs/deploying/wsgi-standalone.rst+1 added-1 removed
62 unmodified lines
63 http_server.serve_forever()6465.. _Gevent: http://www.gevent.org/66.. _greenlet: http://greenlet.readthedocs.org/en/latest/67.. _libevent: http://monkey.org/~provos/libevent/67.. _libevent: http://libevent.org/6869Twisted Web70-----------71
84 unmodified lines
modified:docs/patterns/caching.rst+1 added-1 removed
25 unmodified lines
26 from werkzeug.contrib.cache import SimpleCache27 cache = SimpleCache()2829If you want to use memcached, make sure to have one of the memcache modules30supported (you get them from `PyPI <http://pypi.python.org/>`_) and a30supported (you get them from `PyPI <https://pypi.python.org/>`_) and a31memcached server running somewhere. This is how you connect to such an32memcached server then::3334 from werkzeug.contrib.cache import MemcachedCache
35 unmodified lines
modified:docs/patterns/distribute.rst+2 added-2 removed
159 unmodified lines
160folder instead of copying the data over. You can then continue to work on161the code without having to run `install` again after each change.162163164.. _distribute: http://pypi.python.org/pypi/distribute165.. _pip: http://pypi.python.org/pypi/pip164.. _distribute: https://pypi.python.org/pypi/distribute165.. _pip: https://pypi.python.org/pypi/pip166.. _distribute_setup.py: http://python-distribute.org/distribute_setup.py
modified:docs/patterns/fileuploads.rst+1 added-1 removed
176 unmodified lines
177applications dealing with uploads, there is a Flask extension called178`Flask-Uploads`_ that implements a full fledged upload mechanism with179white and blacklisting of extensions and more.180181.. _Flask-Uploads: http://packages.python.org/Flask-Uploads/181.. _Flask-Uploads: http://pythonhosted.org/Flask-Uploads/
modified:docs/patterns/sqlalchemy.rst+2 added-2 removed
18 unmodified lines
19there is a Flask extension that handles that for you. This is recommended20if you want to get started quickly.2122You can download `Flask-SQLAlchemy`_ from `PyPI23<http://pypi.python.org/pypi/Flask-SQLAlchemy>`_.23<https://pypi.python.org/pypi/Flask-SQLAlchemy>`_.2425.. _Flask-SQLAlchemy: http://packages.python.org/Flask-SQLAlchemy/25.. _Flask-SQLAlchemy: http://pythonhosted.org/Flask-SQLAlchemy/262728Declarative29-----------
189 unmodified lines
modified:docs/patterns/wtforms.rst+3 added-3 removed
6 unmodified lines
7will handle here. If you find yourself in the situation of having many8forms, you might want to give it a try.910When you are working with WTForms you have to define your forms as classes11first. I recommend breaking up the application into multiple modules 11first. I recommend breaking up the application into multiple modules12(:ref:`larger-applications`) for that and adding a separate module for the13forms.1415.. admonition:: Getting most of WTForms with an Extension1617 The `Flask-WTF`_ extension expands on this pattern and adds a few18 handful little helpers that make working with forms and Flask more19 fun. You can get it from `PyPI20 <http://pypi.python.org/pypi/Flask-WTF>`_.20 <https://pypi.python.org/pypi/Flask-WTF>`_.2122.. _Flask-WTF: http://packages.python.org/Flask-WTF/22.. _Flask-WTF: http://pythonhosted.org/Flask-WTF/2324The Forms25---------26
100 unmodified lines
modified:docs/tutorial/dbcon.rst+1 added-1 removed
51 unmodified lines
52every time the app context tears down. So what does this mean?53Essentially the app context is created before the request comes in and is54destroyed (teared down) whenever the request finishes. A teardown can55happen because of two reasons: either everything went well (the error56parameter will be `None`) or an exception happend in which case the error56parameter will be `None`) or an exception happened in which case the error57is passed to the teardown function.5859Curious about what these contexts mean? Have a look at the60:ref:`app-context` documentation to learn more.
18 unmodified lines
modified:docs/tutorial/folders.rst+1 added-1 removed
18 unmodified lines
19templates you create later in the tutorial will go in this directory.2021Continue with :ref:`tutorial-schema`.2223.. _Jinja2: http://jinja.pocoo.org/2/23.. _Jinja2: http://jinja.pocoo.org/
modified:docs/tutorial/templates.rst+1 added-1 removed
14 unmodified lines
15the layout of the website in all pages.1617Put the following templates into the `templates` folder:1819.. _Jinja2: http://jinja.pocoo.org/2/documentation/templates19.. _Jinja2: http://jinja.pocoo.org/docs/templates2021layout.html22-----------23
88 unmodified lines
modified:docs/api.rst+1 added-1 removed
595 unmodified lines
596 otherwise returns a fake signal that has a send method that will597 do nothing but will fail with a :exc:`RuntimeError` for all other598 operations, including connecting.599600.. _blinker: http://pypi.python.org/pypi/blinker600.. _blinker: https://pypi.python.org/pypi/blinker601602Class-Based Views603-----------------604
151 unmodified lines
modified:docs/conf.py+1 added-1 removed
242 unmodified lines
243# The depth of the table of contents in toc.ncx.244#epub_tocdepth = 3245246intersphinx_mapping = {247 'http://docs.python.org/dev': None,247 'https://docs.python.org/dev': None,248 'http://werkzeug.pocoo.org/docs/': None,249 'http://www.sqlalchemy.org/docs/': None,250 'http://wtforms.simplecodes.com/docs/0.5/': None,251 'http://discorporate.us/projects/Blinker/docs/1.1/': None
18 unmodified lines
modified:docs/extensiondev.rst+1 added-1 removed
413 unmodified lines
414instead of ``flask_foo`` or ``flaskext_foo`` so that extensions can415transition to the new package name without affecting users.416417418.. _OAuth extension: http://packages.python.org/Flask-OAuth/418.. _OAuth extension: http://pythonhosted.org/Flask-OAuth/419.. _mailinglist: http://flask.pocoo.org/mailinglist/420.. _IRC channel: http://flask.pocoo.org/community/irc/
modified:docs/htmlfaq.rst+1 added-1 removed
184 unmodified lines
185Many other features have been added, as well. A good guide to new features186in HTML5 is Mark Pilgrim's soon-to-be-published book, `Dive Into HTML5`_.187Not all of them are supported in browsers yet, however, so use caution.188189.. _Dive Into HTML5: http://www.diveintohtml5.org/189.. _Dive Into HTML5: http://www.diveintohtml5.info/190191What should be used?192--------------------193
14 unmodified lines
modified:docs/index.rst+3 added-3 removed
19 unmodified lines
20engine and the `Werkzeug`_ WSGI toolkit. These libraries are not documented21here. If you want to dive into their documentation, check out the22following links:2324- `Jinja2 Documentation <http://jinja.pocoo.org/2/documentation/>`_25- `Werkzeug Documentation <http://werkzeug.pocoo.org/documentation/>`_24- `Jinja2 Documentation <http://jinja.pocoo.org/docs>`_25- `Werkzeug Documentation <http://werkzeug.pocoo.org/docs>`_262728.. _Jinja2: http://jinja.pocoo.org/2/28.. _Jinja2: http://jinja.pocoo.org/29.. _Werkzeug: http://werkzeug.pocoo.org/3031.. include:: contents.rst.inc
modified:docs/installation.rst+1 added-1 removed
2 unmodified lines
3Installation4============56Flask depends on some external libraries, like `Werkzeug7<http://werkzeug.pocoo.org/>`_ and `Jinja2 <http://jinja.pocoo.org/2/>`_.7<http://werkzeug.pocoo.org/>`_ and `Jinja2 <http://jinja.pocoo.org/>`_.8Werkzeug is a toolkit for WSGI, the standard Python interface between web9applications and a variety of servers for both development and deployment.10Jinja2 renders templates.11
170 unmodified lines
modified:docs/quickstart.rst+4 added-4 removed
382 unmodified lines
383384Generating HTML from within Python is not fun, and actually pretty385cumbersome because you have to do the HTML escaping on your own to keep386the application secure. Because of that Flask configures the `Jinja2387<http://jinja.pocoo.org/2/>`_ template engine for you automatically.387<http://jinja.pocoo.org/>`_ template engine for you automatically.388389To render a template you can use the :func:`~flask.render_template`390method. All you have to do is provide the name of the template and the391variables you want to pass to the template engine as keyword arguments.
24 unmodified lines
416 /hello.html417418For templates you can use the full power of Jinja2 templates. Head over419to the official `Jinja2 Template Documentation420<http://jinja.pocoo.org/2/documentation/templates>`_ for more information.420<http://jinja.pocoo.org/docs/templates>`_ for more information.421422Here is an example template:423424.. sourcecode:: html+jinja
429 unmodified lines
854 app.logger.error('An error occurred')855856The attached :attr:`~flask.Flask.logger` is a standard logging857:class:`~logging.Logger`, so head over to the official `logging858documentation <http://docs.python.org/library/logging.html>`_ for more858documentation <https://docs.python.org/library/logging.html>`_ for more859information.860861Hooking in WSGI Middlewares862---------------------------
14 unmodified lines
877Ready to deploy your new Flask app? To wrap up the quickstart, you can878immediately deploy to a hosted platform, all of which offer a free plan for879small projects:880881- `Deploying Flask on Heroku <http://devcenter.heroku.com/articles/python>`_881- `Deploying Flask on Heroku <https://devcenter.heroku.com/articles/python>`_882- `Deploying WSGI on dotCloud <http://docs.dotcloud.com/services/python/>`_883 with `Flask-specific notes <http://flask.pocoo.org/snippets/48/>`_884885Other places where you can host your Flask app:
7 unmodified lines
modified:docs/signals.rst+1 added-1 removed
347 unmodified lines
348 message_flashed.connect(record, app)349350 .. versionadded:: 0.10351352.. _blinker: http://pypi.python.org/pypi/blinker352.. _blinker: https://pypi.python.org/pypi/blinker
modified:docs/templating.rst+1 added-1 removed
7 unmodified lines
89This section only gives a very quick introduction into how Jinja210is integrated into Flask. If you want information on the template11engine's syntax itself, head over to the official `Jinja2 Template12Documentation <http://jinja.pocoo.org/2/documentation/templates>`_ for12Documentation <http://jinja.pocoo.org/docs/templates>`_ for13more information.1415Jinja Setup16-----------
206 unmodified lines
modified:docs/upgrading.rst+1 added-1 removed
41 unmodified lines
42when there is no request context yet but an application context. The old43``flask.Flask.request_globals_class`` attribute was renamed to44:attr:`flask.Flask.app_ctx_globals_class`.4546.. _Flask-OldSessions: http://packages.python.org/Flask-OldSessions/46.. _Flask-OldSessions: http://pythonhosted.org/Flask-OldSessions/4748Version 0.949-----------50
322 unmodified lines
modified:flask/_compat.py+1 added-1 removed
75 unmodified lines
76# Certain versions of pypy have a bug where clearing the exception stack77# breaks the __exit__ function in a very peculiar way. This is currently78# true for pypy 2.2.1 for instance. The second level of exception blocks79# is necessary because pypy seems to forget to check if an exception80# happend until the next bytecode instruction?80# happened until the next bytecode instruction?81BROKEN_PYPY_CTXMGR_EXIT = False82if hasattr(sys, 'pypy_version_info'):83 class _Mgr(object):84 def __enter__(self):
13 unmodified lines
modified:flask/helpers.py+1 added-1 removed
660 unmodified lines
661 'module "%s". This can happen because the '662 'module came from an import hook that does '663 'not provide file name information or because '664 'it\'s a namespace package. In this case '665 'the root path needs to be explictly '665 'the root path needs to be explicitly '666 'provided.' % import_name)667668 # filepath is import_name.py for a module, or __init__.py for a package.669 return os.path.dirname(os.path.abspath(filepath))
230 unmodified lines
modified:CHANGES+1 added-1 removed
399 unmodified lines
400- modules can now register for a subdomain instead of just an URL401 prefix. This makes it possible to bind a whole module to a402 configurable subdomain.403404.. _blinker: http://pypi.python.org/pypi/blinker404.. _blinker: https://pypi.python.org/pypi/blinker405406Version 0.5.2407-------------408
106 unmodified lines
modified:tox.ini+6 added-1 removed
1[tox]2envlist = py26, py27, pypy, py332envlist = docs, py26, py27, pypy, py33, py3434[testenv]5deps = blinker6commands = python run-tests.py []789[testenv:docs]10deps = sphinx11commands = sphinx-build -W -b linkcheck -d {envtmpdir}/doctrees docs docs/_build/linkcheck