What if my controller method calls another controller method that
is also decorated to run inside a transaction? Will the decorator
be smart enough to use the current transaction? In the case of a
filter-based approach, you could instead start a transaction
`onRequestStart`, rollback and display an error message
`onRequestError`, and commit `onRequestEnd`.
Unfortunately, CherryPy filters will only allow us to rollback or
commit. We can't actually display a meaningful page. I filed a
ticket for this #392 with the CherryPy team, but they seem to think
it is working correctly. I'll have to write a short example to show
exactly what's going wrong.
This got me thinking that maybe filters are the wrong approach, as
are decorators. Why not make both the transaction-per-request and
automated-error-handling WSGI middleware? I am not an expert on the
WSGI specification, but it seems at a cursory glance to be possible,
and then we wouldn't have to convince CherryPy to change anything.
-- Jonathan
- [TurboGears] Re: Adding transactions to @expose Jonathan LaCour
-