Skip to content
This repository was archived by the owner on Jun 11, 2024. It is now read-only.

Commit cd46234

Browse files
committed
if Atomx.post returns a list, auto-convert list of objects to a list of models.
1 parent 2fdb8d4 commit cd46234

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

CHANGES.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
1.4 (unreleased)
2+
-----------------
3+
4+
- if :meth:`atomx.Atomx.post` returns a list, auto-convert list of objects
5+
to a list of :mod:`atomx.models` models. (Useful for `POST` to the `/domains` endpoint)
6+
7+
18
1.3
29
---
310

atomx/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,9 @@ def post(self, resource, json, **kwargs):
379379
if self.save_response:
380380
del r_json[model_name]
381381
self.last_response = r_json
382+
model = get_model_name(model_name)
383+
if model and isinstance(res, list):
384+
return [getattr(models, model)(self, **m) for m in res]
382385
return res
383386

384387
def put(self, resource, id, json, **kwargs):

atomx/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
VERSION = '1.3'
1+
VERSION = '1.4b'
22
API_VERSION = 'v1'

0 commit comments

Comments
 (0)