Commit 48aa18b7 authored by 's avatar

Added logic to work with the pcgi-wrapper - bci.NotAvailable will be raised

by a RemoteMethod if the remote host is not reachable from a network problem
or if the request timed out at the other end.
parent a80e3a00
"""Bobo call interface""" """Bobo call interface"""
__version__='$Revision: 1.7 $'[11:-2] __version__='$Revision: 1.8 $'[11:-2]
import sys,regex import sys,regex
from httplib import HTTP from httplib import HTTP
...@@ -59,6 +59,7 @@ exceptmap ={'AccessError' :AccessError, ...@@ -59,6 +59,7 @@ exceptmap ={'AccessError' :AccessError,
'KeyError' :KeyError, 'KeyError' :KeyError,
'MemoryError' :MemoryError, 'MemoryError' :MemoryError,
'NameError' :NameError, 'NameError' :NameError,
'NotAvailable' :NotAvailable,
'NotFound' :NotFound, 'NotFound' :NotFound,
'OverflowError' :OverflowError, 'OverflowError' :OverflowError,
'RuntimeError' :RuntimeError, 'RuntimeError' :RuntimeError,
...@@ -161,9 +162,8 @@ class RemoteMethod: ...@@ -161,9 +162,8 @@ class RemoteMethod:
try: t=exceptmap[headers.dict['bobo-exception-type']] try: t=exceptmap[headers.dict['bobo-exception-type']]
except: except:
if ec >= 400 and ec < 500: t=NotFound if ec >= 400 and ec < 500: t=NotFound
elif ec >= 500 and ec < 600: t=ServerError elif ec == 503: t=NotAvailable
else: t=NotAvailable else: t=ServerError
raise t, RemoteException(t,v,f,l,self.url,query,ec,em,response) raise t, RemoteException(t,v,f,l,self.url,query,ec,em,response)
...@@ -253,6 +253,11 @@ if __name__ == "__main__": main() ...@@ -253,6 +253,11 @@ if __name__ == "__main__": main()
# #
# $Log: Client.py,v $ # $Log: Client.py,v $
# Revision 1.8 1997/04/29 16:23:27 brian
# Added logic to work with the pcgi-wrapper - bci.NotAvailable will be raised
# by a RemoteMethod if the remote host is not reachable from a network problem
# or if the request timed out at the other end.
#
# Revision 1.7 1997/04/18 19:45:47 jim # Revision 1.7 1997/04/18 19:45:47 jim
# Brian's changes to try and get file name and line no in exceptions. # Brian's changes to try and get file name and line no in exceptions.
# #
......
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