[Checkins] SVN: Zope/branches/do3cc_catchall/ Catching more errors

Patrick Gerken do3ccqrv at gmail.com
Wed Sep 1 06:42:07 EDT 2010


Log message for revision 116074:
  Catching more errors
  

Changed:
  A   Zope/branches/do3cc_catchall/
  U   Zope/branches/do3cc_catchall/lib/python/ZServer/PubCore/ZServerPublisher.py

-=-
Modified: Zope/branches/do3cc_catchall/lib/python/ZServer/PubCore/ZServerPublisher.py
===================================================================
--- Zope/branches/2.10/lib/python/ZServer/PubCore/ZServerPublisher.py	2010-09-01 00:33:13 UTC (rev 116070)
+++ Zope/branches/do3cc_catchall/lib/python/ZServer/PubCore/ZServerPublisher.py	2010-09-01 10:42:07 UTC (rev 116074)
@@ -11,28 +11,36 @@
 #
 ##############################################################################
 
+import logging
+
+LOG = logging.getLogger('ZServerPublisher')
+
 class ZServerPublisher:
     def __init__(self, accept):
+        from sys import exc_info
         from ZPublisher import publish_module
         from ZPublisher.WSGIPublisher import publish_module as publish_wsgi
         while 1:
-            name, a, b=accept()
-            if name == "Zope2":
-                try:
-                    publish_module(
-                        name,
-                        request=a,
-                        response=b)
-                finally:
-                    b._finish()
-                    a=b=None
+            try:
+                name, a, b=accept()
+                if name == "Zope2":
+                    try:
+                        publish_module(
+                            name,
+                            request=a,
+                            response=b)
+                    finally:
+                        b._finish()
+                        a=b=None
 
-            elif name == "Zope2WSGI":
-                try:
-                    res = publish_wsgi(a, b)
-                    for r in res:
-                        a['wsgi.output'].write(r)
-                finally:
-                    # TODO: Support keeping connections open.
-                    a['wsgi.output']._close = 1
-                    a['wsgi.output'].close()
+                elif name == "Zope2WSGI":
+                    try:
+                        res = publish_wsgi(a, b)
+                        for r in res:
+                            a['wsgi.output'].write(r)
+                    finally:
+                        # TODO: Support keeping connections open.
+                        a['wsgi.output']._close = 1
+                        a['wsgi.output'].close()
+            except:
+                LOG.error('exception caught', exc_info=True)



More information about the checkins mailing list