Permalink
Browse files

Added the extensions dictionary on the application

  • Loading branch information...
1 parent eb67242 commit 1e4e578d73b78e2e11696b2e2d0763fd00367521 @mitsuhiko mitsuhiko committed Sep 12, 2010
Showing with 16 additions and 0 deletions.
  1. +16 −0 flask/app.py
View
16 flask/app.py
@@ -256,6 +256,22 @@ def __init__(self, import_name, static_path=None):
#: .. versionadded:: 0.5
self.modules = {}
+ #: a place where extensions can store application specific state. For
+ #: example this is where an extension could store database engines and
+ #: similar things. For backwards compatibility extensions should register
+ #: themselves like this::
+ #:
+ #: if not hasattr(app, 'extensions'):
+ #: app.extensions = {}
+ #: app.extensions['extensionname'] = SomeObject()
+ #:
+ #: The key must match the name of the `flaskext` module. For example in
+ #: case of a "Flask-Foo" extension in `flaskext.foo`, the key would be
+ #: ``'foo'``.
+ #:
+ #: .. versionadded:: 0.7
+ self.extensions = {}
+
#: The :class:`~werkzeug.routing.Map` for this instance. You can use
#: this to change the routing converters after the class was created
#: but before any routes are connected. Example::

0 comments on commit 1e4e578

Please sign in to comment.