def Transactional(_func=None, **kwargs):
 if (_func is not None):
  return Transactional()(_func)
 if (not kwargs.pop('require_new', None)):
  kwargs.setdefault('propagation', datastore_rpc.TransactionOptions.ALLOWED)
 options = datastore_rpc.TransactionOptions(**kwargs)
 def outer_wrapper(func):
  def inner_wrapper(*args, **kwds):
   return RunInTransactionOptions(options, func, *args, **kwds)
  return inner_wrapper
 return outer_wrapper

def Transactional ( _func = None , ** kwargs ) : if ( _func is not None ) : return Transactional ( ) ( _func ) if ( not kwargs . pop ( 'require_new' , None ) ) : kwargs . setdefault ( 'propagation' , datastore_rpc . TransactionOptions . ALLOWED ) options = datastore_rpc . TransactionOptions ( ** kwargs ) def outer_wrapper ( func ) : def inner_wrapper ( * args , ** kwds ) : return RunInTransactionOptions ( options , func , * args , ** kwds ) return inner_wrapper return outer_wrapper
a decorator that makes sure a function is run in a transaction .