Commit c09326c5 authored by Brian Lloyd's avatar Brian Lloyd

Fixed hotfix issues

parent e6c61f04
......@@ -12,8 +12,8 @@
##############################################################################
'''CGI Response Output formatter
$Id: HTTPResponse.py,v 1.59 2002/04/12 17:27:44 andreasjung Exp $'''
__version__='$Revision: 1.59 $'[11:-2]
$Id: HTTPResponse.py,v 1.60 2002/04/15 20:58:28 Brian Exp $'''
__version__='$Revision: 1.60 $'[11:-2]
import types, os, sys, re
from string import translate, maketrans
......@@ -157,7 +157,18 @@ class HTTPResponse(BaseResponse):
# think that that's all that is ever passed.
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
......
......@@ -12,8 +12,8 @@
##############################################################################
__doc__="""Python Object Publisher -- Publish Python objects on web servers
$Id: Publish.py,v 1.155 2002/01/02 15:56:04 andreasjung Exp $"""
__version__='$Revision: 1.155 $'[11:-2]
$Id: Publish.py,v 1.156 2002/04/15 20:58:28 Brian Exp $"""
__version__='$Revision: 1.156 $'[11:-2]
import sys, os
from Response import Response
......@@ -175,6 +175,16 @@ def publish_module(module_name,
if request is not None: request.close()
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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment