#453 remove recursion and add separate bindings handling for as_dict(recurse=True)

This commit is contained in:
Sergey Tikhonov 2015-02-12 17:33:55 +03:00 committed by Ask Solem
parent 846179c19d
commit fb24ea5f53
1 changed files with 10 additions and 0 deletions

View File

@ -730,3 +730,13 @@ class Queue(MaybeChannelBound):
queue_arguments=q_arguments,
binding_arguments=b_arguments,
bindings=bindings)
def as_dict(self, recurse=False):
res = super(Queue, self).as_dict(recurse)
if not recurse:
return res
bindings = res.get('bindings')
if bindings:
res['bindings'] = [b.as_dict(recurse=True) for b in bindings]
return res