Skip to content
Browse files

Fixing a dict.keys() problem in layer2.py and an encoding problem in …

…layer1.py.
  • Loading branch information...
1 parent bc9108d commit 0f861aecd8e3ee0b8b62178a602e8df4468783d0 @garnaat garnaat committed Mar 29, 2012
Showing with 5 additions and 2 deletions.
  1. +1 −0 boto/dynamodb/layer1.py
  2. +4 −2 boto/dynamodb/layer2.py
View
1 boto/dynamodb/layer1.py
@@ -142,6 +142,7 @@ def _retry_handler(self, response, i, next_sleep):
status = None
if response.status == 400:
response_body = response.read()
+ response_body = response_body.decode('utf-8')
boto.log.debug(response_body)
data = compat.json.loads(response_body)
if self.ThruputError in data.get('__type'):
View
6 boto/dynamodb/layer2.py
@@ -181,13 +181,15 @@ def build_key_from_values(self, schema, hash_key, range_key=None):
"""
dynamodb_key = {}
dynamodb_value = dynamize_value(hash_key)
- if dynamodb_value.keys()[0] != schema.hash_key_type:
+ keys = list(dynamodb_value.keys())
+ if keys[0] != schema.hash_key_type:
msg = 'Hashkey must be of type: %s' % schema.hash_key_type
raise TypeError(msg)
dynamodb_key['HashKeyElement'] = dynamodb_value
if range_key is not None:
dynamodb_value = dynamize_value(range_key)
- if dynamodb_value.keys()[0] != schema.range_key_type:
+ keys = list(dynamodb_value.keys())
+ if keys[0] != schema.range_key_type:
msg = 'RangeKey must be of type: %s' % schema.range_key_type
raise TypeError(msg)
dynamodb_key['RangeKeyElement'] = dynamodb_value

0 comments on commit 0f861ae

Please sign in to comment.
Something went wrong with that request. Please try again.