[ZODB-Dev] Typechecking oid in getitem

Barry Warsaw barry at zope.com
Mon May 19 19:54:37 EDT 2003


On Mon, 2003-05-19 at 12:59, Jeremy Hylton wrote:

> Good point.  The only reason for POSKeyError is to make the exception
> look nicer when it gets printed in a traceback.  So there's no point in
> converting a TypeError to POSKeyError.  It does make sense to raise
> TypeErro, "invalid oid: %r" % oid

Or, 

from zodb.interfaces import _format_oid as fo
raise TypeError, 'invalid oid: %s' % fo(oid)

:)
-Barry





More information about the ZODB-Dev mailing list