Merge pull request #246 from spulec/dynamodb-py3
Some fixes for dynamodb and python 3.
This commit is contained in:
commit
6805863998
@ -5,13 +5,12 @@ python:
|
|||||||
env:
|
env:
|
||||||
matrix:
|
matrix:
|
||||||
- BOTO_VERSION=2.34.0
|
- BOTO_VERSION=2.34.0
|
||||||
- BOTO_VERSION=2.32.1
|
|
||||||
- BOTO_VERSION=2.25.0
|
- BOTO_VERSION=2.25.0
|
||||||
- BOTO_VERSION=2.7
|
- BOTO_VERSION=2.7
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- python: "3.3"
|
- python: "3.3"
|
||||||
env: BOTO_VERSION=2.32.1
|
env: BOTO_VERSION=2.34.0
|
||||||
install:
|
install:
|
||||||
- pip install boto==$BOTO_VERSION
|
- pip install boto==$BOTO_VERSION
|
||||||
- pip install .
|
- pip install .
|
||||||
|
@ -153,6 +153,9 @@ class Table(object):
|
|||||||
def __nonzero__(self):
|
def __nonzero__(self):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def __bool__(self):
|
||||||
|
return self.__nonzero__()
|
||||||
|
|
||||||
def put_item(self, item_attrs):
|
def put_item(self, item_attrs):
|
||||||
hash_value = DynamoType(item_attrs.get(self.hash_key_attr))
|
hash_value = DynamoType(item_attrs.get(self.hash_key_attr))
|
||||||
if self.has_range_key:
|
if self.has_range_key:
|
||||||
|
@ -159,8 +159,8 @@ class DynamoHandler(BaseResponse):
|
|||||||
|
|
||||||
for table_name, table_requests in table_batches.items():
|
for table_name, table_requests in table_batches.items():
|
||||||
for table_request in table_requests:
|
for table_request in table_requests:
|
||||||
request_type = table_request.keys()[0]
|
request_type = list(table_request)[0]
|
||||||
request = table_request.values()[0]
|
request = list(table_request.values())[0]
|
||||||
|
|
||||||
if request_type == 'PutRequest':
|
if request_type == 'PutRequest':
|
||||||
item = request['Item']
|
item = request['Item']
|
||||||
|
@ -31,8 +31,8 @@ class DynamoType(object):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, type_as_dict):
|
def __init__(self, type_as_dict):
|
||||||
self.type = type_as_dict.keys()[0]
|
self.type = list(type_as_dict)[0]
|
||||||
self.value = type_as_dict.values()[0]
|
self.value = list(type_as_dict.values())[0]
|
||||||
|
|
||||||
def __hash__(self):
|
def __hash__(self):
|
||||||
return hash((self.type, self.value))
|
return hash((self.type, self.value))
|
||||||
@ -173,6 +173,9 @@ class Table(object):
|
|||||||
def __nonzero__(self):
|
def __nonzero__(self):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def __bool__(self):
|
||||||
|
return self.__nonzero__()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def has_range_key(self):
|
def has_range_key(self):
|
||||||
return self.range_key_attr is not None
|
return self.range_key_attr is not None
|
||||||
|
Loading…
Reference in New Issue
Block a user