[Zope3-Users] OOBTree instances lose attributes upon restart

Garanin Michael garanin at m-lan.ru
Fri Apr 6 04:19:43 EDT 2007


Douglas Douglas wrote:
> Hi everyone.
>
> I've been fighting with this for a while now. So I mail the list for a
> suggestion.
>
> I have a `Variable` class wich I subclass from OOBTree, because I need a
> dictionary with the min, max options that OOBTree methods give. My object is
> supposed to store datetime.datetime instances as keys and floats numbers as
> values. eg: temperature[datetime(2007, 4, 6, 12, 8)] = 25.8
>
> I didn't use BTreeContainer because only takes strings as keys, and I don't
> want to map datetime to strings and back.
>
> Here's my class definition:
>
> class Variable(OOBTree, Contained):
>
>     implements(IVariable, IAttributeAnnotatable)
>
>     name = None
>     units = None
>
>   
class Variable(Persistent, Contained):
      def __init__(self):
             self.__mydata = OOBTree()
    
     def keys(self, min, max ....):
            return self.__mydata.keys(min, max, ....)


For example see implementations in  "zope/app/container/sample.py"


More information about the Zope3-users mailing list