watson.framework.applications¶
-
class
watson.framework.applications.
Base
(config=None)[source]¶ The core application structure for a Watson application.
It makes heavy use of the IocContainer and EventDispatcher classes to handle the wiring and executing of methods. The default configuration for Watson applications can be seen at watson.framework.config.
-
_config
¶ dict – The configuration for the application.
-
global_app
¶ Base – A reference to the currently running application.
-
__init__
(config=None)[source]¶ Initializes the application.
Registers any events that are within the application configuration.
Example:
app = Base()
- Events:
- Dispatches the INIT.
Parameters: config (mixed) – See the Base.config properties.
-
config
¶ Returns the configuration of the application.
-
container
¶ Returns the applications IocContainer.
If no container has been created, a new container will be created based on the dependencies within the application configuration.
-
register_components
()[source]¶ Register any components specified with the application.
- Components can include the following modules:
- dependencies
- events
- models
- routes
- views
Registering a component will merge any configuration settings within the above modules prior to the application booting.
An example component might look like:
/component /views /index.html /routes.py /views.py
-