Skip to content

Commit

Permalink
Remove broken xml-export/import. Keep zexp-export/import.
Browse files Browse the repository at this point in the history
  • Loading branch information
pbauer authored and mauritsvanrees committed Feb 4, 2017
1 parent c40714a commit 630a816
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 1,142 deletions.
3 changes: 3 additions & 0 deletions CHANGES.rst
Expand Up @@ -82,6 +82,9 @@ Features Added
Restructuring
+++++++++++++

- Removed xml-export.
[maurits, pbauer]

- Add back ZCacheable support.

- Update to zope.testbrowser 5.0 and its WebTest based implementation.
Expand Down
25 changes: 6 additions & 19 deletions src/OFS/ObjectManager.py
Expand Up @@ -61,9 +61,6 @@
from OFS.event import ObjectWillBeRemovedEvent
from OFS.Lockable import LockableItem
from OFS.subscribers import compatibilityCall
from OFS.XMLExportImport import importXML
from OFS.XMLExportImport import exportXML
from OFS.XMLExportImport import magic

import collections

Expand All @@ -86,10 +83,7 @@
# the name BadRequestException is relied upon by 3rd-party code
BadRequestException = BadRequest

customImporters={magic: importXML,
}

bad_id=re.compile(r'[^a-zA-Z0-9-_~,.$\(\)# @]').search
bad_id = re.compile(r'[^a-zA-Z0-9-_~,.$\(\)# @]').search

def checkValidId(self, id, allow_dup=0):
# If allow_dup is false, an error will be raised if an object
Expand Down Expand Up @@ -578,7 +572,7 @@ def tpValues(self):
return r

security.declareProtected(import_export_objects, 'manage_exportObject')
def manage_exportObject(self, id='', download=None, toxml=None,
def manage_exportObject(self, id='', download=None,
RESPONSE=None,REQUEST=None):
"""Exports an object to a file and returns that file."""
if not id:
Expand All @@ -588,14 +582,11 @@ def manage_exportObject(self, id='', download=None, toxml=None,
ob=self
else: ob=self._getOb(id)

suffix=toxml and 'xml' or 'zexp'
suffix = 'zexp'

if download:
f=StringIO()
if toxml:
exportXML(ob._p_jar, ob._p_oid, f)
else:
ob._p_jar.exportFile(ob._p_oid, f)
ob._p_jar.exportFile(ob._p_oid, f)
if RESPONSE is not None:
RESPONSE.setHeader('Content-type','application/data')
RESPONSE.setHeader('Content-Disposition',
Expand All @@ -604,10 +595,7 @@ def manage_exportObject(self, id='', download=None, toxml=None,

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._p_jar.exportFile(ob._p_oid, f)

if REQUEST is not None:
return self.manage_main(self, REQUEST,
Expand Down Expand Up @@ -651,8 +639,7 @@ def _importObjectFromFile(self, filepath, verify=1, set_owner=1):
while connection is None:
obj=obj.aq_parent
connection=obj._p_jar
ob=connection.importFile(
filepath, customImporters=customImporters)
ob=connection.importFile(filepath)
if verify: self._verifyObjectPaste(ob, validate_src=0)
id=ob.id
if hasattr(id, 'im_func'): id=id()
Expand Down
124 changes: 0 additions & 124 deletions src/OFS/XMLExportImport.py

This file was deleted.

36 changes: 11 additions & 25 deletions src/OFS/dtml/importExport.dtml
Expand Up @@ -5,13 +5,13 @@
You can export Zope objects to a file in order to transfer
them to a different Zope installation. You can either choose
to download the export file to your local machine, or save it
in the "var" directory of your Zope installation
on the server.
in the "var" directory of your Zope installation
on the server.
<br/>
<br/>
<b>Note:</b>
Zope can export/import objects in two different formats: a binary format (called
ZEXP) and as XML. The ZEXP format is the officially supported export/import
Zope can export/import objects in a binary format (called
ZEXP). The ZEXP format is the officially supported export/import
format for moving data between <u>identical</u> Zope installations (it is not a migration tool).
</p>

Expand All @@ -26,7 +26,7 @@ format for moving data between <u>identical</u> Zope installations (it is not a
<td align="left" valign="top">
<input type="text" name="id" size="25" value="<dtml-if ids><dtml-var "ids[0]" html_quote></dtml-if>" class="form-element"/>
</td>
</tr>
</tr>
<tr>
<td align="left" valign="top">
<div class="form-label">
Expand All @@ -46,20 +46,6 @@ format for moving data between <u>identical</u> Zope installations (it is not a
</label>
</div>
</td>
</tr>
<tr>
<td align="left" valign="top">
&nbsp;
</td>
<td align="left" valign="top">
<div class="form-text">
<label for="toxml">
<input type="checkbox" id="toxml" name="toxml" value="Y" />
XML format?
</label>
<em>(unsupported, see above)</em>
</div>
</td>
</tr>
<tr>
<td></td>
Expand All @@ -77,15 +63,15 @@ format for moving data between <u>identical</u> Zope installations (it is not a
<p class="form-help">
You may import Zope objects which have been previously
exported to a file, by placing the file in the &quot;import&quot;
directory of your Zope installation on the server. You should create
the &quot;import&quot; directory in the root of your Zope installation
directory of your Zope installation on the server. You should create
the &quot;import&quot; directory in the root of your Zope installation
if it does not yet exist.
</p>

<p class="form-help">
Note that by default, you will become the owner of the objects
that you are importing. If you wish the imported objects to retain
their existing ownership information, select "retain existing
Note that by default, you will become the owner of the objects
that you are importing. If you wish the imported objects to retain
their existing ownership information, select "retain existing
ownership information".
</p>

Expand Down Expand Up @@ -120,7 +106,7 @@ ownership information".
</label>
<br />
<label for="owner_retain">
<input type="radio" name="set_owner:int" value="0" id="owner_retain" />
<input type="radio" name="set_owner:int" value="0" id="owner_retain" />
Retain existing ownership information
</label>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/OFS/interfaces.py
Expand Up @@ -736,7 +736,7 @@ def tpValues():
"""Return a list of subobjects, used by tree tag.
"""

def manage_exportObject(id='', download=None, toxml=None,
def manage_exportObject(id='', download=None,
RESPONSE=None, REQUEST=None):
"""Exports an object to a file and returns that file."""

Expand Down

0 comments on commit 630a816

Please sign in to comment.