[Subversion] / PEAK / src / peak / peak.ini  

View of /PEAK/src/peak/peak.ini

Parent Directory | Revision Log
Revision: 1830 - (download)
Thu Oct 7 22:51:38 2004 UTC (19 years, 6 months ago) by pje
File size: 20302 byte(s)
Port all of PEAK's internal and example apps from IRerunnableCGI to
IWSGIApplication, and add a new 'WSGI' command wrapper that lets you run
non-PEAK WSGI applications in PEAK's containers.  For the time being, we're
keeping IRerunnableCGI around, however, because it's a more natural
interface for the CGI/FastCGI containers to use.  See CHANGES.txt for more
details on these issues.  Also, fixed an issue with templates outputting
Unicode instead of ASCII (which is all they really support at the moment.)
[peak.config.iniFile.sectionParsers]

# This section defines how special '[section name]' sections will be parsed.
# If a section name contains inner spaces, it is looked up here by lowercasing
# it, and converting contiguous whitespace to '.'.  The returned object or
# function must implement config.ISettingParser.  This essentially makes .ini
# syntax extensible, at least with regard to how the contents of name=value
# pairs are interpreted.  Later in the file, we'll see uses of each of the
# following section headers.

load.settings.from   = "peak.config.ini_files.do_include"
import.on.demand     = "peak.config.ini_files.import_on_demand"
component.factories  = "peak.config.ini_files.register_factory"
named.services       = "peak.config.ini_files.add_services"
load.on.demand       = "peak.config.ini_files.load_on_demand"


[peak.config.loaders]

# This section defines the types of data that can be used in
# "[Load Settings From]" sections.  Each entry is either the loading function
# to be used, or an import string specifying the loading function.  Loading
# functions must conform to the 'config.ISettingLoader' interface.

file    = "peak.config.ini_files:loadConfigFile"
files   = "peak.config.ini_files:loadConfigFiles"
mapping = "peak.config.ini_files:loadMapping"














[Load on Demand]

# Settings in load-on-demand sections are evaluated once and *only* once,
# when a property under their namespace isn't found.  The code is expected to
# load property settings into the supplied 'propertyMap', and return the value
# for property 'propertyName', if found.  It's safe to simply return NOT_FOUND,
# in which case the configuration machinery will check to see if a new rule was
# loaded for the desired property.
#
# Again, note that the code is only run *once*, *ever*.  It doesn't get a
# 'targetObj' because it's intended to load rules that will be used in place of
# itself thereafter.  So load-on-demand sections are only useful for loading
# other rules, within a prescribed property namespace.

peak.running.cluster.* =

    importString('peak.running.clusters:loadCluster')(
        propertyMap,
        config.lookup(
            propertyMap, '__main__.CLUSTER', default=None
        ),
        ruleName, propertyName,
    )


















[Import on Demand]

# Import-on-demand sections let you define shortcut names for modules that will
# then be automatically imported when a configuration rule uses the shortcut.

# For example, the following rule defines 'web_templates' as a shortcut for
# importing 'peak.web.templates'.  From that point on (in this file and any
# files included into this one), using 'web_templates' in an expression will
# refer to the "lazy import" of the 'peak.web.templates' module.  The module
# will not actually be imported until an expression using it is *executed*,
# which may not happen if the expression isn't needed by the running app.

web_templates = "peak.web.templates"
os = "os"
sys = "sys"
cursfmts = "peak.storage.cursor_formatters"
run_sched = "peak.running.scheduler"
twisted_support = "peak.events.twisted_support"
io_events = "peak.events.io_events"
ddt = "peak.ddt.api"
ddt_demos = "peak.ddt.demos"

# Shortcuts defined in a file are carried over to files that are loaded from
# within the file.  But the reverse is not true: included files cannot define
# shortcuts that affect the including file.  This keeps you from having to
# trace every included file to find out where a definition is coming from.















[peak.web]

# Default services  and options for 'peak.web' applications

appLog         = naming.LinkRef('logger:peak.web.app')
defaultMethod  = 'index_html'
resourcePrefix = '++resources++'

# Configuration file to load for "root" resource directories
resourceDefaultsIni = config.fileNearModule('peak.web','resource_defaults.ini')

# Local configuration file in *each* resource directory, if present
resourceConfigFile  = 'resources.ini'

