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[source]

Returns the configuration of the application.

container[source]

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_events()[source]

Collect all the events from the app config and register them against the event dispatcher.

trigger_init_event()[source]

Execute any event listeners for the INIT event.

class watson.framework.applications.Console(config=None)[source]

An application structure suitable for the command line.

For more information regarding creating an application consult the documentation.

Example:

application = applications.Console({...})
application()
__init__(config=None)[source]
class watson.framework.applications.Http(config=None)[source]

An application structure suitable for use with the WSGI protocol.

For more information regarding creating an application consult the documentation.

Example:

application = applications.Http({..})
application(environ, start_response)