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

Jim Fulton jim at zope.com
Thu Apr 30 18:10:41 EDT 2009


On Apr 30, 2009, at 5:01 PM, 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"?

No

> The flag would disallow the creation of
> cross-database references for a given DB -- independent of whether the
> app is new or old, right?

Right

> Only depending on whether the application uses
> a ZODB that has the feature and has it enabled. Right?

This is not a sentence. :)

The flag would disable implicit references (new or old).  When an  
object is being saved, if it has implicit cross-references, the save  
will fail.  The second and third bullets above provide a way to make  
explicit references.  I've implemented the first bullet.  There's a  
question of whether I need to implement the second 2 bullets for ZODB  
3.9.

Jim

--
Jim Fulton
Zope Corporation




More information about the ZODB-Dev mailing list