[Checkins] SVN: zope.app.wsgi/branches/3.9.3zc/ - Fixed: zope.app.wsgi.paste.ZopeApplication didn't emit

Jim Fulton jim at zope.com
Wed Jan 18 22:49:50 UTC 2012


Log message for revision 124082:
  - Fixed: zope.app.wsgi.paste.ZopeApplication didn't emit
    ProcessStarting events.
  

Changed:
  U   zope.app.wsgi/branches/3.9.3zc/CHANGES.txt
  U   zope.app.wsgi/branches/3.9.3zc/setup.py
  U   zope.app.wsgi/branches/3.9.3zc/src/zope/app/wsgi/paste.py
  U   zope.app.wsgi/branches/3.9.3zc/src/zope/app/wsgi/tests.py

-=-
Modified: zope.app.wsgi/branches/3.9.3zc/CHANGES.txt
===================================================================
--- zope.app.wsgi/branches/3.9.3zc/CHANGES.txt	2012-01-18 22:32:53 UTC (rev 124081)
+++ zope.app.wsgi/branches/3.9.3zc/CHANGES.txt	2012-01-18 22:49:50 UTC (rev 124082)
@@ -3,6 +3,12 @@
 =======
 
 
+3.9.3zc2 (2012-01-18)
+---------------------
+
+- Fixed: zope.app.wsgi.paste.ZopeApplication didn't emit
+  ProcessStarting events.
+
 3.9.3zc1 (2012-01-14)
 ---------------------
 

Modified: zope.app.wsgi/branches/3.9.3zc/setup.py
===================================================================
--- zope.app.wsgi/branches/3.9.3zc/setup.py	2012-01-18 22:32:53 UTC (rev 124081)
+++ zope.app.wsgi/branches/3.9.3zc/setup.py	2012-01-18 22:49:50 UTC (rev 124082)
@@ -72,6 +72,7 @@
           'zope.container',
           'zope.error',
           'zope.lifecycleevent',
+          'zope.processlifetime',
           'zope.session',
           'zope.site',
           'zope.testbrowser',

Modified: zope.app.wsgi/branches/3.9.3zc/src/zope/app/wsgi/paste.py
===================================================================
--- zope.app.wsgi/branches/3.9.3zc/src/zope/app/wsgi/paste.py	2012-01-18 22:32:53 UTC (rev 124081)
+++ zope.app.wsgi/branches/3.9.3zc/src/zope/app/wsgi/paste.py	2012-01-18 22:49:50 UTC (rev 124082)
@@ -16,6 +16,8 @@
 $Id$
 """
 from zope.app.wsgi import getWSGIApplication
+import zope.event
+import zope.processlifetime
 
 def asbool(obj):
     if isinstance(obj, basestring):
@@ -28,4 +30,6 @@
 
 def ZopeApplication(global_config, config_file, handle_errors=True, **options):
     handle_errors = asbool(handle_errors)
-    return getWSGIApplication(config_file, handle_errors=handle_errors)
+    app = getWSGIApplication(config_file, handle_errors=handle_errors)
+    zope.event.notify(zope.processlifetime.ProcessStarting())
+    return app

Modified: zope.app.wsgi/branches/3.9.3zc/src/zope/app/wsgi/tests.py
===================================================================
--- zope.app.wsgi/branches/3.9.3zc/src/zope/app/wsgi/tests.py	2012-01-18 22:32:53 UTC (rev 124081)
+++ zope.app.wsgi/branches/3.9.3zc/src/zope/app/wsgi/tests.py	2012-01-18 22:49:50 UTC (rev 124082)
@@ -97,15 +97,52 @@
     ...     'test-file-view.html',
     ...     )
 
-
 """
 
+def creating_app_w_paste_emits_ProcessStarting_event():
+    """
+    >>> import zope.event
+    >>> events = []
+    >>> subscriber = events.append
+    >>> zope.event.subscribers.append(subscriber)
+
+    >>> import os, tempfile
+    >>> temp_dir = tempfile.mkdtemp()
+    >>> sitezcml = os.path.join(temp_dir, 'site.zcml')
+    >>> open(sitezcml, 'w').write('<configure />')
+    >>> zopeconf = os.path.join(temp_dir, 'zope.conf')
+    >>> open(zopeconf, 'w').write('''
+    ... site-definition %s
+    ...
+    ... <zodb>
+    ...   <mappingstorage />
+    ... </zodb>
+    ...
+    ... <eventlog>
+    ...   <logfile>
+    ...     path STDOUT
+    ...   </logfile>
+    ... </eventlog>
+    ... ''' % sitezcml)
+
+    >>> import zope.app.wsgi.paste, zope.processlifetime
+    >>> app = zope.app.wsgi.paste.ZopeApplication(
+    ...     {}, zopeconf, handle_errors=False)
+
+    >>> len([e for e in events
+    ...     if isinstance(e, zope.processlifetime.ProcessStarting)]) == 1
+    True
+
+    >>> zope.event.subscribers.remove(subscriber)
+    """
+
 def test_suite():
 
     checker = renormalizing.RENormalizing([
-        (re.compile(r"&lt;class 'zope.component.interfaces.ComponentLookupError'&gt;"),
-                    r'ComponentLookupError'),
-    ])
+        (re.compile(
+            r"&lt;class 'zope.component.interfaces.ComponentLookupError'&gt;"),
+         r'ComponentLookupError'),
+        ])
     functional_suite = doctest.DocTestSuite()
     functional_suite.layer = AppWSGILayer
 



More information about the checkins mailing list