I'm trying to create an empty object which contains nested attributes like this:
form = type('', (), {})()
form.foo.data = ''
But I get following attribute error:
>>> form = type('', (), {})()
>>> form.foo.data = ''
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'str' object has no attribute 'data'
How should I construct the object to accomplish that?
Formclass fromWTForms. But in this case I only want to create a 'fake' object which only contains those attributes:form.foo.dataorform.bar.dataand so on.