SQLObject exception handling

10 views
Skip to first unread message

chach...@gmail.com

unread,
Aug 24, 2006, 10:36:42 PM8/24/06
to TurboGears
Hello guys. I have this question: When handling IntegrityError
exceptions (for example, when using the alternateID position
parameter), do I have to import this exception from psycopgp2 (I'm
using postgres as a database), or is it available somewhere in the
packages of SQLObject? (haven't found it yet).

Thanks, really nice work.

Jorge Godoy

unread,
Aug 24, 2006, 10:48:28 PM8/24/06
to turbo...@googlegroups.com
"chach...@gmail.com" <chach...@gmail.com> writes:

If you import it then you loose portability.

What you can do is get it from the driver... One way (I believe there's a
simpler one somewhere else around here, but I haven't found it) is:


================================================================================
driver = model.hub.getConnection()._dbConnection.module

try:
# ...
except driver.IntegrityError, error:
# ...
================================================================================


--
Jorge Godoy <jgo...@gmail.com>

Jesus Antonio Sanchez Antunez

unread,
Aug 24, 2006, 11:11:06 PM8/24/06
to turbo...@googlegroups.com
Thanks, :)
Reply all
Reply to author
Forward
0 new messages