Merge pull request #1872 from uncovertruth/fix/wrong_type_if_exists

Fix wrong type if exists
This commit is contained in:
Steve Pulec 2018-10-15 00:38:08 -04:00 committed by GitHub
commit a22cb410b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -162,12 +162,13 @@ class Item(BaseModel):
# If it already exists, get its value so we dont overwrite it
if path in self.attrs:
value = self.attrs[path].cast_value
value = self.attrs[path]
if value in expression_attribute_values:
value = DynamoType(expression_attribute_values[value])
else:
value = DynamoType({"S": value})
if type(value) != DynamoType:
if value in expression_attribute_values:
value = DynamoType(expression_attribute_values[value])
else:
value = DynamoType({"S": value})
if '.' not in key:
self.attrs[key] = value