#13265: TransactionManagementError doesn't allow for easy debugging of views
---------------------------------------------------+------------------------
          Reporter:  orokusaki                     |         Owner:  nobody     
            Status:  reopened                      |     Milestone:             
         Component:  Database layer (models, ORM)  |       Version:  SVN        
        Resolution:                                |      Keywords:  transaction
             Stage:  Unreviewed                    |     Has_patch:  0          
        Needs_docs:  0                             |   Needs_tests:  0          
Needs_better_patch:  0                             |  
---------------------------------------------------+------------------------
Changes (by John Obelenus):

  * keywords:  => transaction
  * status:  closed => reopened
  * resolution:  wontfix =>

Comment:

 Seeing TransactionManagementError? that reports that "Transaction managed
 block ended with pending COMMIT/ROLLBACK" is the correct symptom.

 If you don't commit() or rollback() you will get this error. That much is
 obvious and correct. The problem that 'orokusaki' is talking about is if
 the view (or code called within the view) doesn't catch an exception
 thrown, the view will still give you TransactionManagementError. So, yes
 you doing just this: "It's not like we're rethrowing an error and thereby
 hiding a stack trace." The return of the view function is an exception,
 db.transaction sees the failure case, and raises its own TME exception -
 hiding the true problem.  The true exception can be an ImportError,
 ValueError, TypeError, or any basic error that fingers angry at their
 master can cause. In my case I had a simple ValueError from mistyping a
 variable name, thus giving an undeclared variable.

 The reproduction steps ought to be pretty simple. Cause a basic exception
 in a view with the @transaction.commit_manually decorator, don't catch it,
 and see the TME exception, not the basic exception with a trace to find
 it. If I can do anything to get a test case to let me know how best to
 submit it.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/13265#comment:2>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to