Ticket #1065 (closed enhancement: migrated)
There should be a way to specify which controller methods are wrapped in a transaction
| Reported by: | goodwill | Owned by: | kskuhlman |
|---|---|---|---|
| Priority: | normal | Milestone: | 1.5 |
| Component: | TurboGears | Version: | 1.0 |
| Severity: | normal | Keywords: | |
| Cc: |
Description (last modified by Chris Arndt) (diff)
There was once a talk of being able to set whether a controller would be wrapped in transaction or not.
Both the ticket and the maillist discussion talk about possible ways of doing so.
I have tried them all and can not seem to set it.
http://trac.turbogears.org/turbogears/ticket/80 http://groups.google.com/group/turbogears/browse_thread/thread/367179190688a909/517cc32179dfbdfd?lnk=st&q=&rnum=1&hl=en#517cc32179dfbdfd
controller.py: http://trac.turbogears.org/turbogears/browser/trunk/turbogears/controllers.py?rev=#L276
if hasattr(cherrypy.request, "in_transaction"):
How do I set this in the controller? Setting cherrypy.request.in_transaction does not work, I tried using it as a decorator, as a argument to expose method and nothing.
Please advise :)
Attachments
Change History
comment:2 Changed 7 years ago by fumanchu@…
- Component changed from CherryPy to TurboGears
This is an area CherryPy? wants no part of. ;)
comment:5 Changed 6 years ago by alberto
- Milestone changed from 1.1 to __unclassified__
Batch moved into unclassified from 1.1 to properly track progress on the later
comment:6 Changed 5 years ago by Chris Arndt
- Owner changed from anonymous to kskuhlman
- Milestone changed from __unclassified__ to 1.5
- Type changed from defect to enhancement
- Description modified (diff)
- Summary changed from in_transactions flag for expose usage? can not seem to set it. to There should be a way to specify which controller methods are wrapped in a transaction
The feature requested here was finally implemented by the CP 3 tool introduced on the mailing list a few days ago and there is a discussion how to integrate this best into TG 1.5.
Ken, I'm assigning this to you, since you are currently the de-facto master of the 1.5 branch. Feel free to assign it somebody else, if you don't want it. ;)
Changed 4 years ago by dbrattli
-
attachment
transactions-15.diff
added
repoze.tm implemented as a cp tool. Replaces transaction handling in expose(), can be set per controller.
comment:7 Changed 4 years ago by dbrattli
The patch transactions-15.diff is a draft implementation of repoze.tm wrapped in a cherrypy tool. It replaces the transaction handling in turbogears.expose() and also makes it possible to use transactions in cherrypy.expose methods if needed.
TODO:
1) Remove run_with_transaction() stuff from controllers.expose() so we can have tg exposed methods running without transactions.
2) Use zope.sqlalchemy instead of the SADataManager
3) Add a turbogears/database module dir to keep the database/transactions files. Put the datamangers in a separate file?
4) Have a SODataManager for each PackageHub??
Comments and suggestions are welcome
-- Dag
comment:8 Changed 4 years ago by dbrattli
Did some more changes in transactions-tg15-2.diff:
1) Now uses zope.sqlalchemy
2) Fixed errorhandling, so that db changes in exception_handler's are not rolled back
3) Experimental support for having one SODataManger per Hub for SQLObject
4) Passes most of the tests
5) Do not call run_with_transactions anymore (which is why one test related to this still fails).
Still need more work, so please comment
comment:9 Changed 4 years ago by faide
Dag, I had no time to look at the patches yet, but I'm interested in the result. I'm focusing on the 1.1 release before I can really shift to 1.5 :)
comment:11 Changed 2 years ago by chrisz
- Status changed from new to closed
- Resolution set to migrated
anyone interested in implementing this?