Package wtf :: Module services
[hide private]
[frames] | no frames]

Module services

source code

This module provides for service loading and initialization.


Author: André Malo

Classes [hide private]
  ServiceError
Service intialization failure
  ServiceInterfaceWarning
Service interface warning
  ServiceInterface
Interface for global and local services, initialized at startup time
  ServiceManager
Service manager
Functions [hide private]
 
global_service(name)
Find global service by name
source code
ServiceManager
init(config, opts, args, services, module='__svc__')
Initialize services
source code
Variables [hide private]
  _global_services = {}
  __package__ = 'wtf'
Function Details [hide private]

global_service(name)

source code 
Find global service by name
Returns:
Service module or None

init(config, opts, args, services, module='__svc__')

source code 

Initialize services

The function can only be called once (because the module will be only initialized once)

Parameters:
  • config (wtf.config.Config) - Configuration
  • opts (optparse.OptionContainer) - Command line options
  • args (list) - Positioned command line arguments
  • services (iterable) - List of services to initialize. The list items can either be classes (which are instanciated) or strings containing dotted class names (which will be loaded and instanciated). Service classes must implement the ServiceInterface.
  • module (str) - Dotted module name, where global services are put into
Returns: ServiceManager
Service manager