[Zope-Checkins] SVN: Zope/trunk/ Forward ported 'handle_errors' fix from 2.8 branch.

Tres Seaver tseaver at palladion.com
Sun Sep 25 04:44:20 EDT 2005


Log message for revision 38608:
  Forward ported 'handle_errors' fix from 2.8 branch.
  
  

Changed:
  U   Zope/trunk/doc/CHANGES.txt
  U   Zope/trunk/lib/python/Testing/ZopeTestCase/functional.py
  U   Zope/trunk/lib/python/Testing/ZopeTestCase/zopedoctest/functional.py
  U   Zope/trunk/lib/python/ZPublisher/Test.py

-=-
Modified: Zope/trunk/doc/CHANGES.txt
===================================================================
--- Zope/trunk/doc/CHANGES.txt	2005-09-25 08:27:56 UTC (rev 38607)
+++ Zope/trunk/doc/CHANGES.txt	2005-09-25 08:44:20 UTC (rev 38608)
@@ -42,6 +42,10 @@
 
     Bugs Fixed
 
+      - Repaired 'handle_errors' usage for doctests, along with the
+        supporting 'debug' argument passed to
+        'ZPublisher.Test.publish_module'.
+
       - Collector #1879: applied patch by Dieter Maurer to fix a bug in 
         ac_aquire() ignoring the default argument
 

Modified: Zope/trunk/lib/python/Testing/ZopeTestCase/functional.py
===================================================================
--- Zope/trunk/lib/python/Testing/ZopeTestCase/functional.py	2005-09-25 08:27:56 UTC (rev 38607)
+++ Zope/trunk/lib/python/Testing/ZopeTestCase/functional.py	2005-09-25 08:44:20 UTC (rev 38608)
@@ -33,7 +33,8 @@
 
     __implements__ = (interfaces.IFunctional,)
 
-    def publish(self, path, basic=None, env=None, extra=None, request_method='GET', stdin=None):
+    def publish(self, path, basic=None, env=None, extra=None,
+                request_method='GET', stdin=None, handle_errors=True):
         '''Publishes the object at 'path' returning a response object.'''
 
         from StringIO import StringIO
@@ -77,7 +78,13 @@
         outstream = StringIO()
         response = Response(stdout=outstream, stderr=sys.stderr)
 
-        publish_module('Zope2', response=response, stdin=stdin, environ=env, extra=extra)
+        publish_module('Zope2',
+                       response=response,
+                       stdin=stdin,
+                       environ=env,
+                       extra=extra,
+                       debug=not handle_errors,
+                      )
 
         # Restore security manager
         setSecurityManager(sm)

Modified: Zope/trunk/lib/python/Testing/ZopeTestCase/zopedoctest/functional.py
===================================================================
--- Zope/trunk/lib/python/Testing/ZopeTestCase/zopedoctest/functional.py	2005-09-25 08:27:56 UTC (rev 38607)
+++ Zope/trunk/lib/python/Testing/ZopeTestCase/zopedoctest/functional.py	2005-09-25 08:44:20 UTC (rev 38608)
@@ -12,7 +12,7 @@
 ##############################################################################
 """Support for (functional) doc tests
 
-$Id: functional.py,v 1.2 2005/03/26 18:07:08 shh42 Exp $
+$Id$
 """
 
 import sys, re, base64
@@ -174,9 +174,12 @@
     outstream = StringIO()
     response = Response(stdout=outstream, stderr=sys.stderr)
 
-    publish_module('Zope2', stdin=instream,
+    publish_module('Zope2',
                    response=response,
-                   environ=env)
+                   stdin=instream,
+                   environ=env,
+                   debug=not handle_errors,
+                  )
     header_output.setResponseStatus(response.getStatus(), response.errmsg)
     header_output.setResponseHeaders(response.headers)
 

Modified: Zope/trunk/lib/python/ZPublisher/Test.py
===================================================================
--- Zope/trunk/lib/python/ZPublisher/Test.py	2005-09-25 08:27:56 UTC (rev 38607)
+++ Zope/trunk/lib/python/ZPublisher/Test.py	2005-09-25 08:44:20 UTC (rev 38608)
@@ -199,6 +199,8 @@
             else: must_die=sys.exc_info()
             response.exception(1, v)
         except:
+            if debug:
+                raise
             response.exception()
             status=response.getStatus()
         if response:



More information about the Zope-Checkins mailing list