@@ -404,10 +404,9 @@ def remove_aql_function(self, name, group=None):
404
404
# Transactions #
405
405
################
406
406
407
- # TODO deal with optional attribute "params"
408
407
def execute_transaction (self , action , read_collections = None ,
409
- write_collections = None , wait_for_sync = False ,
410
- lock_timeout = None ):
408
+ write_collections = None , params = None ,
409
+ wait_for_sync = False , lock_timeout = None ):
411
410
"""Execute the transaction and return the result.
412
411
413
412
Setting the ``lock_timeout`` to 0 will make ArangoDB not time out
@@ -419,6 +418,8 @@ def execute_transaction(self, action, read_collections=None,
419
418
:type read_collections: str or list or None
420
419
:param write_collections: the collections written to
421
420
:type write_collections: str or list or None
421
+ :param params: Parameters for the function in action
422
+ :type params: list or dict or None
422
423
:param wait_for_sync: wait for the transaction to sync to disk
423
424
:type wait_for_sync: bool
424
425
:param lock_timeout: timeout for waiting on collection locks
@@ -433,11 +434,13 @@ def execute_transaction(self, action, read_collections=None,
433
434
data ["collections" ]["read" ] = read_collections
434
435
if write_collections is not None :
435
436
data ["collections" ]["write" ] = write_collections
436
- params = {
437
+ if params is not None :
438
+ data ["params" ] = params
439
+ http_params = {
437
440
"waitForSync" : wait_for_sync ,
438
441
"lockTimeout" : lock_timeout ,
439
442
}
440
- res = self ._api .post (path = path , data = data , params = params )
443
+ res = self ._api .post (path = path , data = data , params = http_params )
441
444
if res .status_code != 200 :
442
445
raise TransactionExecuteError (res )
443
446
return res .obj ["result" ]
0 commit comments