How do I ignore the errors thrown by the DB api?
bignose+hates-spam at benfinney.id.au
Wed Jun 14 04:30:04 CEST 2006
"fyleow" <fyleow at gmail.com> writes:
> It would be great if I could just insert values into the DB and let
> the uniqueness check at the DB level to either add or refuse the
> duplicate value.
The Pythonic way to do this is find out what exception is generated by
the event you want to handle, and handle that exception.
record_stuff = build_new_record()
except FailedToInsert, e:
Define each of those functions, name the actual exception class, and
\ "A lot of people are afraid of heights. Not me, I'm afraid of |
`\ widths." -- Steven Wright |
More information about the Python-list