Commit a838d256 authored by Jim Fulton's avatar Jim Fulton

Changes to make shutdown methods work properly. Now shutdown methods

can simply sys.exit(0).

Added on-line documentation and debugging support to bobo.
parent 6fe74245
......@@ -517,7 +517,7 @@ Publishing a module using the ILU Requestor (future)
o Configure the web server to call module_name@server_name with
the requestor.
$Id: Publish.py,v 1.19 1996/09/13 22:51:35 jim Exp $"""
$Id: Publish.py,v 1.20 1996/09/16 14:43:27 jim Exp $"""
#'
# Copyright
#
......@@ -570,6 +570,12 @@ $Id: Publish.py,v 1.19 1996/09/13 22:51:35 jim Exp $"""
# (540) 371-6909
#
# $Log: Publish.py,v $
# Revision 1.20 1996/09/16 14:43:27 jim
# Changes to make shutdown methods work properly. Now shutdown methods
# can simply sys.exit(0).
#
# Added on-line documentation and debugging support to bobo.
#
# Revision 1.19 1996/09/13 22:51:35 jim
# *** empty log message ***
#
......@@ -653,7 +659,7 @@ $Id: Publish.py,v 1.19 1996/09/13 22:51:35 jim Exp $"""
#
#
#
__version__='$Revision: 1.19 $'[11:-2]
__version__='$Revision: 1.20 $'[11:-2]
def main():
......@@ -1024,7 +1030,7 @@ class ModulePublisher:
return response
def call_object(self,object,args):
result=apply(object,args)
result=apply(object,args) # Type s<cr> to step into published object.
return result
def sad_pathetic_persistence_hack(object):
......@@ -1385,6 +1391,9 @@ def publish_module(module_name,
environ=environ)
response = publisher.response
response = publisher.publish(module_name,debug=debug)
except SystemExit:
must_die=1
response.exception(must_die)
except ImportError, v:
sys.exc_type, sys.exc_value, sys.exc_traceback = v
must_die=1
......
......@@ -3,7 +3,7 @@
__doc__='''CGI Response Output formatter
$Id: Response.py,v 1.10 1996/09/13 22:52:10 jim Exp $'''
$Id: Response.py,v 1.11 1996/09/16 14:43:25 jim Exp $'''
# Copyright
#
# Copyright 1996 Digital Creations, L.C., 910 Princess Anne
......@@ -55,6 +55,12 @@ $Id: Response.py,v 1.10 1996/09/13 22:52:10 jim Exp $'''
# (540) 371-6909
#
# $Log: Response.py,v $
# Revision 1.11 1996/09/16 14:43:25 jim
# Changes to make shutdown methods work properly. Now shutdown methods
# can simply sys.exit(0).
#
# Added on-line documentation and debugging support to bobo.
#
# Revision 1.10 1996/09/13 22:52:10 jim
# *** empty log message ***
#
......@@ -103,7 +109,7 @@ $Id: Response.py,v 1.10 1996/09/13 22:52:10 jim Exp $'''
#
#
#
__version__='$Revision: 1.10 $'[11:-2]
__version__='$Revision: 1.11 $'[11:-2]
import string, types, sys, regex, regsub
......@@ -454,6 +460,7 @@ class Response:
n = n+1
result.append(string.joinfields(
traceback.format_exception_only(etype, value), ' '))
sys.exc_type,sys.exc_value,sys.exc_traceback=etype,value,tb
return result
def _traceback(self,t,v,tb):
......@@ -487,10 +494,16 @@ class Response:
b=v
if fatal:
return self.setBody(
(str(t),
'Sorry, a SERIOUS APPLICATION ERROR occurred.<p>'
+ self._traceback(t,v,tb)))
if t is SystemExit and v==0:
return self.setBody(
(str(t),
'This application has exited normally.<p>'
+ self._traceback(t,v,tb)))
else:
return self.setBody(
(str(t),
'Sorry, a SERIOUS APPLICATION ERROR occurred.<p>'
+ self._traceback(t,v,tb)))
if type(b) is not types.StringType or regex.search('[ \t\n]',b) < 0:
return self.setBody(
......
......@@ -9,10 +9,42 @@ Usage:
Options:
-u username=password
-u username:password
Supply HTTP authorization information
$Id: Test.py,v 1.1 1996/09/13 22:51:52 jim Exp $'''
-p profiler_data_file
Run under profiler control, generating the profiler
data file, profiler_data_file.
-d
Run in debug mode. With this option, bobo will run
under Python debugger control. Two useful breakpoints
are set. The first is at the beginning of the module
publishing code. Steping through this code shows how
bobo finds objects and obtains certain meta-data. The
second breakpoint is at the point just before the published
object is called. To jump to the second breakpoint, you must
enter 's' followed by a carriage return to step into the
module, then enter a 'c' followed by a carriage return to
jump to the first breakpoint and then another 'c' followed by
a carriage return to jump to the point where the object is
called. Finally, enter 's' followed a carriage return.
For example, to debug a published object (such as a method)
spam the following might be entered::
bobo -d /prj/lib/python/mymod container/spam
s
c
c
s
$Id: Test.py,v 1.2 1996/09/16 14:43:26 jim Exp $
'''
# Copyright
#
# Copyright 1996 Digital Creations, L.C., 910 Princess Anne
......@@ -64,12 +96,18 @@ $Id: Test.py,v 1.1 1996/09/13 22:51:52 jim Exp $'''
# (540) 371-6909
#
# $Log: Test.py,v $
# Revision 1.2 1996/09/16 14:43:26 jim
# Changes to make shutdown methods work properly. Now shutdown methods
# can simply sys.exit(0).
#
# Added on-line documentation and debugging support to bobo.
#
# Revision 1.1 1996/09/13 22:51:52 jim
# *** empty log message ***
#
#
#
__version__='$Revision: 1.1 $'[11:-2]
__version__='$Revision: 1.2 $'[11:-2]
#! /usr/local/bin/python
......@@ -85,7 +123,7 @@ def main():
try:
optlist,args=getopt.getopt(sys.argv[1:], 'du:p:')
if len(args) > 2: raise TypeError, None
if len(args) > 2 or len(args) < 1: raise TypeError, None
if len(args) == 2: path_info=args[1]
except:
sys.stderr.write(__doc__)
......@@ -178,12 +216,12 @@ def publish(script,path_info,u=None,p=None,d=None):
code=ModulePublisher.call_object.im_func.func_code
lineno = codehack.getlineno(code)
filename = code.co_filename
db.set_break(filename,lineno)
db.set_break(filename,lineno+1)
db.prompt='pdb> '
# db.set_continue()
print '''Type "s<cr>c<cr>" to jump to beginning of real
publishing process. Then type c<ret> to jub to
publishing process. Then type c<ret> to jump to
published object call.'''
db.run('publish_module(file,environ=env,debug=1)',
cgi_module_publisher.__dict__,
......
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