[ZPatterns] Converting Rack to use BTrees

Steve Alexander steve@cat-box.net
Tue, 29 May 2001 18:35:56 +0100


Phillip, Ty,

I see that the ZPatterns in CVS still uses the old BTree library.

Making it use the new one looks as simple as changing Rack's
__writeableStorage method to look like this:

     def __writeableStorage(self):
         """Create new a mapping-like object for storing 'persistent'
            stuff and save it in self"""
         from BTrees.OOBTree import OOBTree
         s = self.__readableStorage = self.__writeableStorage = OOBTree()
         return s

Can you see any problems with this?

The only problem I can see is the use of len() in Rack.storageInUse().


Then, of course, you could also add a method to convert persistent Racks 
from the old-style BTree to the new BTrees, which would use 
BTrees/convert.py.

--
Steve Alexander
Software Engineer
Cat-Box limited