[ZODB-Dev] Proposal (version 2): cross database reference seat belt

Laurence Rowe l at lrowe.co.uk
Thu Apr 30 18:05:12 EDT 2009


Christian Theune wrote:
> Hi,
> 
> On Tue, 2009-04-28 at 13:54 -0400, Jim Fulton wrote:
>> Thanks again!
>>
>> (Note to everyone else, Shane and I discussed this on IRC, along with  
>> another alternative that I'll mention below.)
>>
>> I like version 2 better than version 1.  I'd be inclined to simplify  
>> and it and skip the configuration flag and simply publish an event any  
>> time we see a cross-database reference when saving an object.
>>
>> Here's proposed solution 3. :)
>>
>> - We add a flag to disable new cross-database references unless they  
>> are explicitly registered.
>> - We add a connection method to register a reference:
>>
>>       def registerCrossDatabaseReference(from_, to):
>>             "Register a new cross-database reference from from_ to to."
>>
>> - We arrange that connections can recognize old cross-database  
>> references.
>>
>> If someone accidentally creates a new reference and the flag is set,  
>> then transaction will be aborted.
>>
>> An interim step, if we're in a hurry to get 3.9 out, is to simply add  
>> the flag.  This would disallow cross-database references in new  
>> applications.  These applications could still support multiple  
>> databases by providing application-level traversal across databases.
> 
> I think I'm reading something incorrectly: is there an emphasis on
> "*new* applications"? The flag would disallow the creation of
> cross-database references for a given DB -- independent of whether the
> app is new or old, right? Only depending on whether the application uses
> a ZODB that has the feature and has it enabled. Right?

I think the emphasis was on new versus existing cross-database references.

Laurence



More information about the ZODB-Dev mailing list