Ticket #7286: transaction-decorators-wraps.diff

File transaction-decorators-wraps.diff, 1.1 KB (added by Chris Beaven, 16 years ago)
  • django/db/transaction.py

     
    1616    import thread
    1717except ImportError:
    1818    import dummy_thread as thread
     19try:
     20    from functools import wraps
     21except ImportError:
     22    from django.utils.functional import wraps  # Python 2.3, 2.4 fallback.
     23
    1924from django.db import connection
    2025from django.conf import settings
    2126
     
    177182            return func(*args, **kw)
    178183        finally:
    179184            leave_transaction_management()
    180     return _autocommit
     185    return wraps(func)(_autocommit)
    181186
    182187def commit_on_success(func):
    183188    """
     
    202207            return res
    203208        finally:
    204209            leave_transaction_management()
    205     return _commit_on_success
     210    return wraps(func)(_commit_on_success)
    206211
    207212def commit_manually(func):
    208213    """
     
    219224        finally:
    220225            leave_transaction_management()
    221226
    222     return _commit_manually
     227    return wraps(func)(_commit_manually)
Back to Top