Re: A list of open points in the documentation

Tres Seaver <[email protected]> Wed, 10 Feb 2010 12:03:05 -0500
Newsgroups gmane.comp.python.db.psycopg.devel
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Federico Di Gregorio wrote:
> On 10/02/2010 05:38, Daniele Varrazzo wrote:

>> 3. DBAPI says that scroll() should raise IndexError. Psycopg raises
>> ProgrammingError instead. I'd say this is a bug, but maybe it's too
>> late to be fixed. Shall we keep it this way? Shall I point out the
>> discrepancy between dbapi and psycopg in the docs or keep it quiet?
> 
> This is surely a bug but I fear to break a lot of stuff out there fixing
> it. We should probably add a "strict dbapi" flag that if enabled makes
> psycopg to do the right thing. Currently I'd just document the discrepancy.

Wouldn't a backward-compatible fix raise an error which derives from
both IndexError and ProgrammingError?  I.e.:

  class ScrollError(IndexError, ProgrammingError):
      pass

Any user code which expects to catch ProgrammingError would still work,
as well as code which expected the DBAPI-mandated IndexError.


Tres.
- --
===================================================================
Tres Seaver          +1 540-429-0999          [email protected]
Palladion Software   "Excellence by Design"    http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkty5skACgkQ+gerLs4ltQ4AQgCgrc4vN8ZfsyTZJOOJbE0Y1I53
i0YAoKDCFGKUfup0WHrIzsViLRgQCAVv
=sAg7
-----END PGP SIGNATURE-----