[ZOOM] [Johannes.Leveling@fernuni-hagen.de: ZOOM questions]

Robert Sanderson azaroth at liverpool.ac.uk
Fri Feb 6 13:52:18 CET 2004

On Fri, 6 Feb 2004, Adam Dickmeiss wrote:
> Robert Sanderson wrote:

> >>2. After "forging" a connection, is the connection implicitly (automatically)
> >>re-established when it was lost?
> >I find myself writing and re-writing code that does this every time I use 

> I did too. Then made a terrible hack. Firstly make connect a method for 
> connection (So I can apply it multiple times). Then use connect whenever 
> It's OK to "reconnect".. If connection is OK, connect does nothing.. So 
> connect is just a "declaration" about what server, etc we're going to use.

Clever, I'll have to add that as it makes things much easier.

Here's the sort of code that I end up rewriting:

retries = 0
while (retries < 3):
    rs = c.search(q)
    retries = 3
  except zoom.ConnectionError, err:
    # This would just be c.connect() 
    c2 = zoom.Connection(c.host, c.port)
    c2.databaseName = c.databaseName
    c = c2
    retries += 1
    # break out, as something is really wrong, not just lost connection


      ,'/:.          Dr Robert Sanderson (azaroth at liverpool.ac.uk)
    ,'-/::::.        http://www.o-r-g.org/~azaroth/
  ,'--/::(@)::.      Special Collections and Archives, extension 3142
,'---/::::::::::.    Nebmedes:  http://nebmedes.o-r-g.org:8000/
I L L U M I N A T I  

More information about the ZOOM mailing list