Package aquarium :: Package conf :: Module AquariumProperties
[show private | hide private]
[frames | no frames]

Module aquarium.conf.AquariumProperties

Document the API for AquariumProperties.

AquariumProperties is a simple module that defines a lot of "constants" (they aren't actually constants, but they are in all upper-case letters and it is expected that you will not modify them at runtime). Anyone may make use of AquariumProperties, but the following way of importing AquariumProperties is suggested for consistency:

import aquarium.conf.AquariumProperties as properties

Equivalently, in AquariumClass's you can get the properties instance directly from the Context object:

self._ctx.properties

Or in Cheetah:

$properties

The following is a sample taken from Seamstress Exchange:

"""This is the "configuration file" for the program.

The AquariumProperties module serves as the "configuration file" for
the program.  Users of this program should edit this file to suit their
needs.

PLEASE NOTE: for documentation purposes, please keep the Seamstress
Exchange AquariumProperties file and Aquarium's AquariumProperties file
in sync.

"""

import os


# What urlscheme module should be used.  urlscheme modules dictate how
# the screen parameter is positioned in URL's.

URL_SCHEME = "ScriptName"

# Will cookies be used on this site?  If this variable is set to 1,
# we'll automatically load the cookie object (which acts like a dict)
# dict) into ctx.request.cookie, and ctx.response.cookie will be
# initialized.

USE_COOKIES = 1

# Will sessions be used?  Session information will be stored in
# ctx.session.  The session identifier, sid, is accessable via
# ctx.session["sid"].  It will be persisted via ctx.url.screen and/or
# via cookies.

USE_SESSIONS = 1
if USE_SESSIONS:

    # If so, should we *try* to use cookies for persisting the session
    # identifier?

    USE_SESSION_COOKIES = 1
    if USE_SESSION_COOKIES:

        # Should we force the use of cookies for sessions (i.e. never
        # transmit the sid via GET or POST variables)?

        FORCE_SESSION_COOKIES = 1

        # Set the cookie to expire based on MAXIMUM_SESSION_LIFETIME?
        # If 0, the default, let the cookie continue exactly until the
        # user closes his browser.

        SET_COOKIE_EXPIRATION = 0

    # Which session container module should we use?  Beware that not
    # all session containers are appropriate for all environments.

    SESSION_CONTAINER_MODULE = "SessionContainer"

    # What is the maximum session lifetime in seconds?

    MAXIMUM_SESSION_LIFETIME = 60 * 60 * 2      # I.e. 2 hours

# Will a database be used?

USE_DATABASE = 1
if USE_DATABASE:

    # Which Aquarium database assistant module should we use?  You'll
    # probably want to just stick with the default, DatabaseAssistant.
    # Note, if you decide to use QuickSwitchDatabaseAssistant instead,
    # (so that you can rapidly toggle between different RDBM's), you'll
    # probably want to hack the python database module argument as well
    # as the connection arguments so that they vary based on your
    # choice of DBM's (just move them around within the if statements).

    AQUARIUM_DATABASE_ASSISTANT_MODULE = "QuickSwitchDatabaseAssistant"
    if AQUARIUM_DATABASE_ASSISTANT_MODULE=="QuickSwitchDatabaseAssistant":

        # Which RDBM do you wish to use (more information about how to
        # set this up can be found in
        # database/QuickSwitchDatabaseAssistant).

        DATABASE_RDBM = "mysql"
        if DATABASE_RDBM=="mysql":

            # Which Python database module should we use?  You'll have
            # to install this module on your system yourself.  For more
            # information, check here:
            # <http://www.python.org/topics/database/ ...  ...
            # DatabaseAPI-2.0.html>.

            PYTHON_DATABASE_MODULE = "MySQLdb"

            # Specify the database connection parameters here.  The
            # number and name of the arguments in this list and dict
            # may vary based on the python database module that you
            # selected above.  Remember, if you change these and you're
            # using persistent database connections (not programmed
            # yet), you'll probably have to restart your Web server
            # before your changes will take effect.

            DATABASE_CONNECTION_ARGS = ()
            DATABASE_CONNECTION_KWARGS = {
                "host":"localhost",
                "user":"test",
                "passwd":"",
                "db":"test"
            }

        elif DATABASE_RDBM=="sqlserver":
            PYTHON_DATABASE_MODULE = "ODBC.EasySoft"
            DATABASE_CONNECTION_ARGS = ()
            DATABASE_CONNECTION_KWARGS = {
                "dsn":"seamstress_exchange",
                "user":"seamstress_exchange",
                "password":"se125xch"
            }

# Should gettext be used?

USE_GETTEXT = 1
if USE_GETTEXT:

    # What are the args and kwargs to pass to gettext.translation?
    # Aquarium will take care of the "languages" argument.

    GETTEXT_ARGS = (
        "seamstress-exchange",
        os.path.join(os.getcwd(), "po")
    )
    GETTEXT_KWARGS = {}

# Will any output filters be used?  Since we buffer out content, you
# can use filters on the buffered content before sending it to the
# client.

USE_FILTERS = 0
if USE_FILTERS:

    # If so, please list the names of the filter modules here.  The
    # first filter in the list will be used first.

    FILTER_MODULES = []

# Should Aquarium automatically clear out modules of certain types on
# every page load if at least one of those modules is stale?  This
# makes sense during development with environments such as mod_python,
# but not in production or in environments such as CGI (actually, it's
# harmless for CGI).  The value may be either a boolean or a list of
# module types to automatically clear.
#
#     True -> ["aquarium.layout","aquarium.navigation",
#              "aquarium.screen", "aquarium.widget"]
#     False -> []
#
# CAUTION: modules of these types must *not* maintain any state, as it
# will be lost on every page load.

CLEAR_MODULES = True

# Should Aquarium compile Cheetah templates automatically?  If you
# decide to precompile templates, make sure Cheetah doesn't create a
# bunch of empty __init__.py files that override the __init__.py files
# used by Aquarium.  That will break packagePath and result in
# ImportErrors.

CHEETAH_COMPILE = 1
if CHEETAH_COMPILE:

    # If so, what is the name of the directory is should save the
    # compiled templates to?  If this is set to None, templates will be
    # compiled in the same directory they are found.  Remember that
    # this directory must be writeable by the Web server process.

    CHEETAH_COMPILE_DIRECTORY = os.path.join(os.getcwd(),
                                             "cheetah-cache")

# Output headers to disable browser caches?

USE_ANTI_CACHING_HEADERS = True

# You may define your default DTD here.

DEFAULT_DTD = (
    '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" ' +
    '"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'
)

# These are the defaults for the HTML head.

DEFAULT_TITLE = "Welcome to Seamstress Exchange!"
DEFAULT_META_TAGS = ""          # You may add more if you wish.

# These are the default attributes for the body tag (remember to keep
# in mind which attributes are allowed by the DTD defined above).

DEFAULT_BODY_ATTRIBUTES = {}    # You may add more if you wish.

# When the user first comes to the site, this is the screen he'll be
# transferred to.  This is the module name (i.e. use dots, not slashes)
# of the screen relative to the screen package.

DEFAULT_SCREEN = "message_list"

# On the exception screen, we'll output the email address of the Web
# master.  You may define that here if you are disatisfied with the
# default value.

WEBMASTER_EMAIL = "jjinux@users.sourceforge.net"

Generated by Epydoc 2.1 on Mon Jan 1 16:34:19 2007 http://epydoc.sf.net