[ZODB-Dev] Re: [Zope3-dev] Persistent module notes and proposal

Jim Fulton jim at zope.com
Mon Jan 5 13:57:38 EST 2004


Casey Duncan wrote:
> On Mon, 05 Jan 2004 20:17:42 +0200
> Steve Alexander <steve at z3u.com> wrote:
> 
> 
>>>>This certainly sounds reasonable. We need to make sure this is
>>>>enforced at some level though, preferrably through software (disallowing
>>>>mutating globals in the module somehow) or at least through very strong
>>>>documentation (such as a comment at the top of the module that appears
>>>>by default or an electrostatic charge administered to the chair of the
>>>>respective programmmer). Otherwise I sense an endless barrage of newbie
>>>>FAQs re this in our future...
>>>
>>>
>>>Surely we can replace the __dict__ of the PM with something "frozen", 
>>>thawing it only when recompiling the source.  I wouldn't want anything 
>>>"advisory" at all, here;  that would be just a bug magnet (FAQs too).
>>
>>I don't see how this will help.
>>
>>Here's an example of a registry:
>>
>>   # this is the base level of indentation for the module
>>
>>   foo = FooRegistry()
>>
>>   foo.register('bar')
>>
>>   def register_something(thing):
>>       foo.register(thing)
>>
>>
>>The registry itself will be changing, although its name in the module 
>>will not be rebound.
> 
> 
> Hopefully if FooRegistry is itself a persistent object this would be ok? 
 > This does not mutate the module at all.

The point is that it's module state that is not reflected by the module
source.

If we synchronize the module to the file system, using only the module
source, and then sync it back, the registry data will be lost.

> I agree with Tres that this rule should be strongly enforced.
 > I am somewhat surprised that it would need to be a Zope-specific feature
 > though.
 >
 > What makes it any more workable anywhere else?
> Sounds like unecessary complication to create a Zope specific
 > restriction when no-one has demanded anything different outside of Zope.
 > I strongly suggest we should not prematurely generalize policies outside
 > of Zope until some real users and use-cases show up demanding it.

It's largely driven by file-system synchronization.  Applications that
don't use synchronization wouldn't need the restriction.

Jim

-- 
Jim Fulton           mailto:jim at zope.com       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org




More information about the ZODB-Dev mailing list