Objects in transaction-Object do not support absolute_url() (was: Re: [Zope] Catch Object Changes)

Holger Schmidt hs at keppler-it.de
Sun Dec 7 19:13:16 EST 2003


Hallo Dieter,

am Samstag, 6. Dezember 2003 um 19:41 schrieben Sie:

DM> Holger Schmidt wrote at 2003-12-6 11:35 +0100:
>> ...
>>DM> Again:
>>
>>DM>   Objects registering with the transaction are the bare (not acquisition
>>DM>   wrapped) objects. They know nothing about the context in which
>>DM>   they are used -- unless someone coded such knowledge into some
>>DM>   of their attributes (the "id", a "_v_" attribute as Casey suggests,
>>DM>   a "path" attribute...).
>>
>>
>>Sorry, I did not express myself clean:
>>
>>How does Zope know where in the ZODB it has to commit the object changes?

DM> Each object has an object id ("_p_oid" attribute).

DM> The storage maintains a mapping "oid --> pickle" (where pickle is
DM> the object state + class info).

DM> Persistent references contain the "oid" (and usually class info)
DM> such that the corresponding object state can be loaded on demand.

>>Does Zope (the transaction) know something about the "old-version"
>>object (before the commit...)?

DM> Yes:

DM>   A connection has the method "oldstate".
DM>   It has an "object" and a "serial" (a timestamp") as arguments.
DM>   "obj._p_jar.oldstate(obj, obj._p_serial)" returns the
DM>   state as it was when the object was loaded from the storage.
DM>   This requires that "obj" was not newly created in this
DM>   transaction (then "obj._p_serial" will be "None" and "oldstate"
DM>   will fail).
 
>>Does it overwrite the "old-version" object, or is there a kind of
>>versioning system ...?

DM> You should read the "ZODB3" documentation...

>>Is there a chance to get and use the old version of the object to get
>>the path of the modified object...?

DM> You can get the old version but at this level there are no paths,
DM> neither in the current nor in the historic versions.

I just tried to compare the objects of my list to the changed object
via the absolute_url()-method ... seems not to be possible easily ;)

can I compare my list of objects to the changed object via the
obj._p_oid-Attribute?
Does this Attribute change anytime ...?

Or is there any other attribute i could (and perhaps should) better
use instead?


-- 
Thanks,
Holger







More information about the Zope mailing list