Extension¶
-
class
dasha.core.Extension(*args, **kwargs)[source]¶ Bases:
tollan.utils.namespace.NamespaceThis class provides a unified interface to configure and initialize extensions using the flask factory pattern (flask extensions).
It shall be constructed via the
from_dict()class method. Two items are expected:“module”. This shall be a module that defines the following two methods:
1.
init_ext. This shall be a function that takes a config dict and return a properly configured underlying flask extension object.2.
init_app. This shall be a function that takes the underlying flask extension object and a config dict. It is called to setup the flask extension with respect to the given app.“config”. The config dict to be passed to
init_extandinit_app.
Conventionally, an
ObjectProxyobject should be made available at the extension module level to allow convenient importing from other modules. The__wrapped__object should be set to the underlying flask extension object at the end ofinit_ext.For an example of extension module, see
dbMethods Summary
init_app(self, server)Setup the underlying extension for app.
Methods Documentation
-
init_app(self, server)[source]¶ Setup the underlying extension for app.
RuntimeErroris raised if this function is called multiple times.