[Zope] How to execute code at startup?

Andreas Jung lists at zopyx.com
Tue Jun 12 10:59:58 EDT 2007



--On 12. Juni 2007 10:36:59 -0400 "Matthew X. Economou" 
<xenophon at irtnog.org> wrote:

> I have a very simple script that copies my production Zope instance to
> a fresh test instance.  I have some Python code that I need to execute
> when the test instance starts for the first time (it only needs to
> execute once, but it won't hurt Zope if it executes every time the
> test instance starts.  I usually execute this code interactively, from
> the Zope debugger:
>
> app.restrictedTraverse("/irtnog/portal_cache_settings").setCacheConfig
> ('zope')
>
> Is there any way to execute this code (or something similar)
> automatically?  I guess the alternative is that I could script the
> process of entering the Zope debugger and running the above using
> Expect or something.

Why don't you read the related configuration inside *your* code from
some configuration file or use a persistent configuration.

You can't perform such an operation during the startup phase of Zope.

-aj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 186 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope/attachments/20070612/9aef6ed8/attachment.bin


More information about the Zope mailing list