Hi !

I often use internal IDs (via an IIntIds utility) to store objects
references.
The drawback of this method is that you have an indirection and you always
have to check that the reference target is still available before using it!
So even in this use case I use an event listener to remove the reference
when the target is removed...

Best regards,
Thierry

2016-04-21 16:10 GMT+02:00 Chris Rossi <[email protected]>:

> The other approach would be to only store objects in one canonical place,
> and use references that just store the path to the object or the oid.
>
> Chris
>
> On Thu, Apr 21, 2016 at 3:36 AM, Joe Steeve <[email protected]> wrote:
>
>> How to maintain "referential integrity" in a ZODB. Simply put: When an
>> object-A is removed from a container, the references to object-A, in
>> other objects should go invalid.
>>
>> I tried holding a persistent.WeakRef whenever a reference was required.
>> However, the WeakRef seems to go invalid only after a GC on the db
>> (correct me if I am wrong).
>>
>> The other approach seems to be to use IObjectWillBeRemovedEvent at the
>> site of the referencing object, to act accordingly.
>>
>> How do other people deal with this?
>>
>> --
>> Joe Steeve
>> HiPro IT Solutions Private Limited
>> http://hipro.co.in/
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "pylons-discuss" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/pylons-discuss/1461224218.20052.19.camel%40hipro.co.in
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "pylons-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pylons-discuss/CAGZ7LV9-rkNSO2eAVu0uEJEHgJY6_A7PSW8isCqjV2K_THyCXQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/pylons-discuss/CAGZ7LV9-rkNSO2eAVu0uEJEHgJY6_A7PSW8isCqjV2K_THyCXQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
http://www.imagesdusport.com -- http://www.ztfy.org

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWCMyL8ER75_7Dng45Y4wKk%2BiNYcMoAsPk%2BDCkmZ1E5S%2BQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to