Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions inbox/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def _get_resources(self, namespace, cls, **filters):

response = self._get_http_session(cls.api_root).get(url)
results = _validate(response).json()
return map(lambda x: cls.create(self, namespace, **x), results)
return list(map(lambda x: cls.create(self, namespace, **x), results))

@inbox_excepted
def _get_resource_raw(self, namespace, cls, id, **filters):
Expand Down Expand Up @@ -242,7 +242,7 @@ def _create_resources(self, namespace, cls, data):
response = session.post(url, data=data, headers=headers)

results = _validate(response).json()
return map(lambda x: cls.create(self, namespace, **x), results)
return list(map(lambda x: cls.create(self, namespace, **x), results))

@inbox_excepted
def _delete_resource(self, namespace, cls, id):
Expand Down
2 changes: 1 addition & 1 deletion inbox/client/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
class APIClientError(Exception):
def __init__(self, **kwargs):
self.attrs = kwargs.keys()
for k, v in kwargs.iteritems():
for k, v in kwargs.items():
setattr(self, k, v)

Exception.__init__(self, str(kwargs))
Expand Down
8 changes: 6 additions & 2 deletions inbox/client/restful_models.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from .restful_model_collection import RestfulModelCollection
from cStringIO import StringIO
from six import StringIO
import base64
import json

Expand All @@ -18,10 +18,14 @@ def __init__(self, cls, api, namespace):
self.api = api
self.namespace = namespace

__getattr__ = dict.__getitem__
__setattr__ = dict.__setitem__
__delattr__ = dict.__delitem__

def __getattr__(self, what):
if what not in self:
raise AttributeError("no such attribute: '{}'".format(what))
return self[what]

@classmethod
def create(cls, api, namespace_, **kwargs):
obj = cls(api, namespace_)
Expand Down
2 changes: 2 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pytest
responses
9 changes: 9 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[tox]
envlist = py27,pypy,py34

[testenv]
commands =
pip install -e .
py.test
deps =
-rrequirements-dev.txt