Skip to content
Browse files

Populate both next_token and nextToken. Fixes #1968.

This bug was introduced due to an issue with how boto handled the nextToken
field in responses, which meant that it was exposed with the incorrect
name. The fix caused existing code to break, so now both versions are made
available. New code should use next_token.
  • Loading branch information...
1 parent 8b37180 commit 6928928775dac1607e03197c437d8503574466cb @danielgtaylor danielgtaylor committed with toastdriven
Showing with 5 additions and 1 deletion.
  1. +3 −0 boto/resultset.py
  2. +2 −1 tests/unit/ec2/test_spotinstance.py
View
3 boto/resultset.py
@@ -119,6 +119,9 @@ def endElement(self, name, value, connection):
self.next_token = value
elif name == 'nextToken':
self.next_token = value
+ # Code exists which expects nextToken to be available, so we
+ # set it here to remain backwards-compatibile.
+ self.nextToken = value
elif name == 'BoxUsage':
try:
connection.box_usage += float(value)
View
3 tests/unit/ec2/test_spotinstance.py
@@ -83,6 +83,8 @@ def test_get_spot_price_history(self):
self.assertEqual(len(response), 2)
self.assertEqual(response.next_token,
'q5GwEl5bMGjKq6YmhpDLJ7hEwyWU54jJC2GQ93n61vZV4s1+fzZ674xzvUlTihrl')
+ self.assertEqual(response.nextToken,
+ 'q5GwEl5bMGjKq6YmhpDLJ7hEwyWU54jJC2GQ93n61vZV4s1+fzZ674xzvUlTihrl')
self.assertEqual(response[0].instance_type, 'c3.large')
self.assertEqual(response[0].availability_zone, 'us-west-2c')
self.assertEqual(response[1].instance_type, 'c3.large')
@@ -106,4 +108,3 @@ def test_get_spot_price_history(self):
ignore_params_values=['AWSAccessKeyId', 'SignatureMethod',
'SignatureVersion', 'Timestamp',
'Version'])
-

0 comments on commit 6928928

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