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
If you are saving object a which has a reference to object b, but b has not been saved yet, it is not possible to set metadata on b in the save_instance_state call of a because mincepy will try finding b's obj_id and fail.
This is quite restrictive and it would be useful to be able to set the metadata of referenced objects in certain scenarios.
One possible way to implement it would be to have the transaction keep track of metadata operations using a weakref dict (in addition to the obj_id tracking). This way if, by the end of the trasnaction, the object does have an object id (because save is called on it somewhere during the transaction), then the metadata will also be saved. The one downside with this is that, if the object is not saved during the transaction then the metadata will be silently lost.
The text was updated successfully, but these errors were encountered:
If you are saving object
a
which has a reference to objectb
, butb
has not been saved yet, it is not possible to set metadata onb
in thesave_instance_state
call ofa
becausemincepy
will try findingb
'sobj_id
and fail.This is quite restrictive and it would be useful to be able to set the metadata of referenced objects in certain scenarios.
One possible way to implement it would be to have the transaction keep track of metadata operations using a weakref dict (in addition to the obj_id tracking). This way if, by the end of the trasnaction, the object does have an object id (because save is called on it somewhere during the transaction), then the metadata will also be saved. The one downside with this is that, if the object is not saved during the transaction then the metadata will be silently lost.
The text was updated successfully, but these errors were encountered: