@datastore_rpc._positional(1)
def NonTransactional(_func=None, allow_existing=True):
 if (_func is not None):
  return NonTransactional()(_func)
 def outer_wrapper(func):
  def inner_wrapper(*args, **kwds):
   if (not IsInTransaction()):
    return func(*args, **kwds)
   if (not allow_existing):
    raise datastore_errors.BadRequestError('Function cannot be called from within a transaction.')
   txn_connection = _GetConnection()
   _SetConnection(_thread_local.old_connection)
   try:
    return func(*args, **kwds)
   finally:
    _SetConnection(txn_connection)
  return inner_wrapper
 return outer_wrapper

@ datastore_rpc . _positional ( 1 ) def NonTransactional ( _func = None , allow_existing = True ) : if ( _func is not None ) : return NonTransactional ( ) ( _func ) def outer_wrapper ( func ) : def inner_wrapper ( * args , ** kwds ) : if ( not IsInTransaction ( ) ) : return func ( * args , ** kwds ) if ( not allow_existing ) : raise datastore_errors . BadRequestError ( 'Function cannot be called from within a transaction.' ) txn_connection = _GetConnection ( ) _SetConnection ( _thread_local . old_connection ) try : return func ( * args , ** kwds ) finally : _SetConnection ( txn_connection ) return inner_wrapper return outer_wrapper
a decorator that insures a function is run outside a transaction .