Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
147bdfb2
Commit
147bdfb2
authored
Feb 15, 2010
by
Tres Seaver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
LP #195761: fixed ZMI XML export / import and restored it to the UI.
parent
d6ac004f
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
774 additions
and
458 deletions
+774
-458
doc/CHANGES.rst
doc/CHANGES.rst
+2
-0
src/OFS/XMLExportImport.py
src/OFS/XMLExportImport.py
+5
-3
src/OFS/dtml/importExport.dtml
src/OFS/dtml/importExport.dtml
+1
-7
src/OFS/tests/export.xml
src/OFS/tests/export.xml
+344
-0
src/OFS/tests/test_XMLExportImport.py
src/OFS/tests/test_XMLExportImport.py
+79
-1
src/Shared/DC/xml/ppml.py
src/Shared/DC/xml/ppml.py
+343
-447
No files found.
doc/CHANGES.rst
View file @
147bdfb2
...
...
@@ -20,6 +20,8 @@ Features Added
Bugs Fixed
++++++++++
- LP #195761: fixed ZMI XML export / import and restored it to the UI.
- MailHost should fall back to HELO when EHLO fails.
Zope 2.12.3 (2010/01/12)
...
...
src/OFS/XMLExportImport.py
View file @
147bdfb2
...
...
@@ -14,6 +14,8 @@ from base64 import encodestring
from
cStringIO
import
StringIO
from
ZODB.serialize
import
referencesf
from
ZODB.ExportImport
import
TemporaryFile
,
export_end_marker
from
ZODB.utils
import
p64
from
ZODB.utils
import
u64
from
Shared.DC.xml
import
ppml
...
...
@@ -23,7 +25,7 @@ def XMLrecord(oid, len, p):
q
=
ppml
.
ToXMLUnpickler
f
=
StringIO
(
p
)
u
=
q
(
f
)
id
=
ppml
.
u64
(
oid
)
id
=
u64
(
oid
)
aka
=
encodestring
(
oid
)[:
-
1
]
u
.
idprefix
=
str
(
id
)
+
'.'
p
=
u
.
load
().
__str__
(
4
)
...
...
@@ -93,11 +95,11 @@ def save_record(parser, tag, data):
file
.
seek
(
pos
)
a
=
data
[
1
]
if
a
.
has_key
(
'id'
):
oid
=
a
[
'id'
]
oid
=
p
pml
.
p
64
(
int
(
oid
))
oid
=
p64
(
int
(
oid
))
v
=
''
for
x
in
data
[
2
:]:
v
=
v
+
x
l
=
p
pml
.
p
64
(
len
(
v
))
l
=
p64
(
len
(
v
))
v
=
oid
+
l
+
v
return
v
...
...
src/OFS/dtml/importExport.dtml
View file @
147bdfb2
...
...
@@ -10,16 +10,12 @@ 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.
<!--
<br/>
<br/>
<b>Note:</b>
Zope can export/import objects in two dfferent formats: a binary format (called
Zope can export/import objects in two d
i
fferent formats: a binary format (called
ZEXP) and as XML. 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).
The XML export/import is unsupported (and possibly broken under certain circumstances) - use it
at your own risk.
-->
</p>
<form action="manage_exportObject" method="post">
...
...
@@ -54,7 +50,6 @@ at your own risk.
</div>
</td>
</tr>
<!--
<tr>
<td align="left" valign="top">
...
...
@@ -69,7 +64,6 @@ at your own risk.
</div>
</td>
</tr>
-->
<tr>
<td></td>
<td align="left" valign="top">
...
...
src/OFS/tests/export.xml
0 → 100644
View file @
147bdfb2
This diff is collapsed.
Click to expand it.
src/OFS/tests/test_XMLExportImport.py
View file @
147bdfb2
# -*- coding: iso8859-1 -*-
##############################################################################
#
# Copyright (c) 2006 Zope Corporation and Contributors. All Rights Reserved.
...
...
@@ -16,7 +17,15 @@ import tempfile
import
transaction
from
StringIO
import
StringIO
_LONG_DTML
=
'
\
n
'
.
join
([(
'<dtml-var foo%d'
%
x
)
for
x
in
xrange
(
1000
)])
try
:
here
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
except
:
here
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
sys
.
argv
[
0
]))
imagedata
=
os
.
path
.
join
(
here
,
'test.gif'
)
xmldata
=
os
.
path
.
join
(
here
,
'export.xml'
)
_LONG_DTML
=
''
.
join
([(
'<dtml-var foo%d'
%
x
)
for
x
in
xrange
(
1000
)])
class
XMLExportImportTests
(
unittest
.
TestCase
):
...
...
@@ -112,6 +121,75 @@ class XMLExportImportTests(unittest.TestCase):
# the block above.
os
.
remove
(
path
)
def
test_exportXML
(
self
):
from
OFS.Folder
import
Folder
from
OFS.Image
import
Image
from
OFS.XMLExportImport
import
exportXML
connection
,
app
=
self
.
_makeJarAndRoot
()
data
=
open
(
imagedata
,
'rb'
)
sub
=
Folder
(
'sub'
)
app
.
_setObject
(
'sub'
,
sub
)
img
=
Image
(
'image'
,
''
,
data
,
'image/gif'
)
sub
.
_setObject
(
'image'
,
img
)
img
.
_setProperty
(
'prop1'
,
3.14159265359
,
'float'
)
img
.
_setProperty
(
'prop2'
,
1
,
'int'
)
img
.
_setProperty
(
'prop3'
,
2L
**
31
-
1
,
'long'
)
img
.
_setProperty
(
'prop4'
,
'xxx'
,
'string'
)
img
.
_setProperty
(
'prop5'
,
[
'xxx'
,
'zzz'
],
'lines'
)
img
.
_setProperty
(
'prop6'
,
u'xxx'
,
'unicode'
)
img
.
_setProperty
(
'prop7'
,
[
u'xxx'
,
u'zzz'
],
'ulines'
)
img
.
_setProperty
(
'prop8'
,
'<&>'
,
'string'
)
img
.
_setProperty
(
'prop9'
,
u'<&>'
,
'unicode'
)
img
.
_setProperty
(
'prop10'
,
'<]]>'
,
'string'
)
img
.
_setProperty
(
'prop11'
,
u'<]]>'
,
'unicode'
)
img
.
_setProperty
(
'prop12'
,
u''
,
'unicode'
)
transaction
.
savepoint
(
optimistic
=
True
)
oid
=
sub
.
_p_oid
handle
,
path
=
tempfile
.
mkstemp
(
suffix
=
'.xml'
)
try
:
ostream
=
os
.
fdopen
(
handle
,
'wb'
)
data
=
exportXML
(
connection
,
oid
,
ostream
)
ostream
.
close
()
finally
:
os
.
remove
(
path
)
def
test_importXML
(
self
):
from
OFS.XMLExportImport
import
importXML
connection
,
app
=
self
.
_makeJarAndRoot
()
newobj
=
importXML
(
connection
,
xmldata
)
img
=
newobj
.
_getOb
(
'image'
)
data
=
open
(
imagedata
,
'rb'
).
read
()
self
.
assertEqual
(
img
.
data
,
data
)
self
.
assertEqual
(
repr
(
img
.
getProperty
(
'prop1'
)),
repr
(
3.14159265359
))
self
.
assertEqual
(
repr
(
img
.
getProperty
(
'prop2'
)),
repr
(
1
))
self
.
assertEqual
(
repr
(
img
.
getProperty
(
'prop3'
)),
repr
(
2L
**
31
-
1
))
self
.
assertEqual
(
repr
(
img
.
getProperty
(
'prop4'
)),
repr
(
'xxx'
))
self
.
assertEqual
(
repr
(
img
.
getProperty
(
'prop5'
)),
repr
((
'xxx'
,
'zzz'
)))
self
.
assertEqual
(
repr
(
img
.
getProperty
(
'prop6'
)),
repr
(
u'xxx'
))
self
.
assertEqual
(
repr
(
img
.
getProperty
(
'prop7'
)),
repr
((
u'xxx'
,
u'zzz'
)))
self
.
assertEqual
(
repr
(
img
.
getProperty
(
'prop8'
)),
repr
(
'<&>'
))
self
.
assertEqual
(
repr
(
img
.
getProperty
(
'prop9'
)),
repr
(
u'<&>'
))
self
.
assertEqual
(
repr
(
img
.
getProperty
(
'prop10'
)),
repr
(
'<]]>'
))
self
.
assertEqual
(
repr
(
img
.
getProperty
(
'prop11'
)),
repr
(
u'<]]>'
))
self
.
assertEqual
(
repr
(
img
.
getProperty
(
'prop12'
)),
repr
(
u''
))
def
test_suite
():
return
unittest
.
TestSuite
((
unittest
.
makeSuite
(
XMLExportImportTests
),
...
...
src/Shared/DC/xml/ppml.py
View file @
147bdfb2
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment