Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Commit

Permalink
Merge branch 'master' of https://github.com/maxnoel/boto into maxnoel…
Browse files Browse the repository at this point in the history
…-master
  • Loading branch information
garnaat committed Mar 20, 2012
2 parents 2d88202 + 5b05adc commit 0709e2d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions boto/dynamodb/item.py
Expand Up @@ -40,13 +40,15 @@ def __init__(self, table, hash_key=None, range_key=None, attrs=None):
self._updates = None
self._hash_key_name = self.table.schema.hash_key_name
self._range_key_name = self.table.schema.range_key_name
hash_key = hash_key or attrs.get(self._hash_key_name, None)
if hash_key is None:
raise DynamoDBItemError('You must supply a hash_key')
if attrs.get(self._hash_key_name) is None:
raise DynamoDBItemError('You must supply a hash_key')
hash_key = attrs[self._hash_key_name]
if self._range_key_name:
range_key = range_key or attrs.get(self._range_key_name, None)
if range_key is None:
raise DynamoDBItemError('You must supply a range_key')
if attrs.get(self._range_key_name) is None:
raise DynamoDBItemError('You must supply a range_key')
range_key = attrs[self._range_key_name]
self[self._hash_key_name] = hash_key
if self._range_key_name:
self[self._range_key_name] = range_key
Expand Down

0 comments on commit 0709e2d

Please sign in to comment.