[ZODB-Dev] Adopting ZODB

Chris S chrisspen at gmail.com
Thu Jul 13 15:55:53 EDT 2006


On 7/13/06, David Binger <dbinger at mems-exchange.org> wrote:
>
> On Jul 13, 2006, at 1:35 PM, Chris S wrote:
>
> > On 7/13/06, David Binger <dbinger at mems-exchange.org> wrote:
> >>
> >> On Jul 13, 2006, at 12:55 PM, Chris S wrote:
> >>
> >> > I don't think this is the case. Consider my simple example
> >> below. None
> >> > of my classes inherit Persistent, and even though I set
> >> _p_changed =
> >> > 1, nothing's persisted.
> >>
> >> In your example, it seems like there is a missing
> >> root['bob'] = User('bob')
> >> transaction.commit()
> >> to get things started.
> >
> > That would overwrite my User with a new instance each run, defeating
> > the purpose of persistence.
> >
> > The line:
> > parent = root.get(parentName, User(parentName))
> > initializes things if the user was not yet created.
> >
> > Chris
>
> Okay, but the thing that is missing is any assignment to the root
> instance
> or any instance of Persistent.
> I think that is necessary.

Uh, calling root.get(name, obj) assigns obj to the root if the name is
not yet defined. And of course I'm not assigning to any other
Persistent instances, since the point of the code was to show that
Zope can't persist objects that don't inherit the Persistent class.

Chris


More information about the ZODB-Dev mailing list