On Wed, Aug 3, 2011 at 2:49 PM, Bobby <[email protected]> wrote:
> Just wondering in what scenarios, one would use the transaction
> management package, pyramid_tm. I understand transactions as related
> to databases, but I can not think of the other intended situations
> where I should use this.

The main use *is* databases. The only other use would be updating
other external resources. But most other resources (such as files or
network services) can't be rolled back. That doesn't usually matter
because updating the resource is the main purpose of the view and the
action is done near the end of it; the only thing after it is the
confirmation, and if the confirmation raises an error, that's not the
end of the world. The thing that's diffferent about database
transactions is that they may require multiple queries, and any one of
them may fail due to a referential integrity error, a string that's
too long, a type error, or a bad Unicode conversion. When that happens
you want to abort the entire transaction. In the case of other
external services, it's usually one command to do the whole thing, and
if it fails, your external data is still intact. In any case, the only
way it *can* participate in the transaction is if it *can* be rolled
back, and that's different for every type of resource.  E.g., if a
file write fails because of a Unicode error, your fallback-handler
would have to restore the previous version of the file.

-- 
Mike Orr <[email protected]>

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" 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/pylons-discuss?hl=en.

Reply via email to