From 4bfbf3bbf3cc6416b9d31b5392bfcb7f3eab7427 Mon Sep 17 00:00:00 2001 From: Steve Pulec Date: Sun, 26 Oct 2014 21:11:03 -0400 Subject: [PATCH] Python3 fixes for dynamodb2. --- moto/dynamodb2/models.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/moto/dynamodb2/models.py b/moto/dynamodb2/models.py index 6f849afa6..1da4e577c 100644 --- a/moto/dynamodb2/models.py +++ b/moto/dynamodb2/models.py @@ -31,8 +31,8 @@ class DynamoType(object): """ def __init__(self, type_as_dict): - self.type = type_as_dict.keys()[0] - self.value = type_as_dict.values()[0] + self.type = list(type_as_dict)[0] + self.value = list(type_as_dict.values())[0] def __hash__(self): return hash((self.type, self.value)) @@ -173,6 +173,9 @@ class Table(object): def __nonzero__(self): return True + def __bool__(self): + return self.__nonzero__() + @property def has_range_key(self): return self.range_key_attr is not None