# Factory to use for package resource directories
packageResourceFactory = importString("peak.web.resources:ResourceDirectory")

# The default request classes used for each HTTP variant
HTTPRequest    = importString('peak.web.requests.HTTPRequest')
BrowserRequest = importString('peak.web.requests.BrowserRequest')
XMLRPCRequest  = importString('peak.web.requests.XMLRPCRequest')


[peak.web.resource_packages]

# Property names with true values under this namespace indicate packages that
# are safe to publish resources from, e.g.:

peak.web = True
peak.ddt = True

# allow any data files in any peak.ddt or peak.web package to be downloadable.
# Be careful what you define here.








[peak.web.DOMlets]

# "built-in" DOMlet classes for peak.web; you can add your own per-app

text   = web_templates.Text
xml    = web_templates.XML

list   = web_templates.List
url.*  = web_templates.URLTag

notag      = web_templates.TaglessElement
text.notag = web_templates.TaglessText
xml.notag  = web_templates.TaglessXML


[peak.web.layers]
default = web.DefaultLayer()

[peak.web.skins]
default = web.Skin(layerNames=['default'])

[peak.web.namespaces]
# These control what namespaces can be used in the '++ns++name' format for
# URL path components in peak.web

resources = web.traverseResource
view      = web.traverseView
skin      = web.traverseSkin
item      = web.traverseItem
attr      = web.traverseAttr











[peak.naming]

initialContextFactory = "peak.naming.contexts:EmptyContext"
creationParent  = None
schemeParser    = None


[peak.naming.factories]

# peak.naming.factories control how objects referenced by 'naming.Reference()'
# objects or 'ref:kind@place' URLs are loaded.  By default, any property name
# under peak.naming.factories returns itself, minus the peak.naming.factories
# prefix.  In other words, the 'kind' part of a reference is mapped to an
# import string by default.

* = ruleSuffix


# References to 'zconfig.schema' objects are loaded using a SchemaLoader
# instance.

zconfig.schema = importString(
        "peak.config.load_zconfig:SchemaLoader"
    )(targetObj)

















[peak.naming.schemes]

# This section defines naming context factories or URL.Base subclasses to
# be used for various URL schemes.  The entry name is the URL scheme, and
# the value is either the object or an import string for loading it.

import  = "peak.naming.factories.peak_imports:importContext"
smtp    = "peak.naming.factories.smtp:smtpURL"
uuid    = "peak.naming.factories.uuid:uuidURL"
nis     = "peak.naming.factories.nisns:nisURLContext"
config  = "peak.naming.factories.config_ctx:PropertyContext"

ldap    = "peak.storage.LDAP:ldapURL"
sybase  = "peak.storage.SQL:GenericSQL_URL"
pgsql   = "peak.storage.SQL:GenericSQL_URL"
psycopg = "peak.storage.SQL:GenericSQL_URL"
mockdb  = "peak.storage.SQL:GenericSQL_URL"
gadfly  = "peak.storage.SQL:GadflyURL"
sqlite  = "peak.storage.SQL:SqliteURL"
cxoracle = "peak.storage.SQL:OracleURL"
dcoracle2 = "peak.storage.SQL:OracleURL"

logfile = "peak.running.logs:logfileURL"
logging.logger = "peak.running.logs:peakLoggerContext"
logger = "peak.running.logs:peakLoggerContext"
timer = "peak.running.timers:TimerContext"

lockfile     = "peak.running.lockfiles:lockfileURL"
nulllockfile = "peak.running.lockfiles:lockfileURL"
shlockfile   = "peak.running.lockfiles:lockfileURL"
flockfile    = "peak.running.lockfiles:lockfileURL"
winflockfile = "peak.running.lockfiles:lockfileURL"
win32.dde    = "peak.storage.DDE:ddeURL"

http    = "peak.naming.factories.openable:OpenableURL"
ftp     = "peak.naming.factories.openable:OpenableURL"
https   = "peak.naming.factories.openable:OpenableURL"
file    = "peak.naming.factories.openable:FileURL"
pkgfile = "peak.naming.factories.openable:PkgFileURL"
fd.file   = "peak.naming.factories.openable.fdURL"

