[Zope3-Users] OOBTree instances lose attributes upon restart

Douglas Douglas replaceafill at yahoo.com
Fri Apr 6 03:53:06 EDT 2007


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

I start the server and everything works like a charm. My AddForm works OK for
the Variable class. I checked its create() method (with assert statements) and
the returned instances contain the name and units attributes set from the form.

But if I stop the server and restart later, my data (datetimes and floats) are
still there, but my name and units attributes are None!!

I tried to subclass from (OOBTree, Persistent, Contained) too, and it didn't
work either.

If I subclass only from (PersistentDict) everything works. Data and attributes
are mantained upon restart, but I lose the min, max functionality I like :(

What could be the problem or a possible solution to this issue?

Thanks.


 
____________________________________________________________________________________
Looking for earth-friendly autos? 
Browse Top Cars by "Green Rating" at Yahoo! Autos' Green Center.
http://autos.yahoo.com/green_center/


More information about the Zope3-users mailing list