Since Python 2.5 KeyboardInterrupt? does not inherit from Exception, but
from BaseException?. If there is a bug in a method which uses commit_on_success
and you hit ctrl-c on the shell, you don't see the real traceback, but
only this:
Traceback (most recent call last):
File "/localhome/modw/listen/bin/index.py", line 148, in <module>
main()
File "/localhome/modw/listen/bin/index.py", line 68, in main
index(file, ignore_mtime=ignore_mtime)
File "/localhome/modw/listen/bin/index.py", line 78, in index
index_file(file, ignore_mtime=ignore_mtime)
File "/localhome/modw/modwork_esg/django/db/transaction.py", line 204, in _commit_on_success
leave_transaction_management()
File "/localhome/modw/modwork_esg/django/db/transaction.py", line 70, in leave_transaction_management
raise TransactionManagementError("Transaction managed block ended with pending COMMIT/ROLLBACK")
django.db.transaction.TransactionManagementError: Transaction managed block ended with pending COMMIT/ROLLBACK
This small patch handles KeyboardInterrupt? in commit_on_success() better.
Python Docu for KeyboardInterrupt?: http://docs.python.org/lib/module-exceptions.html#l2h-111