icb       = "peak.net.icb:ICB_URL"
tcp       = "peak.net.sockets.tcpudpURL"
udp       = "peak.net.sockets.tcpudpURL"
unix      = "peak.net.sockets.unixURL"
unix.dg   = "peak.net.sockets.unixURL"
fd.socket = "peak.net.sockets.fdURL"

zconfig.schema = "peak.config.load_zconfig:ZConfigSchemaContext"
shellcmd       = "peak.naming.factories.shellcmd:ShellCommandCtx"

ref  = "peak.naming.factories.references:refURL"






























[peak.cursor.formatters]

horiz	= cursfmts.cursorToHoriz
vert	= cursfmts.cursorToVert
plain	= cursfmts.cursorToPlain
repr	= cursfmts.cursorToRepr
ldif	= cursfmts.cursorToLDIF
copy	= cursfmts.cursorToCopy
csv	= cursfmts.cursorToCSV
csv.*	= lambda rs=ruleSuffix,*a,**kw: cursfmts.cursorToCSV(dialect=rs,*a,**kw)
html	= cursfmts.cursorToHTML
ddt	    = cursfmts.cursorToDDT

# defaults

sql	= cursfmts.cursorToHoriz
ldap	= cursfmts.cursorToLDIF

# Data type conversion for database drivers

[Sybase.sql_types]
* = config.Namespace('peak.sql_types')

[pgdb.sql_types]
* = config.Namespace('peak.sql_types')

[sqlite.sql_types]
* = config.Namespace('peak.sql_types')

[gadfly.sql_types]
* = config.Namespace('peak.sql_types')

[cx_Oracle.sql_types]
* = config.Namespace('peak.sql_types')

[DCOracle2.sql_types]
* = config.Namespace('peak.sql_types')




[peak.metamodels.mof1.3.writers]

# Functions that can generate objects or code from MOF models

peak.model  = "peak.model.mof2py:MOFGenerator.externalize"
outline     = "peak.model.mof2py:MOFOutline.externalize"
fileset     = "peak.model.mof2py:MOFFileSet.externalize"


[peak.xmi.metamodels]

# Metamodels to be used when loading XMI files - if you discover a usage
# of one of these "in the wild" that doesn't match up on the left hand side
# here, please let us know.

UML.1.3               = importString('peak.metamodels:UML13')
UML.1.4               = importString('peak.metamodels.UML14:UML')
Model.1.3             = importString('peak.metamodels:MOF131')
org.omg.mof.Model.1.3 = importString('peak.metamodels:MOF131')
peak.tests.MailModel  = importString('peak.storage.tests:xmi')





















[peak.running]

# Defaults for command-line apps
argv    = sys.argv
stdin   = sys.stdin
stdout  = sys.stdout
stderr  = sys.stderr
environ = os.environ

# Stop the main loop when any of these signals occur
mainLoop.stopOnSignals = 'SIGINT', 'SIGTERM', 'SIGBREAK'

# This setting only affects the 'UntwistedReactor'
reactor.checkInterval =
    sys.platform=='win32' and 0.125 or 3600
    # if no scheduled tasks, do 1 select/hour (or 1/8 second on Windows)

timers.cpu     = importString('time.clock')
timers.elapsed =
    importString(
        # On Windows, 'clock' measures elapsed time w/more precision
        sys.platform=='win32' and 'time.clock' or 'time.time'
    )


















[peak.running.shortcuts]

# Shortcut names for 'peak' bootstrap script - supplied values must
# implement the 'running.IExecutable' interface; see the interface docs
# for details.

# 'runIni' launches an interpreter that expects a file formatted like this
# one, with an 'IExecutable' in its 'peak.running.app' property.
runIni = commands.IniInterpreter

# 'CGI' runs its next argument by looking it up and adapting it to an
# IRerunnableCGI; shortcut names may be used.
CGI = commands.CGIInterpreter

# 'ZConfig' loads its next command line argument (a URL or filename) as a
# ZConfig schema, that then loads the next command line argument as a ZConfig
# data file that follows the specified schema.
ZConfig = commands.ZConfigInterpreter

# 'EventDriven' runs a 'running.commands.EventDriven' application, configured
# via a ZConfig file using the 'peak.runnning/EventDriven.xml' schema.  This
# only supports PEAK built-in task types, so if you add your own task types
# you'll need to create a new schema and have it extend EventDriven.xml.
EventDriven =
    naming.LinkRef('zconfig.schema:pkgfile:peak.running/EventDriven.xml')

