Re: Uh-oh! Driver-specific exceptions are not abstracted....

Matthew Bogosian <[email protected]> Tue, 16 Aug 2005 08:26:34 -0700
Newsgroups gmane.comp.web.skunkweb
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

So, just to clarify, one would do something like this:

	db = pydo.dbi.getConnection('alias_name')
	globals.update(db.exceptions)

That way, one could then do something like:

	try:
		MyTableClass.new(...)
	except IntegrityError:
		...

Is that right?

That does seem much easier to implement for PyDO (I apologize for my 
ignorance of the standard DB API exceptions), but please don't feel 
like you need to hastily pollute your objects' namespaces for my 
request (unless you believe the additions are the appropriate ones).

	-- Matt


On Aug 16, 2005, at 07:47, Jacob Smullyan wrote:

> On Mon, Aug 15, 2005 at 11:25:23PM -0400, Jacob Smullyan wrote:
>> At the moment, getDriverMod wouldn't be as straightforward as one
>> might like; you need to get pydo.dbi._aliases[alias]['driver'] and
>> then map it to the correct module.  I'll add code so that it isn't
>> necessary to do anything so demeaning, but I'm not sure yet whether it
>> should be a separate function, a dbi method, or a "dbapi_module"
>> attribute of the dbi class/instance (which currently just has a
>> reference to the connect function).
>
> I've just checked in changes that add to the dbi object two new
> attributes: "dbapiModule" and "exceptions".  You can guess what the
> former is; the latter is a dictionary mapping class names to the
> corresponding exception classes in the dbapi module.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (Darwin)

iD8DBQFDAgWrnLpDzL5I7l8RAmz9AJ0cTy0iE/kZcuDWgSna/IPC+34scQCeOPdE
lfwatkMpXX5Ld2+c10TbH64=
=nAw9
-----END PGP SIGNATURE-----



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf