[Zope] PyGres DB Connection in Zope drops when many Usersare added(UserDB)

Hannu Krosing hannu@tm.ee
Tue, 25 Apr 2000 17:28:45 +0300


Stephan Richter wrote:
> 
> <snip original message, suggested code>
> 
> >It does not find or solve the original problem, but at least it revives it
> >automatically
> 
> What does your code do? Will it automatically "reset" the connection and
> work again?

Yes.

try:
    try:
        ob=self.sqlUserQuery(username=name)
    except:
        # first get the PyGreSQL connection object
        conn = getattr(self,self.conn_id)
        # then "reset" it
        conn.connect(conn.connection_string)
        # and retry the query
        ob=self.sqlUserQuery(username=name)
except:
    # failing after reset means a more serius problem (like bad query)
    return None


-----------
Hannu