# These are just cute emulations of '/bin/true' and '/bin/false';
# of course they're *much* slower than the real ones!
true = lambda: 0
false = lambda: 1

# Run peak's unit tests
test = commands.TestRunner

# PEAK's Namespace Navigator
n2 = importString('peak.tools.n2.main:N2')

# PEAK API help
help = importString('peak.tools.api_help:APIHelp')


# 'supervise' multiprocess manager
supervise =
    naming.LinkRef(
        'zconfig.schema:pkgfile:peak.tools/supervisor/Supervisor.xml'
    )

# 'FastCGI' port listener
FastCGI = importString('peak.tools.supervisor.fastcgi:FCGITemplateCommand')

# 'WSGI' application wrapper for non-PEAK WSGI apps
WSGI = commands.WSGIInterpreter

# PEAK versioning tool

version-config =
    commands.Alias(
        targetObj,
        command = [
            'runIni',
            config.fileNearModule('peak.tools.version','version.ini')
        ]
    )


# 'ddt' document-driven testing

ddt = importString('peak.ddt.runners:HTMLRunner')
ddt.view = commands.Alias(
    command=['launch','import:peak.ddt.runners:ViewRunner']
 )
ddt.web = commands.Alias(
    command=['launch','import:peak.ddt.web_runner:PublishedDirectory']
 )
ddt.cgi = commands.Alias(
    command=['CGI','import:peak.ddt.web_runner:PublishedDirectory']
 )

# 'serve' (local webserver) and 'launch' (local webserver w/browser launch)
serve = importString('peak.tools.local_server.Serve')
launch = importString('peak.tools.local_server.Launch')

[Component Factories]

# "Component Factories" sections define utilities by mapping from an import
# string for an interface (or other configuration key), to an expression
# that returns the factory (or an import string thereof).

# Factories described here are not actually registered with the configuration
# map until the module named on the left side of the '=' is first imported.  If
# the module is already imported when a "Component Factories" section is
# processed, then registration takes place immediately.

# Keys listed here are registered twice, like this:
#   key = importString(key)
#   pMap.registerProvider(config.FactoryFor(key), config.ruleForExpr(value))
#   pMap.registerProvider(key, config.CreateViaFactory(key))

# This means that looking up a key listed here will use a 'CreateViaFactory'
# rule to invoke the factory once and return that result for all subsequent
# lookups.  Looking up 'config.FactoryFor(key)' will return the factory listed
# here on the right side of the '=' sign.  Thus, using 'binding.Make(key)' will
# create a private instance of the desired component, and 'binding.Obtain(key)'
# will retrieve a shared instance.

# Note, by the way, that the items named on the left of the '=' do not have to
# be interfaces, although that is the most common usage.  They may be any
# object that supports 'config.IConfigKey'.

peak.running.timers.ITimerService   = 'peak.running.timers.TimerService'
peak.running.timers.ITimer          = 'peak.running.timers.Timer'

peak.web.interfaces.IAuthService    = web.NullAuthenticationService

peak.storage.interfaces.ITransactionService =
    'peak.storage.transactions.TransactionService'

peak.security.interfaces.IInteraction = security.Interaction





peak.running.interfaces.ITaskQueue      = 'peak.running.daemons.TaskQueue'

peak.running.interfaces.IMainLoop       = run_sched.MainLoop

peak.events.interfaces.ISignalSource = io_events.SignalEvents

peak.events.interfaces.IEventLoop    =
    events.ifTwisted(targetObj,twisted_support,io_events).EventLoop

peak.events.interfaces.ISelector     =
    events.ifTwisted(targetObj,twisted_support,io_events).Selector

peak.events.interfaces.IScheduler    =
    events.ifTwisted(targetObj,twisted_support,events).Scheduler


peak.running.interfaces.IBasicReactor   =
    events.ifTwisted(targetObj,twisted_support,run_sched).Reactor

peak.running.interfaces.ITwistedReactor =
    # Force Twisted to be used, or else get an error
    events.makeTwisted(targetObj) and twisted_support.getTwisted

peak.ddt.interfaces.IDocumentProcessor =
    importString('peak.ddt.processors:DocumentProcessor')
















[Named Services]

