Skip to content
Myr

More upgrade notes for blueprints

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 · parent 207a790 · Browse files · 1 file+37 added−0 removed
This commit

State

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

Diff stats

1 file+37 added−0 removed

  • other:+37 added−0 removed

1 file+37 added−0 removed

modified:docs/upgrading.rst+37 added
158 unmodified lines
159 ...160161(Note that :meth:`register_error_handler` is new in Flask 0.7)162163Blueprint Support164`````````````````165166Blueprints replace the previous concept of “Modules” in Flask. They167provide better semantics for various features and work better with large168applications. The update script provided should be able to upgrade your169applications automatically, but there might be some cases where it fails170to upgrade. What changed?171172- Blueprints need explicit names. Modules had an automatic name173 guesssing scheme where the shortname for the module was taken from the174 last part of the import module. The upgrade script tries to guess175 that name but it might fail as this information could change at176 runtime.177- Blueprints have an inverse behavior for :meth:`url_for`. Previously178 ``.foo`` told :meth:`url_for` that it should look for the endpoint179 `foo` on the application. Now it means “relative to current module”.180 The script will inverse all calls to :meth:`url_for` automatically for181 you. It will do this in a very eager way so you might end up with182 some unnecessary leading dots in your code if you're not using183 modules.184- Blueprints do not automatically provide static folders. They will185 still export templates from a folder called `templates` next to their186 location however. If you want to continue serving static files you187 need to tell the constructor explicitly the path to the static folder188 (which can be relative to the blueprint's module path).189- Rendering templates was simplified. Now the general syntax is190 ``blueprint-shortname:template-name`` for rendering templates instead191 of ``blueprint-shortname/template-name`` which was confusing and often192 clashed with templates from the global template loader.193194If you continue to use the `Module` object which is deprecated, Flask will195restore the previous behavior as good as possible. However we strongly196recommend upgrading to the new blueprints as they provide a lot of useful197improvement such as the ability to attach a blueprint multiple times,198blueprint specific error handlers and a lot more.199200201Version 0.6202-----------203204Flask 0.6 comes with a backwards incompatible change which affects the
87 unmodified lines