bcwaldon/warlock — pull request #14 by alexturek (2014-07-02 19:46:44+00:00)
Title: Adding support for linking models that have required attributes

I added a test case that shows what I'm trying to fix, but in brief:

You can't reference one model/dict from another model/dict, if the first has 'required' attributes. This seems to be due to copy.deepcopy's implementation of `_deepcopy_dict` - it uses `__setattr__` to copy individual keys/values over, which breaks because Model validates itself on every `__setattr__` call.

The way to resolve this is by using hooks that deepcopy offers called __deepcopy__ and __copy__ (https://docs.python.org/2/library/copy.html#copy.deepcopy)