Commit 850009c3 authored by Andreas Jung's avatar Andreas Jung

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. 
parent c179e2ef
...@@ -54,6 +54,10 @@ Zope Changes ...@@ -54,6 +54,10 @@ Zope Changes
Features added 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 - Testing.ZopeTestCase: Introduced a "ZopeLite" test layer, making it
possible to mix ZTC and non-ZTC tests much more freely. possible to mix ZTC and non-ZTC tests much more freely.
......
...@@ -30,6 +30,9 @@ except ImportError: ...@@ -30,6 +30,9 @@ except ImportError:
import ZConfig import ZConfig
from ZConfig.components.logger import loghandler from ZConfig.components.logger import loghandler
from zope.event import notify
from zope.app import appsetup
logger = logging.getLogger("Zope") logger = logging.getLogger("Zope")
started = False started = False
...@@ -85,6 +88,10 @@ class ZopeStarter: ...@@ -85,6 +88,10 @@ class ZopeStarter:
def setConfiguration(self, cfg): def setConfiguration(self, cfg):
self.cfg = cfg self.cfg = cfg
def sendEvents(self):
notify(appsetup.interfaces.ProcessStarting())
def prepare(self): def prepare(self):
self.setupInitialLogging() self.setupInitialLogging()
self.setupLocale() self.setupLocale()
...@@ -108,8 +115,10 @@ class ZopeStarter: ...@@ -108,8 +115,10 @@ class ZopeStarter:
# emit a "ready" message in order to prevent the kinds of emails # emit a "ready" message in order to prevent the kinds of emails
# to the Zope maillist in which people claim that Zope has "frozen" # to the Zope maillist in which people claim that Zope has "frozen"
# after it has emitted ZServer messages. # after it has emitted ZServer messages.
logger.info('Ready to handle requests') logger.info('Ready to handle requests')
self.setupFinalLogging() self.setupFinalLogging()
self.sendEvents()
def run(self): def run(self):
# the mainloop. # the mainloop.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment