[Zope3-dev] Persistent module notes and proposal

Steve Alexander steve at z3u.com
Sat Jan 3 19:24:55 EST 2004


> One particular issue has to do with the scope of persistent modules.
> I propose that, at least for Zope 3, persistent modules should contain
> only software and that the state of persistent modules should be fully
> expressed by their source. This implied that persistent modules in Zope 3
> should not contain any objects that are mutated outside of the execution
> of the modules, such as registries, counters, etc.

This doesn't sound like such a bad restriction. There are still various 
options for a registry in a persistent module. The state of the registry 
can be fully represented in the source code of the module.

I wonder if there's a straightforward way for a persistent module to 
have access to a ZODB connection, or the ZODB root object, or the 
persistent module object?

   from zodb.code import get_connection, get_root, get_module

   def some_function():
       connection = get_connection()
       # do something with the connection

       root = get_root()
       # we can traverse to some object from the root

       this_module = get_module()
       # we could get something relative to this
       # module's zodb representation


On a different subject, would it be possible to support renaming classes 
and interfaces within a persistent module without needing to walk the 
database updating persistent objects?  Perhaps some sort of option when 
updating the code in a persistent module that maps old names to new ones?

--
Steve Alexander




More information about the Zope3-dev mailing list