Can anyone enlighten me as to the TurboGears technique for trapping the
attempt to create an object where an attribute specified as an
alternateID is a duplicate?

I can do this in the TG shell:

try:
    f = MyClass( name='Binky')
except hub.getConnection().module.IntegrityError, e:
    errMsg = e[1]

but when I take this into my controller, I can no longer catch the
exception.  TG catches it in the function run_with_transaction() in
database.py, calls rollback_all(), then re-raises the exception.  But
rollback_all() fails (it probably wasn't designed to handle constraint
violations), and the exception never gets re-raised.

I'm wondering if the undocumented @turbogears.exception_handler
decorator would be useful here, but I can find no hint as to how it
might be employed.

Any help gratefully accepted.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~----------~----~----~----~------~----~------~--~---

Reply via email to