[Zope-Checkins] CVS: Zope/lib/python/ZPublisher - HTTPResponse.py:1.60 Publish.py:1.156

Brian Lloyd brian@zope.com
Mon, 15 Apr 2002 16:58:28 -0400


Update of /cvs-repository/Zope/lib/python/ZPublisher
In directory cvs.zope.org:/tmp/cvs-serv7288

Modified Files:
	HTTPResponse.py Publish.py 
Log Message:
Fixed hotfix issues


=== Zope/lib/python/ZPublisher/HTTPResponse.py 1.59 => 1.60 ===
         
         return self.__class__(stdout=self.stdout, stderr=self.stderr)
-    
+
+    _shutdown_flag = None
+    def _requestShutdown(self, exitCode=0):
+        """Request that the server shut down with exitCode after fulfilling
+           the current request."""
+        sys.ZServerExitCode = exitCode
+        self._shutdown_flag = 1
+
+    def _shutdownRequested(self):
+        """Returns true if this request requested a server shutdown."""
+        return self._shutdown_flag is not None
+
     def setStatus(self, status, reason=None):
         '''\
         Sets the HTTP status code of the response; the argument may


=== Zope/lib/python/ZPublisher/Publish.py 1.155 => 1.156 ===
 
     if must_die:
+        # Try to turn exception value into an exit code.
+        try:
+            if hasattr(must_die[1], 'code'):
+                code = must_die[1].code
+            else: code = int(must_die[1])
+        except:
+            code = must_die[1] and 1 or 0
+        if hasattr(request.response, '_requestShutdown'):
+            request.response._requestShutdown(code)
+
         try: raise must_die[0], must_die[1], must_die[2]
         finally: must_die=None