Skip to content

Commit

Permalink
Check for none when retrieving object data
Browse files Browse the repository at this point in the history
  • Loading branch information
jlafon committed Jan 29, 2014
1 parent cbac719 commit de68e8f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pynamodb/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,8 +452,9 @@ def get(cls,
consistent_read=consistent_read
)
cls.throttle.add_record(data.get(CONSUMED_CAPACITY))
if data:
return cls.from_raw_data(data.get(ITEM))
item_data = data.get(ITEM)
if item_data:
return cls.from_raw_data(item_data)
else:
return None

Expand Down

0 comments on commit de68e8f

Please sign in to comment.