mirror of
https://github.com/django/django.git
synced 2024-12-23 17:46:27 +00:00
Fixed #7241 -- More robust exception catching in the transaction management
code. As pointed out in the ticket, Python still lets you raise all sorts of odd things as exceptions (e.g. strings), so even though they're bad form, we should still handle them. We do that cleanly now. Thanks to jim-django@dsdd.org for the patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@8419 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
2d2396a384
commit
260510453f
@ -236,10 +236,8 @@ def commit_on_success(func):
|
||||
managed(True)
|
||||
try:
|
||||
res = func(*args, **kw)
|
||||
except (Exception, KeyboardInterrupt, SystemExit):
|
||||
# (We handle KeyboardInterrupt and SystemExit specially, since
|
||||
# they don't inherit from Exception in Python 2.5, but we
|
||||
# should treat them uniformly here.)
|
||||
except:
|
||||
# All exceptions must be handled here (even string ones).
|
||||
if is_dirty():
|
||||
rollback()
|
||||
raise
|
||||
|
Loading…
Reference in New Issue
Block a user