Fixed #7286 -- Added functools wrapping to the transaction decorators. Thanks, SmileyChris.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@7558 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Russell Keith-Magee 2008-05-29 11:50:50 +00:00
parent 55d5f7ecf4
commit 8a0b8d93b2
1 changed files with 7 additions and 3 deletions

View File

@ -16,6 +16,10 @@ try:
import thread import thread
except ImportError: except ImportError:
import dummy_thread as thread import dummy_thread as thread
try:
from functools import wraps
except ImportError:
from django.utils.functional import wraps # Python 2.3, 2.4 fallback.
from django.db import connection from django.db import connection
from django.conf import settings from django.conf import settings
@ -177,7 +181,7 @@ def autocommit(func):
return func(*args, **kw) return func(*args, **kw)
finally: finally:
leave_transaction_management() leave_transaction_management()
return _autocommit return wraps(func)(_autocommit)
def commit_on_success(func): def commit_on_success(func):
""" """
@ -202,7 +206,7 @@ def commit_on_success(func):
return res return res
finally: finally:
leave_transaction_management() leave_transaction_management()
return _commit_on_success return wraps(func)(_commit_on_success)
def commit_manually(func): def commit_manually(func):
""" """
@ -219,4 +223,4 @@ def commit_manually(func):
finally: finally:
leave_transaction_management() leave_transaction_management()
return _commit_manually return wraps(func)(_commit_manually)