[ZODB-Dev] Exception when using dead connections
Christian Reis
kiko at async.com.br
Thu May 8 13:39:49 EDT 2003
On Thu, May 08, 2003 at 04:06:09PM +0100, Toby Dickenson wrote:
> On Thursday 08 May 2003 3:54 pm, Christian Reis wrote:
>
> > I'd suggest doing something like this:
> >
> > if not self._storage:
> > raise ValueError, "Connection %s is not open!" % self
>
> Yes, something like that.
>
> > if self._storage.is_closed():
> > raise ValueError, "Connection %s: storage was not open!" % self
>
> Only the DB is supposed to call the close method on the storage, so Im not
> sure we need to defend against this case seperately. (Im not keen on this
> detail of the DB/storage interface, but I think we have already discussed
> this)
Even so, db.close() closes the storage and the same error appears. We
need a way to guard against committing a transaction on a connection to
a closed db *and* storage -- both are interchangeable there.
Is ValueError the correct exception?
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