Thanks, that was exactly what I wanted!  Everything I would want to
remove would indeed be during that single request/response cycle.
I've since learned I might be able to get the same effect by throwing
an exception, but again, I'm lacking documentation and I don't know if
I would have to catch it myself or what exception specifically to
throw.

I would still welcome any information on locking a table (even though
it's not actually required in my case).  I understand your comment
about slowing down the system, as well as deadlocks.


Mike

On Jul 30, 8:53 am, "Diez B. Roggisch" <[email protected]> wrote:
> > -Are you telling me that I cannot roll back transactions unless I rip
> > out the middleware?  There's no accessible command to the middleware
> > with TG2 as it ships?
>
> I think you want then is
>
> import transaction
>
> transaction.doom()
>
> That will mark an ongoing transaction as failed, and provoke a rollback on
> middleware egress.
>
> > -How can I lock a table?  I thought that was done by TG as well - that
> > each call to a controller made the database safe to access.
>
> Nope. And it wouldn't be desirable, because that would mean that the system
> would slowdown to a screeching halt, and automatic locking is likely to
> create deadlocks.
>
>
>
> > -I actually do want to roll back *all* the previous transactions made
> > in that sessions.  It was an all-or-nothing scenario.  If there's a
> > single duplicate in that database, then I want to remove all of the
> > new entries added during this call.  I would expect rollback()
> > wouldn't remove items already in the database from a previous call to
> > the controller (which ends with a commit() as I understand it, perhaps
> > in repoze.tm2 as you point out?)
>
> A transaction spans usually a request/response-cycle (this is the way the
> system is set up, you'd have to manually alter a lot of things to make it
> work different), and the very nature of transactions is that they are
> isolated from each other. So if you have ten calls to the action, and
> rollback the last, then you'd have still the work of the 9 successful ones in
> the DB.
>
> Diez
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to