>However, if a person *does* use a database, we still want that
>connection.close() in a finally.

Adapt my idea of middleware for database transaction handling :-)

Essentially if you have code outside the web app context, you handle
stuff yourself. But if you are running a web application, you just hook
up a middleware that opens a cursor on process_request and commits or
rolls back that cursor on process_response (if the user did handle his
transaction himself, it won't matter - the data will be committed or
rolled back already, so the remaining transaction would be empty) and
can close the database then.

This would actually solve both your problem and #9 :-)

bye, Georg

Reply via email to