Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
knap1930 committed Feb 10, 2024
1 parent 33c66a2 commit 7f757fb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion docs/transaction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ Now, say you make another attempt to debit one of the accounts when they don't h
condition=(
(BankStatement.account_balance >= transfer_amount) &
(BankStatement.is_active == True)
)
),
return_values=ALL_OLD
)
transaction.update(
BankStatement(user_id='user2'),
Expand All @@ -107,6 +108,8 @@ Now, say you make another attempt to debit one of the accounts when they don't h
assert e.cause_response_code == 'TransactionCanceledException'
# the first 'update' was a reason for the cancellation
assert e.cancellation_reasons[0].code == 'ConditionalCheckFailed'
# when return_values=ALL_OLD, the old values can be accessed from the item property
assert BankStatement.from_dynamodb_dict(e.cancellation_reasons[0].item) == user1_statement
# the second 'update' wasn't a reason, but was cancelled too
assert e.cancellation_reasons[1] is None
Expand Down

0 comments on commit 7f757fb

Please sign in to comment.