Package wtf :: Package impl :: Module _gateway :: Class Gateway
[hide private]
[frames] | no frames]

Class Gateway

source code

object --+
         |
        Gateway
Known Subclasses:

WS gateway logic
Instance Methods [hide private]
 
__init__(self, config, opts, args)
Initialization
source code
dict
_populate_base_env(self, base_env)
Modify base_env before it's finalized
source code
 
handle(self, connection, request, application)
Gateway between the request and the application
source code
dict
_init_from_request(self, connection, request)
Initialize env and response starter from request implementation
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Instance Variables [hide private]
tuple _baseenv
Base environment (((key, value), ...))
list args
Positioned command line arguments
wtf.config.Config config
Configuration
optparse.OptionContainer opts
Command line options
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, config, opts, args)
(Constructor)

source code 
Initialization
Parameters:
  • config (wtf.config.Config) - Configuration
  • opts (optparse.OptionContainer) - Command line options
  • args (list) - Positioned command line arguments
Overrides: object.__init__

_populate_base_env(self, base_env)

source code 

Modify base_env before it's finalized

This is for subclasses to allow modifiying the base environment. By default this method is a no-op.

Parameters:
  • base_env (dict) - The base environment so far
Returns: dict
The modified base_env (maybe the same dict as passed in)

handle(self, connection, request, application)

source code 
Gateway between the request and the application
Parameters:
  • connection (Connection) - Connection instance
  • request (any) - Request instance (only specific subclasses have to understand it)
  • application (callable) - WSGI application

_init_from_request(self, connection, request)

source code 

Initialize env and response starter from request implementation

Subclasses must override the method.

Parameters:
  • connection (Connection) - The connection the request is handled on
  • request (any) - The request instance
Returns: dict
A tuple of the request env and a specific response starter (`(dict, callable))