5.2.10 draco.server - the Server object

The Server class is a Draco object that provides access to server variables and some information about the web server Draco is running on. Server variables are shared amongst all handlers and templates in the web application and persist forever. The global instance of the Application class is stored under the name application in the current module.

Server variables depend on database access and are not available when there is no database access. You can check if server variables are available by testing the global server instance for non-zeroness.

The Server object provides access to the server namespace using the namespace API. For example:

from draco.server import server

server['spanish'] = 'inquisition'
del server['spanish']

class Server( )
Global Draco object that provides access to the server namespace and gives some information about the web server that Draco is running on.

The public methods of Server are:

namespace( scope)
Return a server subnamespace with scope scope. Server namespaces with different scopes are independant. The default namespace (the one available with the global Server object) has the scope '__system__'.

admin( )
Return the email address of the administrator responsible for this web server.

childnum( )
Return the number of the web server thread or process that is handling the current request.

address( )
Return the local address of the web server.

port( )
Return the port number the web server is listening on.

hostname( )
Return the host name this web server is running on.