Package cherrypy :: Module _cpengine :: Class Engine
[hide private]
[frames] | no frames]

Class Engine

source code

object --+
         |
        Engine

Interface for (HTTP) applications, plus process controls.

Servers and gateways should not instantiate Request objects directly. Instead, they should ask an Engine object for a request via the Engine.request method.

Blocking is completely optional! The Engine's blocking, signal and interrupt handling, privilege dropping, and autoreload features are not a good idea when driving CherryPy applications from another deployment tool (but an Engine is a great deployment tool itself). By calling start(blocking=False), you avoid blocking and interrupt- handling issues. By setting Engine.SIGHUP and Engine.SIGTERM to None, you can completely disable the signal handling (and therefore disable autoreloads triggered by SIGHUP). Set Engine.autoreload_on to False to disable autoreload entirely.

Nested Classes [hide private]
  request_class
An HTTP request.
  response_class
An HTTP Response, including status, headers, and body.
Instance Methods [hide private]
 
__init__(self)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
start(self, blocking=True)
Start the application engine.
source code
 
block(self)
Block forever (wait for stop(), KeyboardInterrupt or SystemExit).
source code
 
reexec(self)
Re-execute the current process.
source code
 
autoreload(self)
Reload the process if registered files have been modified.
source code
 
stop(self)
Stop the application engine.
source code
 
restart(self)
Restart the application engine (does not block).
source code
 
wait(self)
Block the caller until ready to receive requests (or error).
source code
 
request(self, local_host, remote_host, scheme='http', server_protocol='HTTP/1.1')
Obtain and return an HTTP Request object.
source code
 
release(self)
Close and de-reference the current request and response.
source code
 
monitor(self)
Check timeout on all responses.
source code
 
start_with_callback(self, func, args=None, kwargs=None)
Start the given func in a new thread, then start self and block.
source code
 
SIGHUP(self, signum=None, frame=None) source code
 
SIGTERM(self, signum=None, frame=None) source code
 
_set_signals(self) source code
 
drop_privileges(self)
Drop privileges.
source code

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

Class Variables [hide private]
  deadlock_poll_freq = 60
  autoreload_on = True
  autoreload_frequency = 1
  autoreload_match = '.*'
  reexec_retry = 2
  uid = None
  gid = None
  umask = None
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

source code 
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
Overrides: object.__init__
(inherited documentation)

request(self, local_host, remote_host, scheme='http', server_protocol='HTTP/1.1')

source code 

Obtain and return an HTTP Request object. (Core)

local_host should be an http.Host object with the server info. remote_host should be an http.Host object with the client info. scheme: either "http" or "https"; defaults to "http"

release(self)

source code 
Close and de-reference the current request and response. (Core)

monitor(self)

source code 
Check timeout on all responses. (Internal)

drop_privileges(self)

source code 
Drop privileges. UNIX version (uid, gid, and umask).