[Zope] exception handling for zclient

Aleksander Salwa ololo@zeus.polsl.gliwice.pl
Tue, 16 Jan 2001 23:09:27 +0100 (CET)


On Tue, 16 Jan 2001, wade naveja wrote:

> i'm using zclient as outlined in
> http://www.zope.org/Members/lstaffor/ZClientMethod to serve pages from
> another web server as if they were being served form my zope server.
> 
> how would i write an exception to handle the case of the other web server
> being down?  when the other web server is down, i'd like to include a bit
> of text saying "this service is temporarily unavailable.  blah, blah,
> blah...".
> 
> 
> from ZPublisher import Client
> 
> def web_client(url = 'http://www.server.com/', username = None,
> password = None, **kw):
>         '''access http server'''
>         if kw:
>                 return Client.call(url,username,password,kw)[1]
>         else:
>                 return Client.call(url,username,password)[1]


try:
	return Client.call .....
except:
	return 'this service is temporarily unavailable. \
		blah, blah, blah...'


ololo@zeus.polsl.gliwice.pl, oleks@helper.pl

/--------------------------------------\
| `long long long' is too long for GCC |
\--------------------------------------/