mirror of
https://github.com/django/django.git
synced 2025-11-07 07:15:35 +00:00
Fixed #20028 -- Made atomic usable on callable instances.
Thanks Anssi for the report.
This commit is contained in:
@@ -17,6 +17,7 @@ import warnings
|
||||
from functools import wraps
|
||||
|
||||
from django.db import connections, DatabaseError, DEFAULT_DB_ALIAS
|
||||
from django.utils.decorators import available_attrs
|
||||
|
||||
|
||||
class TransactionManagementError(Exception):
|
||||
@@ -313,7 +314,7 @@ class Atomic(object):
|
||||
|
||||
|
||||
def __call__(self, func):
|
||||
@wraps(func)
|
||||
@wraps(func, assigned=available_attrs(func))
|
||||
def inner(*args, **kwargs):
|
||||
with self:
|
||||
return func(*args, **kwargs)
|
||||
|
||||
Reference in New Issue
Block a user