Open uralbash opened 8 years ago
I'm no longer working on anything related to this any more, unfortunately.
A quick look at the code looks like it's supposed to recursively update the attributes but the recursive calls to set the context
like on the initial call. There's also a variable called cls
that's not being used that I suspect is what's supposed to be passed in as the context
.
so perhaps it should be:
cls = prop.mapper.class_
if prop.uselist:
# Sequence of objects
value = [self[attr].children[0].objectify(obj, cls) # added context here
for obj in dict_[attr]]
else:
# Single object
value = self[attr].objectify(dict_[attr], cls) # added context here
Let me know if that fixes it. And if it does, it'd be great if you could produce a PR with some tests.
@uralbash - Did that solve your issue?
@tisdall Yes thank you. I'll try to write tests when the time appears.
@uralbash Are you able to put together a PR with tests for this?
I can not save the object that was received with
objectify
method. For example I save user with relation to address.Now I get dict from user oject:
Create object from that dict and add it to dbsession:
But it raises error when I commit session.
It turns out that I can only create objects in such a way, not update. This is a very limited use of this function.