[PEAK] EventDriven configuration questions
Phillip J. Eby
pje at telecommunity.com
Thu Jun 17 14:23:56 EDT 2004
At 11:02 AM 6/17/04 -0700, Dave Peticolas wrote:
>Is ZConfig a substitute for ini-style configuration
>in PEAK, or do they serve complementary purposes?
They're complementary. The difference is that .ini files configure the
environment that an application runs in, and can specify the root object of
an application. ZConfig files cannot define the application, but they can
assemble an application from components.
So, .ini files define the runtime environment, ZConfig files assemble
components. .ini files are primarily intended for use by developers *of*
the application, and to a limited extent for system administrators setting
up a corporate deployment environment. ZConfig files are primarily
intended for users of a configurable application. These are not fixed
boundaries, of course, but general principles.
>Can you start an EventDriven app using an ini file?
Yes. Just set the 'peak.running.app' property appropriately. This could
be done using a 'commands.Alias' or a 'naming.LinkRef' to run a separate
ZConfig file. Or, if you want to embed the configuration directly in the
.ini file, it could be as simple as:
app = EventDriven(
>How can you configure an EventDriven app to use the
Add a component that depends on ITwistedReactor, and does so upon assembly,
reactor = binding.Obtain(running.ITwistedReactor, uponAssembly=True)
If you add an instance of this component to your EventDriven app, it will
then use the Twisted reactor. Or, if you have an .ini file available, you
can do this:
isTwisted = True
More information about the PEAK