diff --git a/boto/dynamodb2/table.py b/boto/dynamodb2/table.py index 3b187566f3..8dfbea9c92 100644 --- a/boto/dynamodb2/table.py +++ b/boto/dynamodb2/table.py @@ -669,7 +669,7 @@ def get_item(self, consistent=False, attributes=None, **kwargs): should be fetched) Returns an ``Item`` instance containing all the data for that record. - + Raises an ``ItemNotFound`` exception if the item is not found. Example:: @@ -1581,9 +1581,9 @@ def _batch_get(self, keys, consistent=False, attributes=None): }) results.append(item) - raw_unproccessed = raw_results.get('UnprocessedKeys', {}) + raw_unprocessed = raw_results.get('UnprocessedKeys', {}).get(self.table_name, {}) - for raw_key in raw_unproccessed.get('Keys', []): + for raw_key in raw_unprocessed.get('Keys', []): py_key = {} for key, value in raw_key.items(): diff --git a/tests/unit/dynamodb2/test_table.py b/tests/unit/dynamodb2/test_table.py index 87bdbe48f8..a92bad2ccb 100644 --- a/tests/unit/dynamodb2/test_table.py +++ b/tests/unit/dynamodb2/test_table.py @@ -1131,7 +1131,7 @@ def test_fetch_more(self): self.assertFalse(self.results._results_left) def test_fetch_more_empty(self): - self.results.to_call(lambda keys: {'results': [], 'last_key': None}) + self.results.to_call(lambda keys: {'results': [], 'last_key': None}) self.results.fetch_more() self.assertEqual(self.results._results, []) @@ -2913,9 +2913,11 @@ def test_private_batch_get(self): # Now alter the expected. del expected['Responses']['users'][2] expected['UnprocessedKeys'] = { - 'Keys': [ - {'username': {'S': 'jane',}}, - ], + 'users': { + 'Keys': [ + {'username': {'S': 'jane',}}, + ], + }, } with mock.patch.object(