"fyleow" <[EMAIL PROTECTED]> 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() try: insert_record(record_stuff) except FailedToInsert, e: handle_insert_failure(e, record_stuff) Define each of those functions, name the actual exception class, and you're done. -- \ "A lot of people are afraid of heights. Not me, I'm afraid of | `\ widths." -- Steven Wright | _o__) | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list