zoom.server module

zoom.server

runs an instance of Zoom using the builtin Python WSGI server.

>>> server = WSGIApplication()
class zoom.server.WSGIApplication(instance='.', handlers=None, username=None)

Bases: object

a WSGI Application wrapper

class zoom.server.ZoomWSGIRequestHandler(request, client_address, server)

Bases: wsgiref.simple_server.WSGIRequestHandler

log_message(fmt, *args)

Log an arbitrary message.

This is used by all other logging functions. Override it if you have specific logging wishes.

The first argument, FORMAT, is a format string for the message to be logged. If the format string contains any % escapes requiring parameters, they should be specified as subsequent arguments (it’s just like printf!).

The client ip and current date/time are prefixed to every message.

logger = <Logger zoom.server (WARNING)>
zoom.server.application(environ, start_response)

run Zoom using external WSGI Server

Assumes that the WSGI script is located one directory below the instance directory. In an typical installation the instance directory would be /work/web and the WSGI script would be located in /work/web/www.

If you need to launch from somewhere else just build a function like this of your own and create the WSGIApplication instance using a path of your choosing.

>>> save_dir = os.getcwd()
>>> try:
...     env = dict(DOCUMENT_ROOT=zoom.tools.zoompath('web', 'www'))
...     response = application(env, lambda a, b: None)
... finally:
...     os.chdir(save_dir)
>>> len(response)
1
zoom.server.debug(environ, start_response)

Configuration Debugging App

zoom.server.reset_modules()

reset the modules to a known starting set

memorizes the modules currently in use and then removes any other modules when called again

zoom.server.run(port=80, instance=None, handlers=None, username=None)

run using internal HTTP Server

The instance variable is the path of the directory on the system where the sites folder is located. (e.g. /work/web)

zoom.server.run_as_cgi(environ=None, instance=None)

Run Zoom as a CGI script