fix for scanning without filter

This commit is contained in:
Steve Pulec 2013-03-15 17:14:14 -04:00
parent d29ca8503e
commit a5eaaaad51
3 changed files with 14 additions and 8 deletions

View File

@ -244,7 +244,7 @@ class DynamoHandler(object):
name = body['TableName'] name = body['TableName']
filters = {} filters = {}
scan_filters = body['ScanFilter'] scan_filters = body.get('ScanFilter', {})
for attribute_name, scan_filter in scan_filters.iteritems(): for attribute_name, scan_filter in scan_filters.iteritems():
# Keys are attribute names. Values are tuples of (comparison, comparison_value) # Keys are attribute names. Values are tuples of (comparison, comparison_value)
comparison_operator = scan_filter["ComparisonOperator"] comparison_operator = scan_filter["ComparisonOperator"]

View File

@ -348,6 +348,9 @@ def test_scan():
) )
item.put() item.put()
results = table.scan()
results.response['Items'].should.have.length_of(3)
results = table.scan(scan_filter={'SentBy': condition.EQ('User B')}) results = table.scan(scan_filter={'SentBy': condition.EQ('User B')})
results.response['Items'].should.have.length_of(1) results.response['Items'].should.have.length_of(1)

View File

@ -291,6 +291,9 @@ def test_scan():
) )
item.put() item.put()
results = table.scan()
results.response['Items'].should.have.length_of(3)
results = table.scan(scan_filter={'SentBy': condition.EQ('User B')}) results = table.scan(scan_filter={'SentBy': condition.EQ('User B')})
results.response['Items'].should.have.length_of(1) results.response['Items'].should.have.length_of(1)