[Zope] acquisition-based class initialization on Zope startup

Mitchell L Model mlm@acm.org
Thu, 1 Nov 2001 07:50:28 -0500


[original question asked, accompanied by a long story, how to perform 
acquisition-based actions when Zope starts up, in my case to 
initialize properties in my product classes based on Zope Python 
Scripts and data in DTML methods]

>Stick a call at the end of z2.py after Zope has loaded.
>

Excellent!  Radical!! Obvious!!!

Wonder if I would have ever thought of that, and if I had, whether I 
would have thought it too crude....  Come to think of it, maybe z2.py 
should import an initially empty init.p (or site-init.py or 
zope-init.py or startup.py or whatever, in the root Zope directory 
where z2.py lives) to establish a clear hook for startup actions. 
Yes, people can edit z2.py, but do they realize that?  Do they even 
realize z2.py exists?  Do they assume z2.py is full of black magic 
and they shouldn't touch it?  Do they realize that z2.py *is* the 
startup script?  And you don't want to have to re-edit z2.py with 
every new release -- much easier just to copy over your 
initialization file for the new release; actually, that suggests that 
the init file should *not* be in the Zope root, but rather in 
INSTANCE_HOME (if using that scheme) so that you wouldn't have to do 
anything to move to a new version of Zope.  [This isn't really big 
enough for a fishbowl propsoal is it?  It would be great if someone 
from ZC would just say "Done."....]