exception handling for zclient
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]
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 | \--------------------------------------/
participants (2)
-
Aleksander Salwa -
wade naveja