I'm having trouble trapping an IntegrityError with sqlalchemy. I have
the following:
from turbogears.database import session
from myproject.model import User
user = User()
user.user_name = "Harry"
user.password = "mypass"
try:
session.save(user)
except:
flash("Duplicate entry!")
raise redirect ("register")
..but it doesn't catch the error and it comes back to me in the
browser. I tried adding a session.flush() in the try block but there
is an error about no transaction being created. I'm assuming that is
because I'm using mysql myISAM
Can anyone help? Thanks so much.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---