Skip to content

Commit 1e4e578

Browse files
committed
Added the extensions dictionary on the application
1 parent eb67242 commit 1e4e578

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

flask/app.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,22 @@ def __init__(self, import_name, static_path=None):
256256
#: .. versionadded:: 0.5
257257
self.modules = {}
258258

259+
#: a place where extensions can store application specific state. For
260+
#: example this is where an extension could store database engines and
261+
#: similar things. For backwards compatibility extensions should register
262+
#: themselves like this::
263+
#:
264+
#: if not hasattr(app, 'extensions'):
265+
#: app.extensions = {}
266+
#: app.extensions['extensionname'] = SomeObject()
267+
#:
268+
#: The key must match the name of the `flaskext` module. For example in
269+
#: case of a "Flask-Foo" extension in `flaskext.foo`, the key would be
270+
#: ``'foo'``.
271+
#:
272+
#: .. versionadded:: 0.7
273+
self.extensions = {}
274+
259275
#: The :class:`~werkzeug.routing.Map` for this instance. You can use
260276
#: this to change the routing converters after the class was created
261277
#: but before any routes are connected. Example::

0 commit comments

Comments
 (0)