Skip to content

Commit

Permalink
Require a string value to instantiate Binary DynamoDB type
Browse files Browse the repository at this point in the history
Prevents incorrect usage which results in potentially confusing errors.
Fixes boto#1956.
  • Loading branch information
danielgtaylor committed Jan 2, 2014
1 parent ee203bf commit bca6d77
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions boto/dynamodb/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ def dynamize_value(val):

class Binary(object):
def __init__(self, value):
if not isinstance(value, basestring):
raise TypeError('Value must be a string of binary data!')

self.value = value

def encode(self):
Expand Down

0 comments on commit bca6d77

Please sign in to comment.