hooking autoreload

1 view
Skip to first unread message

Jeff Hinrichs - DM&T

unread,
Dec 9, 2006, 11:26:03 AM12/9/06
to TurboGears
Can I hook a callback in to cherrypy like tg does in the startup.py?

if startFoo not in cherrypy.server.on_start_server_list:
cherrypy.server.on_start_server_list.append(startFoo)

if stopFoo not in cherrypy.server.on_stop_server_list:
cherrypy.server.on_stop_server_list.append(stopFoo)

If I can, I was thinking of putting the hooks in the
start-ProjectName.py file just after
start_server(Root())

??

I am building a reporting/monitoring mechanism and I'll be heavily
modifying scheduler.py, so I want to move a copy into my project and
refer to it as projectname.scheduler instead. Now I'm trying to
figure out how to mimic the tg code that handles autoreload.

thanks,

--
Jeff

dundeemt

unread,
Dec 9, 2006, 3:17:59 PM12/9/06
to TurboGears
Answering my own question for completeness:

Searching returned this message:
http://groups.google.com/group/turbogears/browse_thread/thread/e7fe18aadf6979da/bd5e928755a45f67?lnk=gst&q=controllers+package%0D%0Acontrollers+package&rnum=15#bd5e928755a45f67

Specifically,
"* The turbogears.startup now contains call_on_startup and
call_on_shutdown lists. You can append callables to these to have them
executed at the right time. "

So, the lists turbogears.startup.call_on_startup and
turbogears.startup.call_on_shutdown are your friends.

-Jeff

Reply all
Reply to author
Forward
0 new messages