From f8dd5a13c65c8d30f235e99b334c6d00f00a0dac Mon Sep 17 00:00:00 2001 From: Heyder Date: Wed, 4 Mar 2020 23:56:30 -0300 Subject: [PATCH] fix case if don't have attrs --- moto/dynamodb2/models.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/moto/dynamodb2/models.py b/moto/dynamodb2/models.py index 747fa93a7..7d995486d 100644 --- a/moto/dynamodb2/models.py +++ b/moto/dynamodb2/models.py @@ -450,7 +450,11 @@ class Item(BaseModel): old_list_key = list_append_re.group(1) # old_key could be a function itself (if_not_exists) if old_list_key.startswith("if_not_exists"): - old_list = DynamoType(self._get_default(old_list_key)) + old_list = self._get_default(old_list_key) + if not isinstance(old_list, DynamoType): + old_list = DynamoType( + expression_attribute_values[old_list] + ) else: old_list = self.attrs[old_list_key.split(".")[0]] if "." in old_list_key: