I had this same question a while back. You can look how we solved it here:
http://code.feestjeproject.com/feestje/browser/trunk/pyatl/subcontrollers/registration.py 2007/6/3, aspineux <[EMAIL PROTECTED]>: > > Test it yourself ! > The python shell is very easy to use to answer quickly lot of small > questions. > > # tg-admin shell > >>> session.save(User(user_name='alreadyexist')) > >>> session.flush() > > > On 3 juin, 01:33, SamDonaldson <[EMAIL PROTECTED]> wrote: > > Hello, > > > > I want to be able to catch a duplicate primary key exception in one of > > my methods. I guess the exception will actually get thrown after > > flush() is called. How can I catch a duplicate key exception? Is > > there a list of exceptions that can be caught? > > > > Thanks, > > > > Sam. > > > > > --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---

