>> I am using SQLAlchemy 0.5rc4. >> Is there a way to test if the values of an object are valid >> for >> commiting? I tried something like: >> try: >> session.commit() >> except: >> notify the user >> >> But the problem is, that if the commit fails and I change the non >> valid value to a valid one the session will still not commit. > why? if u try again and all is ok...
If I try again with valid values (in my case I first entered a too long string for a varchar(50) and then corrected it) I get a sqlalchemy.exc.InvalidRequestError with the info: "The transaction is inactive due to a rollback in a subtransaction. Issue rollback() to cancel the transaction." If I issue the rollback I can commit the session but all the previos entered data is lost. It would be more friendly to try to commit the session and if it fails to let the user change the values and try again. Regards, Hinrich. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---