[Zope-dev] poor mans solution to startup folder
Darrell Gallion
dgallion1@yahoo.com
Wed, 9 Jan 2002 16:13:46 -0800 (PST)
External methods aren't the best solution I know.
It wasn't obvious to me how to call python scripts at
this point. For that matter if this is a good point to
do this kind of thing. Or how to hook the startup
event with a product.
Added these lines to the bottom of initialize(app) in
application.py
# Ensure that a startup folder exists
if not hasattr(app, 'startup'):
from OFS import Folder
Folder.manage_addFolder(app, id='startup',
title='Startup')
get_transaction().note('Added startup folder')
get_transaction().commit()
# Call any external methods found in the startup
folder
# Only call external methods
startup = getattr(app, 'startup')
for obj in startup.objectIds():
obj=getattr(startup, obj)
if hasattr(obj,'__call__') and
obj.__class__.__name__=='ExternalMethod':
obj(app)
=====
Darrell Gallion
__________________________________________________
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/