[ZODB-Dev] Inconsistent use of ConflictError

Greg Ward gward@mems-exchange.org
Fri, 17 Aug 2001 12:09:55 -0400


On 17 August 2001, Jeremy Hylton said:
> but I'm a little concerned about backwards compatibility.  What
> happens if we change this in Zope, and someone tries to use a
> third-party storage with the old calling conventions?

But there *was* no old calling convention -- remember the list of 6
different ways of raising ConflictError that I found under
StandaloneZODB alone?

> Do you think it
> will break?  The worst that can happen, I suspect, is that the
> ConflictError instance could be initialized incorrectly.

As I already said to Chris,
   raise ConflictError, `oid`

is still perfectly valid and legal -- you're creating a ConflictError
instance with 'message' set to (eg.) '\0\0\0\0\0\xfd\x43\x02'.  The
str() of that object will then be '\0\0\0\0\0\xfd\x43\x02'.  This is
the same behaviour as you now get when you
   raise ConflictError, `oid`

except you can't get the OID by
   except ConflictError, err:
     oid = eval(err.args[0])

...but that's unreliable anyways, because of the 6 different ways in
which ConflictError is currently raised.

> Since no old
> code could use the new interface, this might be a fairly limited
> problem.  Anything else?

Can't think of anything.  Does anyone know just how many third-party
storages there are out there?  Are they listed anywhere?  Are their
authors on this list?

        Greg
-- 
Greg Ward - software developer                gward@mems-exchange.org
MEMS Exchange                            http://www.mems-exchange.org