[Zope-Coders] New API for Zope configuration info
Fred L. Drake, Jr.
fred@zope.com
Tue, 11 Feb 2003 10:40:48 -0500
Andreas Jung writes:
> I assume it will use the new ZConfig packages. Is there some documentation
> available?
The configuration object will be initialized using information from
configuration files handled by ZConfig and from the command line.
ZConfig itself isn't directly related to this API.
I'm not sure what documentation you're looking for; ZConfig has some
reference documentation included with the package (look in the
ZConfig/doc/ directory). The documentation isn't yet complete, but
there's a lot there.
> What about backward compatibility (for all exisiting env vars?).
We somewhat torn about how to deal with environment variables. One
proposal has been to select the value of a field from the following
list of sources. Sources earlier in the list override later sources:
1. command line
2. configuration file
3. environment
4. intrinsic default
I'm not sure I agree with that; it would require changes in ZConfig so
that default values from a configuration schema don't override values
from the environment.
> What is the suggest way to use this feature in exisiting Zope
> products/modules?
We haven't formulated a specific approach, but something could easily
be built around a common Python idiom:
try:
from App.config import getConfiguration
except ImportError:
class _Config:
pass
def getConfiguration():
from App import FindHomes
cfg = _Config()
cfg.clienthome = FindHomes.CLIENT_HOME
cfg.instancehome = FindHomes.INSTANCE_HOME
cfg.softwarehome = FindHomes.SOFTWARE_HOME
cfg.zopehome = FindHomes.ZOPE_HOME
Note however that the "legacy" ways of getting this kind of
information will need to be maintained for a while anyway, so existing
packages (products, modules, whatever) don't need to be converted
right away or all at once. It's not at all clear (at this point) that
doing so makes a lot of sense.
-Fred
--
Fred L. Drake, Jr. <fred at zope.com>
PythonLabs at Zope Corporation