Skip to content

Commit

Permalink
Merge pull request #216 from jgeewax/master
Browse files Browse the repository at this point in the history
Fix #215: Helper for int and double now work as expected.
  • Loading branch information
dhermes committed Oct 7, 2014
2 parents 6dd5f2b + e8123f4 commit 4ca99f5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions gcloud/datastore/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from gcloud.datastore.key import Key

INT64 = Int64ValueChecker().CheckValue
INT_VALUE_CHECKER = Int64ValueChecker()


def get_protobuf_attribute_and_value(val):
Expand Down Expand Up @@ -56,7 +56,8 @@ def get_protobuf_attribute_and_value(val):
elif isinstance(val, float):
name, value = 'double', val
elif isinstance(val, (int, long)):
name, value = 'integer', INT64(val)
INT_VALUE_CHECKER.CheckValue(val) # This will raise an exception if invalid.
name, value = 'integer', long(val) # Always cast to a long.
elif isinstance(val, basestring):
name, value = 'string', val

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
REQUIREMENTS = [
'httplib2',
'oauth2client',
'protobuf',
'protobuf >= 2.5.0',
'pycrypto',
'pyopenssl',
'pytz',
Expand Down

0 comments on commit 4ca99f5

Please sign in to comment.