ets-labs / python-domain-models

Domain models framework for Python projects
BSD 3-Clause "New" or "Revised" License
22 stars 4 forks source link

Implementation of DomainModel.set_data() method. #32

Closed boonya closed 8 years ago

boonya commented 8 years ago

Implementation of issue #21

rmk135 commented 8 years ago

Awesome!

boonya commented 8 years ago

Btw. I didn't get the idea about init for this task. Can you explain it a bit. May be an example?

Пн, 14 бер. 2016 00:35 користувач Roman notifications@github.com пише:

Awesome!

— Reply to this email directly or view it on GitHub https://github.com/ets-labs/domain_models/pull/32#issuecomment-196070384 .

rmk135 commented 8 years ago

Yep, sure!

I meant something like this:

for name, field in six.iteritems(self.__class__.__fields__):
    field.set_builtin_type(self, name, data.get(name))
boonya commented 8 years ago

@rmk135 , no no no... I meant this phrase from the description of the issue -

Notes: Current logic should work for DomainModel.init() as well.

What did you mean? Possibility to pass dict as argument of constructor or what? It partly works DomainModel(**dict()) but not for field.Model

rmk135 commented 8 years ago

Yeah, exactly like that...

DomainModel(**dict())

Will it be a big deal to add such "on the fly" converting for fields.Model and fields.Collection?

rmk135 commented 8 years ago

Hey @boonya,

First of all, sorry for the delay. I put some extremely minor comments, but it looks awesome!

rmk135 commented 8 years ago

Please, fill free to merge it right when you will have a time 👍 ;)