[Zope3-checkins] CVS: Zope3/src/zope/publisher - publish.py:1.4

Barry Warsaw barry@wooz.org
Thu, 2 Jan 2003 11:56:52 -0500


Update of /cvs-repository/Zope3/src/zope/publisher
In directory cvs.zope.org:/tmp/cvs-serv13619

Modified Files:
	publish.py 
Log Message:
Code cleanup, use booleans where appropriate, bump copyright years.


=== Zope3/src/zope/publisher/publish.py 1.3 => 1.4 ===
--- Zope3/src/zope/publisher/publish.py:1.3	Fri Dec 27 11:40:25 2002
+++ Zope3/src/zope/publisher/publish.py	Thu Jan  2 11:56:49 2003
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# Copyright (c) 2001, 2002, 2003 Zope Corporation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,
@@ -11,16 +11,15 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
-"""
-Python Object Publisher -- Publish Python objects on web servers
+"""Python Object Publisher -- Publish Python objects on web servers
 
 Provide an apply-like facility that works with any mapping object
 
 $Id$
 """
 
-
-import sys, os
+import os
+import sys
 from zope.publisher.interfaces import Retry
 from zope.proxy.introspection import removeAllProxies
 
@@ -28,13 +27,12 @@
 
 
 def unwrapMethod(object):
-    """ object -> ( unwrapped, wrapperCount )
+    """object -> (unwrapped, wrapperCount)
 
-        Unwrap 'object' until we get to a real function, counting the
-        number of unwrappings.
+    Unwrap 'object' until we get to a real function, counting the number of
+    unwrappings.
 
-        Bail if we find a class or something we can't
-        idendify as callable.
+    Bail if we find a class or something we can't identify as callable.
     """
     wrapperCount = 0
     unwrapped = object
@@ -66,6 +64,7 @@
 
     return unwrapped, wrapperCount
 
+
 def mapply(object, positional=(), request={}):
     __traceback_info__ = object
 
@@ -113,10 +112,11 @@
     args = tuple(args)
     return object(*args)
 
-def publish(request, handle_errors=1):
+
+def publish(request, handle_errors=True):
     try: # finally to clean up to_raise and close request
         to_raise = None
-        while 1:
+        while True:
             publication = request.publication
             try:
                 try:
@@ -137,7 +137,8 @@
                         publication.afterCall(request)
 
                     except:
-                        publication.handleException(object, request, sys.exc_info(), 1)
+                        publication.handleException(
+                            object, request, sys.exc_info(), True)
 
                         if not handle_errors:
                             raise
@@ -154,7 +155,8 @@
                         # Output the original exception.
                         publication = request.publication
                         publication.handleException(
-                            object, request, retryException.getOriginalException(), 0)
+                            object, request,
+                            retryException.getOriginalException(), False)
                         break
                     else:
                         raise