[Zope-Checkins] SVN: Zope/trunk/src/OFS/ObjectManager.py remove parent pointer while exporting
David Glick
davidglick at onenw.org
Fri Mar 11 09:53:59 EST 2011
Log message for revision 120865:
remove parent pointer while exporting
Changed:
U Zope/trunk/src/OFS/ObjectManager.py
-=-
Modified: Zope/trunk/src/OFS/ObjectManager.py
===================================================================
--- Zope/trunk/src/OFS/ObjectManager.py 2011-03-11 14:48:34 UTC (rev 120864)
+++ Zope/trunk/src/OFS/ObjectManager.py 2011-03-11 14:53:59 UTC (rev 120865)
@@ -22,6 +22,7 @@
import os
import re
import sys
+import transaction
from AccessControl import ClassSecurityInfo
from AccessControl.class_init import InitializeClass
@@ -584,11 +585,25 @@
cfg = getConfiguration()
f = os.path.join(cfg.clienthome, '%s.%s' % (id, suffix))
- if toxml:
- exportXML(ob._p_jar, ob._p_oid, f)
- else:
- ob._p_jar.exportFile(ob._p_oid, f)
+ ob = aq_base(ob)
+ parent = getattr(ob, '__parent__', _marker)
+ if parent is not _marker:
+ sp = transaction.savepoint(True)
+ del ob.__parent__
+ # create a savepoint so that the export includes the version
+ # without a __parent__ pointer
+ transaction.savepoint(True)
+ try:
+ if toxml:
+ exportXML(ob._p_jar, ob._p_oid, f)
+ else:
+ ob._p_jar.exportFile(ob._p_oid, f)
+ finally:
+ if parent is not _marker:
+ # roll back so that we don't actually remove the __parent__
+ sp.rollback()
+
if REQUEST is not None:
return self.manage_main(self, REQUEST,
manage_tabs_message=
More information about the Zope-Checkins
mailing list