Skip to content

Commit 0ec9a38

Browse files
committed
Fix json encoding of UserList and UserDict subclasses in CLI.
1 parent c00a7a0 commit 0ec9a38

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

sunlight/cli.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
from clint import args
66
import sunlight
7+
from sunlight.service import EntityList, EntityDict
78

89

910
def main():
@@ -23,6 +24,8 @@ def main():
2324
fn_args = [g.split(',') for g in args.grouped.get('_')[2:]]
2425
fn_args = list(itertools.chain.from_iterable(fn_args))
2526
resp = getattr(service, args.get(1))(*fn_args, **params)
27+
if isinstance(resp, EntityList) or isinstance(resp, EntityDict):
28+
resp = resp.data
2629
sys.stdout.write(json.dumps(resp, indent=2) + '\n')
2730

2831
else:

0 commit comments

Comments
 (0)