I see the latest version of TG does this by catching
InvalidRequestError. That's funny because I submitted a patch doing
just that before I realized it. Still, there are conditions when
InvalidRequestError should still be raised, so I think TG should check
the error message to make sure it was raised because of an inactive
transaction. I'll create a new ticket, but here is what I have in
mind:
except InvalidRequestError, e:
if 'transaction is inactive' not in str(e):
raise
--Randall
On Aug 10, 11:49 pm, Randall <[EMAIL PROTECTED]> wrote:
> Trying to rollback a transaction ends with an error because TG
> ultimately trys to commit it. I found and workaround in a thread here,
> but I'm wondering if TG could check the state of a transaction and not
> attempt a commit if the transaction is not active. Transaction has an
> attribute is_active that I believe could be useful for this. I'm not
> sure of the best way to access it, but I found it playing around like
> this:
>
> trans.connections.values()[0][1].is_active
>
> where trans is returned from session.create_transaction
>
> I'm thinking TG could do something like this:
>
> if transaction.is_active:
> session_trans.commit()
> else:
> # need to do anything ?
> pass
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---