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

Hannu Krosing hannu at tm.ee
Tue Apr 25 18:28:45 EDT 2000


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




More information about the PyGreSQL mailing list