[ZODB-Dev] Adopting ZODB
Christian Theune
ct at gocept.com
Thu Jul 13 16:22:51 EDT 2006
David Binger wrote:
>
> On Jul 13, 2006, at 12:55 PM, Chris S wrote:
>
>>>
>>> You can always persist (almost) any object, even if it does not subclass
>>> from Persistent. However, any changes to the object will not be detected
>>> automatically and you would have to either a) reassign the object to the
>>> ZODB or b) mark it as changed using _p_changed()
>>>
>>> Christian
>>
>> 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.
In any case he is still right: If it doesn't inherit from Persistent,
then _p_changed doesn't matter. What you would have to do is do
_p_changed on the "parent" object which inherits Persistent. At least if
I'm not mistaken again.
Christian
--
gocept gmbh & co. kg - forsterstraße 29 - 06112 halle/saale - germany
www.gocept.com - ct at gocept.com - phone +49 345 122 9889 7 -
fax +49 345 122 9889 1 - zope and plone consulting and development
More information about the ZODB-Dev
mailing list