# pairs are interpreted. Later in the file, we'll see uses of each of the |
# pairs are interpreted. Later in the file, we'll see uses of each of the |
# following section headers. |
# following section headers. |
|
|
load.settings.from = "peak.config.config_components.do_include" |
load.settings.from = "peak.config.ini_files.do_include" |
provide.utilities = "peak.config.config_components.provide_utility" |
import.on.demand = "peak.config.ini_files.import_on_demand" |
load.on.demand = "peak.config.config_components.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" |
|
|
|
# "Provide Utilities" is DEPRECATED |
|
provide.utilities = "peak.config.ini_files.provide_utility" |
|
|
|
|
[peak.config.loaders] |
[peak.config.loaders] |
# to be used, or an import string specifying the loading function. Loading |
# to be used, or an import string specifying the loading function. Loading |
# functions must conform to the 'config.ISettingLoader' interface. |
# functions must conform to the 'config.ISettingLoader' interface. |
|
|
file = "peak.config.config_components:loadConfigFile" |
file = "peak.config.ini_files:loadConfigFile" |
files = "peak.config.config_components:loadConfigFiles" |
files = "peak.config.ini_files:loadConfigFiles" |
mapping = "peak.config.config_components:loadMapping" |
mapping = "peak.config.ini_files:loadMapping" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
importString('peak.running.clusters:loadCluster')( |
importString('peak.running.clusters:loadCluster')( |
propertyMap, |
propertyMap, |
config.getProperty(propertyMap, '__main__.CLUSTER', default=None), |
config.lookup( |
|
propertyMap, '__main__.CLUSTER', default=None |
|
), |
ruleName, propertyName, |
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] |
[peak.web] |
|
|
# Default services, protocols, and options for 'peak.web' applications |
# Default services, protocols, and options for 'peak.web' applications |
|
|
appLog = naming.lookup(targetObj, 'logging.logger:web.app') |
appLog = naming.LinkRef('logger:peak.web.app') |
defaultMethod = 'index_html' |
defaultMethod = 'index_html' |
resourcePrefix = '++resources++' |
resourcePrefix = '++resources++' |
|
|
pageProtocol = web.IWebPage |
pageProtocol = web.IWebPage |
errorProtocol = web.IWebException |
errorProtocol = web.IWebException |
|
|
authenticationService = web.NullAuthenticationService |
|
interactionClass = web.Interaction |
|
skinService = web.NullSkinService() |
|
|
|
# Configuration file to load for "root" resource directories |
# Configuration file to load for "root" resource directories |
resourceDefaultsIni = config.fileNearModule('peak.web','resource_defaults.ini') |
resourceDefaultsIni = config.fileNearModule('peak.web','resource_defaults.ini') |
|
|
# would allow any data files in any peak.* package to be downloadable. Be |
# would allow any data files in any peak.* package to be downloadable. Be |
# careful what you define here. |
# careful what you define here. |
|
|
|
|
|
|
|
|
|
|
[peak.web.DOMlets] |
[peak.web.DOMlets] |
|
|
# "built-in" DOMlet classes for peak.web; you can add your own per-app |
# "built-in" DOMlet classes for peak.web; you can add your own per-app |
|
|
text = importString('peak.web.templates.Text') |
text = web_templates.Text |
list = importString('peak.web.templates.List') |
xml = web_templates.XML |
url.* = importString('peak.web.templates.URLTag') |
|
|
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.naming] |
[peak.naming] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[peak.naming.schemes] |
[peak.naming.schemes] |
|
|
# This section defines naming context factories or URL.Base subclasses to |
# This section defines naming context factories or URL.Base subclasses to |
|
|
logfile = "peak.running.logs:logfileURL" |
logfile = "peak.running.logs:logfileURL" |
logging.logger = "peak.running.logs:peakLoggerContext" |
logging.logger = "peak.running.logs:peakLoggerContext" |
|
logger = "peak.running.logs:peakLoggerContext" |
|
timer = "peak.running.timers:TimerContext" |
|
|
lockfile = "peak.running.lockfiles:lockfileURL" |
lockfile = "peak.running.lockfiles:lockfileURL" |
nulllockfile = "peak.running.lockfiles:lockfileURL" |
nulllockfile = "peak.running.lockfiles:lockfileURL" |
https = "peak.naming.factories.openable:OpenableURL" |
https = "peak.naming.factories.openable:OpenableURL" |
file = "peak.naming.factories.openable:FileURL" |
file = "peak.naming.factories.openable:FileURL" |
pkgfile = "peak.naming.factories.openable:PkgFileURL" |
pkgfile = "peak.naming.factories.openable:PkgFileURL" |
icb = "peak.net.icb:ICB_URL" |
fd.file = "peak.naming.factories.openable.fdURL" |
|
|
|
|
|
|
|
icb = "peak.net.icb:ICB_URL" |
tcp = "peak.net.sockets.tcpudpURL" |
tcp = "peak.net.sockets.tcpudpURL" |
udp = "peak.net.sockets.tcpudpURL" |
udp = "peak.net.sockets.tcpudpURL" |
unix = "peak.net.sockets.unixURL" |
unix = "peak.net.sockets.unixURL" |
unix.dg = "peak.net.sockets.unixURL" |
unix.dg = "peak.net.sockets.unixURL" |
fd = "peak.net.sockets.fdURL" |
fd.socket = "peak.net.sockets.fdURL" |
|
|
zconfig.schema = "peak.config.load_zconfig:ZConfigSchemaContext" |
zconfig.schema = "peak.config.load_zconfig:ZConfigSchemaContext" |
shellcmd = "peak.naming.factories.shellcmd:ShellCommandCtx" |
shellcmd = "peak.naming.factories.shellcmd:ShellCommandCtx" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[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 |
|
|
|
# defaults |
|
|
|
sql = cursfmts.cursorToHoriz |
|
ldap = cursfmts.cursorToLDIF |
|
|
# Data type conversion for database drivers |
# Data type conversion for database drivers |
|
|
[Sybase.sql_types] |
[Sybase.sql_types] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[peak.metamodels.mof1.3.writers] |
[peak.metamodels.mof1.3.writers] |
|
|
# Functions that can generate objects or code from MOF models |
# Functions that can generate objects or code from MOF models |
fileset = "peak.model.mof2py:MOFFileSet.externalize" |
fileset = "peak.model.mof2py:MOFFileSet.externalize" |
|
|
|
|
|
|
[peak.xmi.metamodels] |
[peak.xmi.metamodels] |
|
|
# Metamodels to be used when loading XMI files - if you discover a usage |
# Metamodels to be used when loading XMI files - if you discover a usage |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[peak.running] |
[peak.running] |
|
|
# peak.running.mainLoop.signalHandler is used while the standard MainLoop runs |
# Defaults for command-line apps |
mainLoop.signalHandler = |
argv = sys.argv |
importString('peak.running.scheduler:StopOnStandardSignals')(targetObj) |
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' |
# This setting only affects the 'UntwistedReactor' |
reactor.checkInterval = 3600 # if no scheduled tasks, do 1 select/hour |
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' |
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 'runIni' launches an interpreter that expects a file formatted like this |
# 'runIni' launches an interpreter that expects a file formatted like this |
# one, with an 'IExecutable' in its 'peak.running.app' property. |
# one, with an 'IExecutable' in its 'peak.running.app' property. |
runIni = importString('peak.running.commands:IniInterpreter') |
runIni = commands.IniInterpreter |
|
|
# 'CGI' runs its next argument by looking it up and adapting it to an |
# 'CGI' runs its next argument by looking it up and adapting it to an |
# IRerunnableCGI; shortcut names may be used. |
# IRerunnableCGI; shortcut names may be used. |
CGI = importString('peak.running.commands:CGIInterpreter') |
CGI = commands.CGIInterpreter |
|
|
# 'ZConfig' loads its next command line argument (a URL or filename) as a |
# '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 |
# ZConfig schema, that then loads the next command line argument as a ZConfig |
# data file that follows the specified schema. |
# data file that follows the specified schema. |
ZConfig = importString('peak.running.commands:ZConfigInterpreter') |
ZConfig = commands.ZConfigInterpreter |
|
|
# 'EventDriven' runs a 'running.commands.EventDriven' application, configured |
# 'EventDriven' runs a 'running.commands.EventDriven' application, configured |
# via a ZConfig file using the 'peak.runnning/EventDriven.xml' schema. This |
# via a ZConfig file using the 'peak.runnning/EventDriven.xml' schema. This |
false = lambda: 1 |
false = lambda: 1 |
|
|
# Run peak's unit tests |
# Run peak's unit tests |
test = importString('peak.running.commands:TestRunner') |
test = commands.TestRunner |
|
|
# PEAK's Namespace Navigator |
# PEAK's Namespace Navigator |
n2 = importString('peak.running.tools.n2.main:N2') |
n2 = importString('peak.tools.n2.main:N2') |
|
|
|
|
|
|
|
# PEAK API help |
|
help = importString('peak.tools.api_help:APIHelp') |
|
|
|
|
# 'supervise' multiprocess manager |
# 'supervise' multiprocess manager |
supervise = |
supervise = |
naming.LinkRef('zconfig.schema:pkgfile:peak.running/Supervisor.xml') |
naming.LinkRef( |
|
'zconfig.schema:pkgfile:peak.tools/supervisor/Supervisor.xml' |
|
) |
|
|
# 'FastCGI' port listener |
# 'FastCGI' port listener |
FastCGI = importString('peak.running.supervisor:FCGITemplateCommand') |
FastCGI = importString('peak.tools.supervisor.fastcgi:FCGITemplateCommand') |
|
|
|
|
# PEAK versioning tool |
# PEAK versioning tool |
|
|
version-config = |
version-config = |
importString('peak.running.commands:Alias')( |
commands.Alias( |
targetObj, |
targetObj, |
command = [ |
command = [ |
'runIni', |
'runIni', |
config.fileNearModule('peak.running.tools.version','version.ini') |
config.fileNearModule('peak.tools.version','version.ini') |
] |
] |
) |
) |
|
|
|
|
|
# 'ddt' document-driven testing |
|
|
[peak.logs] |
ddt = importString('peak.ddt.runners:HTMLRunner') |
|
ddt.web = commands.Alias(command=['launch','import:peak.ddt.runners:WebRunner']) |
|
|
# Routing for peak-supplied log messages - default is to log WARNING or |
# 'serve' (local webserver) and 'launch' (local webserver w/browser launch) |
# higher to 'sys.stderr' |
serve = importString('peak.tools.local_server.Serve') |
|
launch = importString('peak.tools.local_server.Launch') |
|
|
* = logs.LogStream(stream=importString('sys.stderr'), level=logs.WARNING) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[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)) |
|
|
[Provide Utilities] |
# 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. |
|
|
# "Provide Utilities" sections define utilities by mapping from an import |
# Note, by the way, that the items named on the left of the '=' do not have to |
# string for an interface, to an expression defining the Provider. |
# be interfaces, although that is the most common usage. They may be any |
# |
# object that supports 'config.IConfigKey'. |
# Note that unlike property sections, code in "Provide utilities" sections is |
|
# executed immediately to create a provider rule, not on-demand when the |
peak.running.timers.ITimerService = 'peak.running.timers.TimerService' |
# utility is actually requested, so you should avoid code that does unnecessary |
peak.running.timers.ITimer = 'peak.running.timers.Timer' |
# importing. You'll notice that most providers shown here do their imports |
|
# inside of lambdas within config.provideInstance() or |
peak.web.interfaces.IAuthService = web.NullAuthenticationService |
# config.instancePerComponent() calls. |
peak.web.interfaces.IWebInteraction = web.Interaction |
|
peak.web.interfaces.ISkinService = web.SkinService |
# This first provider associates a default transaction service with the |
peak.web.interfaces.ILayerService = web.LayerService |
# nearest AppConfig above the object that the service is wanted for. It |
|
# creates a TransactionService instance with that config as its parent |
|
# component. |
|
|
|
peak.storage.interfaces.ITransactionService = |
peak.storage.interfaces.ITransactionService = |
config.provideInstance('peak.storage.transactions.TransactionService') |
'peak.storage.transactions.TransactionService' |
|
|
|
|
|
|
# Some similar services for peak.running: |
|
|
|
peak.running.interfaces.ISignalManager = |
peak.running.interfaces.ITaskQueue = 'peak.running.daemons.TaskQueue' |
config.provideInstance('peak.running.process.SignalManager') |
peak.running.interfaces.ISignalManager = 'peak.running.process.SignalManager' |
|
peak.running.interfaces.IMainLoop = run_sched.MainLoop |
|
|
peak.running.interfaces.IMainLoop = |
peak.events.interfaces.ISignalSource = io_events.SignalEvents |
config.provideInstance('peak.running.scheduler.MainLoop') |
|
|
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.ITaskQueue = |
|
config.provideInstance('peak.running.daemons.TaskQueue') |
|
|
|
peak.running.interfaces.IBasicReactor = |
peak.running.interfaces.IBasicReactor = |
config.provideInstance('peak.running.scheduler.getReactor') |
events.ifTwisted(targetObj,twisted_support,run_sched).Reactor |
|
|
peak.running.interfaces.ITwistedReactor = |
peak.running.interfaces.ITwistedReactor = |
config.provideInstance('peak.running.scheduler.getTwisted') |
# 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(tableName = ruleSuffix) |
|
|
|
ArithmeticFixture = ddt_demos.ArithmeticDemo() |
|
|
|
ArithmeticColumnFixture = ddt.ModelChecker( |
|
|
|
targetClass = ddt_demos.ArithmeticModel, |
|
|
|
columnSuffixes = [('()','get'), ('','set')], |
|
|
|
methodTypes = Items( |
|
plus=model.Integer, minus=model.Integer, |
|
times=model.Long, divide=model.Float, |
|
) |
|
|
|
) |
|
|
|
|
|
# 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)() |
|
|
|
|
|
|
|
|
|
|
# set PEAK_CONFIG to specify its main configuration file, or if not set, it |
# set PEAK_CONFIG to specify its main configuration file, or if not set, it |
# will fall back to the PEAK_CONFIG environment variable. |
# will fall back to the PEAK_CONFIG environment variable. |
|
|
mapping = importString('os.environ'), 'environ.*' |
mapping = os.environ, 'environ.*' |
mapping = importString('__main__').__dict__, '__main__.*' |
mapping = importString('__main__').__dict__, '__main__.*' |
|
|
files = |
files = |
config.getProperty( |
config.lookup( |
propertyMap, '__main__.PEAK_CONFIG', default='' |
propertyMap, '__main__.PEAK_CONFIG', default='' |
).split(importString('os.pathsep')) |
).split(os.pathsep) |
|
|
|
|
|
|