On Fri, Apr 06, 2007 at 12:53:06AM -0700, Douglas Douglas wrote:
> 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!!

OOBTree is at fault here.  I'm sure that if you investigated it, you'd
find a custom __getstate__.

I suggest that you do not subclass OOBTree but instead contain it in an
attribute and delegate all the methods.

    class Variable(Persistent, Contained):


        def __init__(self):
            self.data = OOBTree()

        def __getitem__(self, key):
            return self.data[key]


Marius Gedminas
I dont know about madness (and anyway, the little green martians dancing
around me tell me not to worry...), but I've implemented something not
unlike this just now.
        -- Peter Sabaini

Attachment: signature.asc
Description: Digital signature

Zope3-users mailing list

Reply via email to