Oleg Broytmann wrote:
> On Mon, Jan 09, 2006 at 09:28:10PM +0000, Helio MC Pereira wrote:
>
>> Have one more question :P Is there a way to raise something like
>>"Duplicate Key"? It gives me an exception to big :P
>
>
> There is no currently.
>
>
>>"""pysqlite2.dbapi2.OperationalError: columns grupo_id, utilizador_id are
>>not unique"""
>
>
> IWBN if someone develops a hierarchy of SQL-related exceptions, and
> people start collecting information on how to map DB API driver's
> exceptions to SQLObject's exceptions.
> But that's a big job...
Yeah, those exceptions are rather fuzzy -- DB-API defines some
exceptions and general meanings, but what actual database drivers raise
varies widely. Also, a simpler feature for SQLObject would be a fixing
up of the hierarchy, so that all OperationalErrors subclassed
sqlobject.OperationalError (ditto for the rest of the exceptions). You
can do this like:
import pysqlite.dbapi2 as dbapi
dbapi.OperationalError.__bases__ = dbapi.OperationalError.__bases__ +
(sqlobject.OperationalError, )
--
Ian Bicking / ia...@co... / http://blog.ianbicking.org
|