So, we're finally getting around to handling transactions in
middleware in tg2, and Alberto and I have been playing with different
variations on the theme, and ultimately I think it might be
good if we had a transaction middleware that provided a bit more
configurability about when it rolls back transactions.

Alberto added something which checked the HTTP status code for error
codes and rolled back when the app indicated that an error had
occurred (useful when there's middleware that catches and handles
python exceptions), and I was playing with the idea of setting some
kind of semi-standard parameter in the environ that signals that
there's been an error somewhere and the transaction should be rolled

Of course if we're relying on some kind of "special key" in the
environ, it couples the application inside to a
little bit, so I like Alberto's way better.   On the other hand, I
don't think every application will want the mapping of response-codes
to rollback, and it's even more likely that some folks will want to be
able to handle that mapping a bit differently than any default we come
up with.

And the benifit of a special key in the environ is that it allows
users to overide the default behavior for a particular request, which
provides a nice escape hatch for when things just don't work.

What do you all think?

Mark Ramm-Christensen
email: mark at compoundthinking dot com
Repoze-dev mailing list

Reply via email to