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
Provenance
- Commit
67e4d3e- Tree
e928d70- Author
Armin Ronacher <armin.ronacher@active-4.com>- Committer
Armin Ronacher <armin.ronacher@active-4.com>- Parent 1
e9d1fc4- Parent 2
c73d740
24 files changed+38 added−33 removed
modified:docs/deploying/mod_wsgi.rst+1 added-1 removed
107 unmodified lines108 For more information consult the `mod_wsgi wiki`_.109 110 .. _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/114 115 Troubleshooting116 ---------------70 unmodified linesmodified:docs/deploying/wsgi-standalone.rst+1 added-1 removed
62 unmodified lines63 http_server.serve_forever()64 65 .. _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/68 69 Twisted Web70 -----------71 84 unmodified linesmodified:docs/patterns/caching.rst+1 added-1 removed
25 unmodified lines26 from werkzeug.contrib.cache import SimpleCache27 cache = SimpleCache()28 29 If you want to use memcached, make sure to have one of the memcache modules30-supported (you get them from `PyPI <http://pypi.python.org/>`_) and a30+supported (you get them from `PyPI <https://pypi.python.org/>`_) and a31 memcached server running somewhere. This is how you connect to such an32 memcached server then::33 34 from werkzeug.contrib.cache import MemcachedCache35 unmodified linesmodified:docs/patterns/distribute.rst+2 added-2 removed
159 unmodified lines160 folder instead of copying the data over. You can then continue to work on161 the code without having to run `install` again after each change.162 163 164-.. _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.pymodified:docs/patterns/fileuploads.rst+1 added-1 removed
176 unmodified lines177 applications dealing with uploads, there is a Flask extension called178 `Flask-Uploads`_ that implements a full fledged upload mechanism with179 white and blacklisting of extensions and more.180 181-.. _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 lines19 there is a Flask extension that handles that for you. This is recommended20 if you want to get started quickly.21 22 You can download `Flask-SQLAlchemy`_ from `PyPI23-<http://pypi.python.org/pypi/Flask-SQLAlchemy>`_.23+<https://pypi.python.org/pypi/Flask-SQLAlchemy>`_.24 25-.. _Flask-SQLAlchemy: http://packages.python.org/Flask-SQLAlchemy/25+.. _Flask-SQLAlchemy: http://pythonhosted.org/Flask-SQLAlchemy/26 27 28 Declarative29 -----------189 unmodified linesmodified:docs/patterns/wtforms.rst+3 added-3 removed
6 unmodified lines7 will handle here. If you find yourself in the situation of having many8 forms, you might want to give it a try.9 10 When you are working with WTForms you have to define your forms as classes11-first. I recommend breaking up the application into multiple modules 11+first. I recommend breaking up the application into multiple modules12 (:ref:`larger-applications`) for that and adding a separate module for the13 forms.14 15 .. admonition:: Getting most of WTForms with an Extension16 17 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>`_.21 22-.. _Flask-WTF: http://packages.python.org/Flask-WTF/22+.. _Flask-WTF: http://pythonhosted.org/Flask-WTF/23 24 The Forms25 ---------26 100 unmodified linesmodified:docs/tutorial/dbcon.rst+1 added-1 removed
51 unmodified lines52 every time the app context tears down. So what does this mean?53 Essentially the app context is created before the request comes in and is54 destroyed (teared down) whenever the request finishes. A teardown can55 happen because of two reasons: either everything went well (the error56-parameter will be `None`) or an exception happend in which case the error56+parameter will be `None`) or an exception happened in which case the error57 is passed to the teardown function.58 59 Curious about what these contexts mean? Have a look at the60 :ref:`app-context` documentation to learn more.18 unmodified linesmodified:docs/tutorial/folders.rst+1 added-1 removed
18 unmodified lines19 templates you create later in the tutorial will go in this directory.20 21 Continue with :ref:`tutorial-schema`.22 23-.. _Jinja2: http://jinja.pocoo.org/2/23+.. _Jinja2: http://jinja.pocoo.org/modified:docs/tutorial/templates.rst+1 added-1 removed
14 unmodified lines15 the layout of the website in all pages.16 17 Put the following templates into the `templates` folder:18 19-.. _Jinja2: http://jinja.pocoo.org/2/documentation/templates19+.. _Jinja2: http://jinja.pocoo.org/docs/templates20 21 layout.html22 -----------23 88 unmodified linesmodified:docs/api.rst+1 added-1 removed
595 unmodified lines596 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.599 600-.. _blinker: http://pypi.python.org/pypi/blinker600+.. _blinker: https://pypi.python.org/pypi/blinker601 602 Class-Based Views603 -----------------604 151 unmodified linesmodified:docs/conf.py+1 added-1 removed
242 unmodified lines243 # The depth of the table of contents in toc.ncx.244 #epub_tocdepth = 3245 246 intersphinx_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/': None18 unmodified linesmodified:docs/extensiondev.rst+1 added-1 removed
413 unmodified lines414 instead of ``flask_foo`` or ``flaskext_foo`` so that extensions can415 transition to the new package name without affecting users.416 417 418-.. _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 lines185 Many other features have been added, as well. A good guide to new features186 in HTML5 is Mark Pilgrim's soon-to-be-published book, `Dive Into HTML5`_.187 Not all of them are supported in browsers yet, however, so use caution.188 189-.. _Dive Into HTML5: http://www.diveintohtml5.org/189+.. _Dive Into HTML5: http://www.diveintohtml5.info/190 191 What should be used?192 --------------------193 14 unmodified linesmodified:docs/index.rst+3 added-3 removed
19 unmodified lines20 engine and the `Werkzeug`_ WSGI toolkit. These libraries are not documented21 here. If you want to dive into their documentation, check out the22 following links:23 24-- `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>`_26 27 28-.. _Jinja2: http://jinja.pocoo.org/2/28+.. _Jinja2: http://jinja.pocoo.org/29 .. _Werkzeug: http://werkzeug.pocoo.org/30 31 .. include:: contents.rst.incmodified:docs/installation.rst+1 added-1 removed
2 unmodified lines3 Installation4 ============5 6 Flask 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/>`_.8 Werkzeug is a toolkit for WSGI, the standard Python interface between web9 applications and a variety of servers for both development and deployment.10 Jinja2 renders templates.11 170 unmodified linesmodified:docs/quickstart.rst+4 added-4 removed
382 unmodified lines383 384 Generating HTML from within Python is not fun, and actually pretty385 cumbersome because you have to do the HTML escaping on your own to keep386 the 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.388 389 To render a template you can use the :func:`~flask.render_template`390 method. All you have to do is provide the name of the template and the391 variables you want to pass to the template engine as keyword arguments.24 unmodified lines416 /hello.html417 418 For templates you can use the full power of Jinja2 templates. Head over419 to 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.421 422 Here is an example template:423 424 .. sourcecode:: html+jinja429 unmodified lines854 app.logger.error('An error occurred')855 856 The attached :attr:`~flask.Flask.logger` is a standard logging857 :class:`~logging.Logger`, so head over to the official `logging858-documentation <http://docs.python.org/library/logging.html>`_ for more858+documentation <https://docs.python.org/library/logging.html>`_ for more859 information.860 861 Hooking in WSGI Middlewares862 ---------------------------14 unmodified lines877 Ready to deploy your new Flask app? To wrap up the quickstart, you can878 immediately deploy to a hosted platform, all of which offer a free plan for879 small projects:880 881-- `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/>`_884 885 Other places where you can host your Flask app:7 unmodified linesmodified:docs/signals.rst+1 added-1 removed
347 unmodified lines348 message_flashed.connect(record, app)349 350 .. versionadded:: 0.10351 352-.. _blinker: http://pypi.python.org/pypi/blinker352+.. _blinker: https://pypi.python.org/pypi/blinkermodified:docs/templating.rst+1 added-1 removed
7 unmodified lines8 9 This section only gives a very quick introduction into how Jinja210 is integrated into Flask. If you want information on the template11 engine's syntax itself, head over to the official `Jinja2 Template12-Documentation <http://jinja.pocoo.org/2/documentation/templates>`_ for12+Documentation <http://jinja.pocoo.org/docs/templates>`_ for13 more information.14 15 Jinja Setup16 -----------206 unmodified linesmodified:docs/upgrading.rst+1 added-1 removed
41 unmodified lines42 when 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`.45 46-.. _Flask-OldSessions: http://packages.python.org/Flask-OldSessions/46+.. _Flask-OldSessions: http://pythonhosted.org/Flask-OldSessions/47 48 Version 0.949 -----------50 322 unmodified linesmodified:flask/_compat.py+1 added-1 removed
75 unmodified lines76 # 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?81 BROKEN_PYPY_CTXMGR_EXIT = False82 if hasattr(sys, 'pypy_version_info'):83 class _Mgr(object):84 def __enter__(self):13 unmodified linesmodified:flask/helpers.py+1 added-1 removed
660 unmodified lines661 '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)667 668 # 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 linesmodified:CHANGES+1 added-1 removed
399 unmodified lines400 - 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.403 404-.. _blinker: http://pypi.python.org/pypi/blinker404+.. _blinker: https://pypi.python.org/pypi/blinker405 406 Version 0.5.2407 -------------408 106 unmodified linesmodified:tox.ini+6 added-1 removed
1 [tox]2-envlist = py26, py27, pypy, py332+envlist = docs, py26, py27, pypy, py33, py343 4 [testenv]5 deps = blinker6 commands = python run-tests.py []7+8+9+[testenv:docs]10+deps = sphinx11+commands = sphinx-build -W -b linkcheck -d {envtmpdir}/doctrees docs docs/_build/linkcheck