[TransWarp] runIni => ZConfig
Phillip J. Eby
pje at telecommunity.com
Fri Jul 11 18:21:41 EDT 2003
At 08:19 PM 7/11/03 +0300, alexander smishlajev wrote:
>one question remains, though. is there a way to override global
>configuration properties from ZConfig?
No. At least, not unless you define a key that maps to an attribute on an
object, that has an offerAs=[] for the property in question.
>for example, in .ini file we could write 'peak.logs.* = SomeLogStream()'
>and then a binding like 'bindToProperty("peak.logs.whatever")' would take
>that object.
>
>another example is registering interface providers like in '[Provide
>Utilities]' section of .ini file.
>
>is it possible to do this without creating an .ini file (or modifying
>system-wide peak.ini)? if yes, how it can be done?
In the component class, create a binding that offers the property. Define
a key for that attribute in the ZConfig schema. The value set for that
attribute will be used for that component and its children. (There was
some discussion of this technique on IRC in the last couple days, you might
check the logs.)
Another method you can use is to set up an .ini file that acts as an
interpreter for the ZConfig file, e.g.:
myApp.ini:
=========
#!invoke peak runIni
[peak.running]
app = naming.lookup(targetObj, 'zconfig.schema:theschema')
# whatever other config is needed
myApp.zcfg:
==========
#!invoke myApp.ini
# contents here...
This lets you get the best of both worlds.
More information about the PEAK
mailing list