
"""Provides a seam for transaction services."""

__author__ = 'Sean Lip'


def run_in_transaction(fn, *args, **kwargs):
    """Run a function in a transaction."""
    # TODO(sll): Actually run the function in a transaction.
    return fn(*args, **kwargs)


"""Provides a seam for transaction services."""

__author__ = 'Sean Lip'


from django.db import transaction


def run_in_transaction(fn, *args, **kwargs):
    """Run a function in a transaction."""
    with transaction.commit_on_success():
        return fn(*args, **kwargs)

Add transaction support for django models.
Add transaction support for django models.

  
  """Provides a seam for transaction services."""
  
  __author__ = 'Sean Lip'
  
  
+ from django.db import transaction
+ 
+ 
  def run_in_transaction(fn, *args, **kwargs):
      """Run a function in a transaction."""
-     # TODO(sll): Actually run the function in a transaction.
+     with transaction.commit_on_success():
-     return fn(*args, **kwargs)
+         return fn(*args, **kwargs)
  
Add transaction support for django models.
## Code Before:

"""Provides a seam for transaction services."""

__author__ = 'Sean Lip'


def run_in_transaction(fn, *args, **kwargs):
    """Run a function in a transaction."""
    # TODO(sll): Actually run the function in a transaction.
    return fn(*args, **kwargs)

## Instruction:
Add transaction support for django models.
## Code After:

"""Provides a seam for transaction services."""

__author__ = 'Sean Lip'


from django.db import transaction


def run_in_transaction(fn, *args, **kwargs):
    """Run a function in a transaction."""
    with transaction.commit_on_success():
        return fn(*args, **kwargs)
