[ZODB-Dev] Exception when using dead connections

Christian Reis kiko at async.com.br
Thu May 8 13:03:07 EDT 2003


On Thu, May 08, 2003 at 11:54:52AM -0300, Christian Reis wrote:
> I'd suggest doing something like this:
>     
>     if not self._storage:
>         raise ValueError, "Connection %s is not open!" % self
> 
>     if self._storage.is_closed():
>         raise ValueError, "Connection %s: storage was not open!" % self
> 
>     self._storage.tpc_begin(transaction)
> 
> in Connection.tpc_begin(). Now I'm not sure what could be used in place
> of is_closed(), but it would be a nice API to have on storages. I'm not
> sure if ValueError is correct either. What do the wizards say?

Another option would be having storage/db mark all their connections as
DEAD when close() is called on them. But I wonder if they store the
references to their connections in the first place.

Take care,
--
Christian Reis, Senior Engineer, Async Open Source, Brazil.
http://async.com.br/~kiko/ | [+55 16] 261 2331 | NMFL



More information about the ZODB-Dev mailing list