From 33f023fdaf601217dde6b198b65da7d82b292225 Mon Sep 17 00:00:00 2001 From: Ian Auld Date: Thu, 31 Dec 2015 10:46:54 -0800 Subject: [PATCH] Added comments for clarity --- moto/dynamodb2/models.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/moto/dynamodb2/models.py b/moto/dynamodb2/models.py index af67f5091..2607d7e89 100644 --- a/moto/dynamodb2/models.py +++ b/moto/dynamodb2/models.py @@ -426,12 +426,15 @@ class DynamoDBBackend(BaseBackend): table = self.get_table(table_name) if all([table.hash_key_attr in key, table.range_key_attr in key]): + # Covers cases where table has hash and range keys, ``key`` param will be a dict hash_value = DynamoType(key[table.hash_key_attr]) range_value = DynamoType(key[table.range_key_attr]) elif table.hash_key_attr in key: + # Covers tables that have a range key where ``key`` param is a dict hash_value = DynamoType(key[table.hash_key_attr]) range_value = None else: + # Covers other cases hash_value = DynamoType(key) range_value = None