def _DoOneTry(function, args, kwargs):
 try:
  result = function(*args, **kwargs)
 except:
  original_exception = sys.exc_info()
  try:
   _GetConnection().rollback()
  except Exception:
   logging.exception('Exception sending Rollback:')
  (type, value, trace) = original_exception
  if isinstance(value, datastore_errors.Rollback):
   return (True, None)
  else:
   raise type, value, trace
 else:
  if _GetConnection().commit():
   return (True, result)
  else:
   logging.warning('Transaction collision. Retrying... %s', '')
   return (False, None)

def _DoOneTry ( function , args , kwargs ) : try : result = function ( * args , ** kwargs ) except : original_exception = sys . exc_info ( ) try : _GetConnection ( ) . rollback ( ) except Exception : logging . exception ( 'Exception sending Rollback:' ) ( type , value , trace ) = original_exception if isinstance ( value , datastore_errors . Rollback ) : return ( True , None ) else : raise type , value , trace else : if _GetConnection ( ) . commit ( ) : return ( True , result ) else : logging . warning ( 'Transaction collision. Retrying... %s' , '' ) return ( False , None )
helper to call a function in a transaction .