"""This is a "configuration" class for server contexts."""
__docformat__ = "restructuredtext"
import os
from aquarium.util.ContainerClass import ContainerClass
class ServerContext(ContainerClass):
"""This is a "configuration" class for server contexts.
It's job is just to hold data. If you subclass this class, it will provide
defaults for everything.
The following attributes are used. Note, each has a class default.
doc_root
This is the document root. If there is an "htdocs" directory in the
current directory, that is used. Otherwise, the default is
``os.curdir``. You may use a zip file for your document root.
mounts
This is a list of tuples of the form ``[(url_path, path_translated)]``,
for instance, ``[("/log", "/var/log")]``. More than one tuple may use
the same ``url_path`` or ``path_translated``. Basically, I'll go down
the list and whoever has the file I'm looking for first wins. You can
even use "/" as your ``url_path``. Conceptually, the first item in
``mounts`` is *implicitly* ``("/", doc_root)``. You may use a zip file
for ``path_translated``. If ``url_path`` doesn't end in "/", I'll add
one implicitly; otherwise things get too confusing. The default value
for ``mounts`` is ``[]``.
server_name
This is the server name used for CGI's ``SERVER_NAME``. The default is
whatever is received by the server (None will be used for the time
being).
request_queue_size
How big should the queue be for waiting requests? The default is 20.
aquarium_entry_point
This is the name of the entry point into Aquarium. By default, it's
``aquarium.util.Aquarium``. This is the hook to use if you need to
subclass that module.
"""
if os.path.isdir("htdocs"):
doc_root = "htdocs"
else:
doc_root = os.curdir
mounts = []
server_name = None
request_queue_size = 20
aquarium_entry_point = "aquarium.util.Aquarium"
|