hamidnazari/python-ostruct

Cannot create parent OpenStruct object from a list of child OpenStruct objects

cgspeck opened this issue · 2 comments

Given the following code:

src = '/some/local/file'
job0 = OpenStruct(src=src)
list_of_jobs = [job0]
task0 = OpenStruct(run=list_of_jobs)
list_of_tasks = [task0]

I would expect list_of_tasks[0].run to provide me with an OpenStruct object with the following content:
[{ 'src': '/some/local/file'}].

Currently it results in [{}]

Nice find. I run this,

from ostruct import OpenStruct
src = '/some/local/file'
job0 = OpenStruct(src=src)
list_of_jobs = [job0]
task0 = OpenStruct(run=list_of_jobs)
list_of_tasks = [task0]
print list_of_tasks

and now get

[{'run': [{'src': '/some/local/file'}]}]

Thanks!