[ZODB-Dev] Typechecking oid in getitem
Jeremy Hylton
jeremy at zope.com
Mon May 19 16:29:21 EDT 2003
On Mon, 2003-05-19 at 11:22, Christian Reis wrote:
> On Mon, May 19, 2003 at 10:59:28AM -0400, Jeremy Hylton wrote:
> > The type of an oid depends on the storage, so there is no guarantee that
> > it will be a string. In fact, ZODB4 storages will soon change to using
> > Python longs. APE uses tuples IIRC.
>
> Hmmm. So would the correct fix be to implement API so the storage can
> inform what type the OID should be? I could implement something like:
>
> storage.getOIDType()
>
> that returned a TypeObject. Are other storage authors against this
> change? It would make sanity checking easier AFAICT.
I'm not all that keen on adding safety belts to catch these errors. It
just doesn't seem Pythonic.
Do you know what you got a TypeError unsliceable object in the original
error report? Maybe it's possible to fix the storage so that it raises
a more useful error message.
Jeremy
More information about the ZODB-Dev
mailing list