Commit 7688557b authored by David Glick's avatar David Glick

remove parent pointer while exporting

parent a946e2e9
...@@ -22,6 +22,7 @@ import marshal ...@@ -22,6 +22,7 @@ import marshal
import os import os
import re import re
import sys import sys
import transaction
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from AccessControl.class_init import InitializeClass from AccessControl.class_init import InitializeClass
...@@ -584,10 +585,24 @@ class ObjectManager(CopyContainer, ...@@ -584,10 +585,24 @@ class ObjectManager(CopyContainer,
cfg = getConfiguration() cfg = getConfiguration()
f = os.path.join(cfg.clienthome, '%s.%s' % (id, suffix)) f = os.path.join(cfg.clienthome, '%s.%s' % (id, suffix))
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: if toxml:
exportXML(ob._p_jar, ob._p_oid, f) exportXML(ob._p_jar, ob._p_oid, f)
else: else:
ob._p_jar.exportFile(ob._p_oid, f) 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: if REQUEST is not None:
return self.manage_main(self, REQUEST, return self.manage_main(self, REQUEST,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment