[ZODB-Dev] Can I abort part of a transaction setting
self._p_changed=0 ?
Shane Hathaway
shane@digicool.com
Thu, 28 Jun 2001 21:14:40 -0400
Steve Spicklemire wrote:
> One of the problems with ZCVSFolder is containerish objects (e.g.,
> Folder, Specialist, etc). In Zope, these are all basically subclasses of
> ObjectManager. The problem is that if you want to commit a subclass of
> ObjectManager you get not only it's meta_data, but also its contents. My
> idea is to set up a system that essentially does:
>
> def CommitMetaDataOfObjectManager(self, anObjectManager):
>
> holder = anObjectManager._objects
> delete anObjectManager._objects
> result = self.CommitObject(anObjectManager)
> anObjectManager._objects = holder
> return result
>
> so that the 'committed' objectManager is stripped of it's objects,
> committed, and then it's objects are restored. (it would be great if
> ObjectManager could present an interface that did that!). The problem is
> that fiddling with _objects will set the _p_changed flag and introduce
> an unwanted side effect of updating ZODB. Can I force _p_changed=0?
> Would that make this a thinkable possibility?
The act of modifying a persistent object or setting _p_changed to 1
causes cPersistence to register the object with the transaction manager
to be written, so by the time you set _p_changed to 0 it's too late.
I don't have a good solution for you, so I didn't reply earlier, hoping
someone else might.
Shane