# Named services are similar to component factories, except that the
# name to the left of the '=' sign is treated as a property name, rather than
# as an import specification, and the expression on the right is used to create
# the service, instead of specifying a *factory* for the service.  Registration
# happens immediately, although the service itself will not be created until
# the first time it's looked up in a given service area.

# Named services should be used when you want a property to have one and only
# one instance per service area, or when there are multiple services that
# implement the same interface, and therefore must be "asked for by name".

# Currently, PEAK does not supply any named services itself, although the
# 'ddt.SQLChecker()' component expects to find and use a named service called
# 'peak.ddt.testDB' by default.

























[peak.logs]

# Routing for peak-supplied log messages - default is to log WARNING or
# higher to 'sys.stderr'

* = logs.LogStream(stream=sys.stderr, levelName='WARNING')


[peak.logging.levels]

# Log level names.  Use '?' on the end of names that should not be used when
# converting a level number to a level name.

TRACE    = 0
ALL?     = 0
DEBUG    = 10
INFO     = 20
NOTICE   = 25
WARNING  = 30
ERROR    = 40
CRITICAL = 50
ALERT    = 60
EMERG    = 70


[Component Factories]

peak.running.logs.ILogEvent         = logs.Event
peak.running.logs.ILoggingService   = logs.DefaultLoggingService












[peak.ddt.processors]

# Default and demo configuration for DDT

* = ddt.AbstractProcessor()     # default is to ignore unrecognized table types

Actions = ddt.ActionChecker()   # 'Actions' creates an ActionChecker
Summary = ddt.Summary()         # 'Summary' creates a summary

Contents.of.Table.* = ddt.SQLChecker(testTable = ruleSuffix)
Contents.of.table.* = ddt.SQLChecker(testTable = ruleSuffix)

ArithmeticFixture = ddt_demos.ArithmeticDemo()

ArithmeticColumnFixture = ddt.ModelChecker(

    targetClass = ddt_demos.ArithmeticModel,

    columnSuffixes = [('()','get'), ('','set')],

    typeInfo = Items(
        plus=model.Integer, minus=model.Integer,
        times=model.Long,   divide=model.Float,
    )

 )

Function.* = ddt.FunctionChecker(testFunction=importString(ruleSuffix))


# The 'fit.c2.com' examples and test documents sometimes use 'eg' or 'fit'
# as a prefix to table types, so map those into the default namespace.

eg.* = config.Namespace('peak.ddt.processors')
fit.* = config.Namespace('peak.ddt.processors')


[peak.ddt.models]
* = importString(ruleSuffix)()


[__main__]
# The '__main__' namespace will be used by PEAK for global settings that
# can be set either in the application's main startup script (i.e. the
# Python '__main__' module) or the environment.  The following rule
# sets up a fallback from the '__main__' namespace to the 'environ'
# namespace, so that anything not supplied by the startup script will
# be supplied by the environment.

* = config.Namespace('environ.*')

[Load Settings From]
# "Load Settings From" sections are processed in-line to load settings from
# other sources.  'file=' entries act like "include" operations, loading
# configuration files in the same format.  'mapping=' entries load Python
# mapping objects.  The first argument is the filename or mapping object,
# respectively, and the second argument, if present, is a prefix to be used
# on property names found in the specified mapping or file.
#
# Note that "Load Settings From" sections are executed at the point where they
# appear in the file, and a snapshot of the data source is taken at that time.
# If a data source (file, mapping, etc.) changes later, it will have no effect
# on the settings that were already loaded, although you can always load the
# settings again (assuming none of them have been used yet).
#
# In this section of peak.ini, we initialize the 'environ.*' namespace from
# Python's 'os.environ' mapping, and the '__main__.*' namespace from the
# '__main__' (startup) module's dictionary.  Finally, we load the configuration
# file(s) specified by '__main__.PEAK_CONFIG', which allows a script to simply
# set PEAK_CONFIG to specify its main configuration file, or if not set, it
# will fall back to the PEAK_CONFIG environment variable.

mapping = os.environ, 'environ.*'
mapping = importString('__main__').__dict__, '__main__.*'

files   =
    config.lookup(
        propertyMap, '__main__.PEAK_CONFIG', default=''
    ).split(os.pathsep)




cvs-admin@eby-sarna.com

Powered by ViewCVS 1.0-dev

ViewCVS and CVS Help