Commit d4a4df4e authored by Jim Fulton's avatar Jim Fulton

Split database XML export/import into separate module at Zope

application level, since it (currently) depends on Zope-specific,
rather than ZODB-specific code.
parent d4e841df
...@@ -84,9 +84,9 @@ ...@@ -84,9 +84,9 @@
############################################################################## ##############################################################################
__doc__="""Object Manager __doc__="""Object Manager
$Id: ObjectManager.py,v 1.101 2000/06/27 15:47:50 brian Exp $""" $Id: ObjectManager.py,v 1.102 2000/08/04 13:59:33 jim Exp $"""
__version__='$Revision: 1.101 $'[11:-2] __version__='$Revision: 1.102 $'[11:-2]
import App.Management, Acquisition, Globals, CopySupport, Products import App.Management, Acquisition, Globals, CopySupport, Products
import os, App.FactoryDispatcher, ts_regex, Products import os, App.FactoryDispatcher, ts_regex, Products
...@@ -102,6 +102,11 @@ from AccessControl import getSecurityManager ...@@ -102,6 +102,11 @@ from AccessControl import getSecurityManager
from zLOG import LOG, ERROR from zLOG import LOG, ERROR
import sys import sys
import XMLExportImport
customImporters={
XMLExportImport.magic: XMLExportImport.importXML,
}
bad_id=ts_regex.compile('[^a-zA-Z0-9-_~\,\. ]').search #TS bad_id=ts_regex.compile('[^a-zA-Z0-9-_~\,\. ]').search #TS
class BeforeDeleteException( Exception ): pass # raise to veto deletion class BeforeDeleteException( Exception ): pass # raise to veto deletion
...@@ -466,8 +471,10 @@ class ObjectManager( ...@@ -466,8 +471,10 @@ class ObjectManager(
return f.getvalue() return f.getvalue()
f=Globals.data_dir+'/%s.%s' % (id, suffix) f=Globals.data_dir+'/%s.%s' % (id, suffix)
if toxml: ob._p_jar.exportXML(ob._p_oid, f) if toxml:
else: ob._p_jar.exportFile(ob._p_oid, f) XMLExportImport.exportXML(ob._p_jar, ob._p_oid, f)
else:
ob._p_jar.exportFile(ob._p_oid, f)
if RESPONSE is not None: if RESPONSE is not None:
return MessageDialog( return MessageDialog(
...@@ -492,7 +499,8 @@ class ObjectManager( ...@@ -492,7 +499,8 @@ class ObjectManager(
while connection is None: while connection is None:
obj=obj.aq_parent obj=obj.aq_parent
connection=obj._p_jar connection=obj._p_jar
ob=connection.importFile(file) ob=connection.importFile(
file, customImporters=customImporters)
if REQUEST: self._verifyObjectPaste(ob, validate_src=0) if REQUEST: self._verifyObjectPaste(ob, validate_src=0)
id=ob.id id=ob.id
if hasattr(id, 'im_func'): id=id() if hasattr(id, 'im_func'): id=id()
......
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