mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
Removed a bunch more Python 2.4 workarounds now that we don't support that version. Refs #15702 -- thanks to jonash for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15927 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -11,12 +11,9 @@ called, a commit is made.
|
||||
Managed transactions don't do those commits, but will need some kind of manual
|
||||
or implicit commits or rollbacks.
|
||||
"""
|
||||
import sys
|
||||
|
||||
try:
|
||||
from functools import wraps
|
||||
except ImportError:
|
||||
from django.utils.functional import wraps # Python 2.4 fallback.
|
||||
import sys
|
||||
from functools import wraps
|
||||
|
||||
from django.conf import settings
|
||||
from django.db import connections, DEFAULT_DB_ALIAS
|
||||
@@ -209,18 +206,8 @@ class Transaction(object):
|
||||
def __call__(self, func):
|
||||
@wraps(func)
|
||||
def inner(*args, **kwargs):
|
||||
# Once we drop support for Python 2.4 this block should become:
|
||||
# with self:
|
||||
# func(*args, **kwargs)
|
||||
self.__enter__()
|
||||
try:
|
||||
res = func(*args, **kwargs)
|
||||
except:
|
||||
self.__exit__(*sys.exc_info())
|
||||
raise
|
||||
else:
|
||||
self.__exit__(None, None, None)
|
||||
return res
|
||||
with self:
|
||||
func(*args, **kwargs)
|
||||
return inner
|
||||
|
||||
def _transaction_func(entering, exiting, using):
|
||||
|
||||
Reference in New Issue
Block a user