[Zope-Checkins] SVN: Zope/trunk/ Zope2 startup: Zope will now send
a ProcessStarting event when it
Andreas Jung
andreas at andreas-jung.com
Wed Dec 26 04:51:11 EST 2007
Log message for revision 82446:
Zope2 startup: Zope will now send a ProcessStarting event when it
is ready to serve requests. You can subscribe to this event e.g.
for starting application-level threads.
Changed:
U Zope/trunk/doc/CHANGES.txt
U Zope/trunk/lib/python/Zope2/Startup/__init__.py
-=-
Modified: Zope/trunk/doc/CHANGES.txt
===================================================================
--- Zope/trunk/doc/CHANGES.txt 2007-12-25 22:07:38 UTC (rev 82445)
+++ Zope/trunk/doc/CHANGES.txt 2007-12-26 09:51:10 UTC (rev 82446)
@@ -78,6 +78,10 @@
Features added
+ - Zope2 startup: Zope will now send a ProcessStarting event when it
+ is ready to serve requests. You can subscribe to this event e.g.
+ for starting application-level threads.
+
- Testing.ZopeTestCase: Introduced a "ZopeLite" test layer, making it
possible to mix ZTC and non-ZTC tests much more freely.
Modified: Zope/trunk/lib/python/Zope2/Startup/__init__.py
===================================================================
--- Zope/trunk/lib/python/Zope2/Startup/__init__.py 2007-12-25 22:07:38 UTC (rev 82445)
+++ Zope/trunk/lib/python/Zope2/Startup/__init__.py 2007-12-26 09:51:10 UTC (rev 82446)
@@ -30,6 +30,9 @@
import ZConfig
from ZConfig.components.logger import loghandler
+from zope.event import notify
+from zope.app import appsetup
+
logger = logging.getLogger("Zope")
started = False
@@ -85,6 +88,10 @@
def setConfiguration(self, cfg):
self.cfg = cfg
+
+ def sendEvents(self):
+ notify(appsetup.interfaces.ProcessStarting())
+
def prepare(self):
self.setupInitialLogging()
self.setupLocale()
@@ -108,8 +115,10 @@
# emit a "ready" message in order to prevent the kinds of emails
# to the Zope maillist in which people claim that Zope has "frozen"
# after it has emitted ZServer messages.
+
logger.info('Ready to handle requests')
self.setupFinalLogging()
+ self.sendEvents()
def run(self):
# the mainloop.
More information about the Zope-Checkins
mailing list