You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# works
root.n1=1
root.n2=root.n1
root.a1="a"
root.a2=root.a1
root.l1=[1,2,3,4]
root.l2=root.l1
# fails with exception thrown
root.d1={"a":"b"}
root.d2=root.d1
root.t1=(1,2,3)
root.t2=root.t1
If you convert the LazyDot object back to a normal object before assigning, this works around the problem. If I add the following at the top of Root.__save_in_redis():
if isinstance(value,LazyDot):
value.__repr__()
value=value.__deepcopy__(None)
But I feel like its a deeper issue in LazyObject, which I'm having a really hard time understanding and debugging since overridding all the operators and the proxying of class attributes makes it behave in unexpected ways.
The exception seems to be an issue with the json dumping of the LazyDot object:
# fails with same exception
root.t1=(1,2,3)
json.dumps(root.t1)
The text was updated successfully, but these errors were encountered:
So this comes back to the fact that all root attributes like root.t1 etc. are lazy dot objects as you have noticed. I have to make DotObject to get the value of another DotObject when it is assigned that DotObject. Regarding json serialization, I will take care of it. Thanks for reporting!
I think the json serialization problem is the cause of the assignment problem. (The exception thrown when doing the assignment from another DotObject comes from inside the json serialization)
If you convert the LazyDot object back to a normal object before assigning, this works around the problem. If I add the following at the top of Root.__save_in_redis():
But I feel like its a deeper issue in LazyObject, which I'm having a really hard time understanding and debugging since overridding all the operators and the proxying of class attributes makes it behave in unexpected ways.
The exception seems to be an issue with the json dumping of the LazyDot object:
The text was updated successfully, but these errors were encountered: