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
082807aa
Commit
082807aa
authored
Feb 16, 2010
by
Tres Seaver
Browse files
Options
Browse Files
Download
Plain Diff
LP #195761: fixed ZMI XML export / import and restored it to the UI.
parents
3bc19628
62b5578e
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
778 additions
and
454 deletions
+778
-454
doc/CHANGES.txt
doc/CHANGES.txt
+6
-0
lib/python/OFS/XMLExportImport.py
lib/python/OFS/XMLExportImport.py
+5
-3
lib/python/OFS/dtml/importExport.dtml
lib/python/OFS/dtml/importExport.dtml
+1
-3
lib/python/OFS/tests/export.xml
lib/python/OFS/tests/export.xml
+344
-0
lib/python/OFS/tests/test_XMLExportImport.py
lib/python/OFS/tests/test_XMLExportImport.py
+79
-1
lib/python/Shared/DC/xml/ppml.py
lib/python/Shared/DC/xml/ppml.py
+343
-447
No files found.
doc/CHANGES.txt
View file @
082807aa
...
@@ -4,6 +4,12 @@ Zope Changes
...
@@ -4,6 +4,12 @@ Zope Changes
Change information for previous versions of Zope can be found in the
Change information for previous versions of Zope can be found in the
file HISTORY.txt.
file HISTORY.txt.
Zope 2.10.12 (unreleased)
Bugs fixed
- LP #195761: fixed ZMI XML export / import and restored it to the UI.
Zope 2.10.11 (2010/01/12)
Zope 2.10.11 (2010/01/12)
Bugs fixed
Bugs fixed
...
...
lib/python/OFS/XMLExportImport.py
View file @
082807aa
...
@@ -14,6 +14,8 @@ from base64 import encodestring
...
@@ -14,6 +14,8 @@ from base64 import encodestring
from
cStringIO
import
StringIO
from
cStringIO
import
StringIO
from
ZODB.serialize
import
referencesf
from
ZODB.serialize
import
referencesf
from
ZODB.ExportImport
import
TemporaryFile
,
export_end_marker
from
ZODB.ExportImport
import
TemporaryFile
,
export_end_marker
from
ZODB.utils
import
p64
from
ZODB.utils
import
u64
from
Shared.DC.xml
import
ppml
from
Shared.DC.xml
import
ppml
...
@@ -23,7 +25,7 @@ def XMLrecord(oid, len, p):
...
@@ -23,7 +25,7 @@ def XMLrecord(oid, len, p):
q
=
ppml
.
ToXMLUnpickler
q
=
ppml
.
ToXMLUnpickler
f
=
StringIO
(
p
)
f
=
StringIO
(
p
)
u
=
q
(
f
)
u
=
q
(
f
)
id
=
ppml
.
u64
(
oid
)
id
=
u64
(
oid
)
aka
=
encodestring
(
oid
)[:
-
1
]
aka
=
encodestring
(
oid
)[:
-
1
]
u
.
idprefix
=
str
(
id
)
+
'.'
u
.
idprefix
=
str
(
id
)
+
'.'
p
=
u
.
load
().
__str__
(
4
)
p
=
u
.
load
().
__str__
(
4
)
...
@@ -87,11 +89,11 @@ def save_record(parser, tag, data):
...
@@ -87,11 +89,11 @@ def save_record(parser, tag, data):
file
.
seek
(
pos
)
file
.
seek
(
pos
)
a
=
data
[
1
]
a
=
data
[
1
]
if
a
.
has_key
(
'id'
):
oid
=
a
[
'id'
]
if
a
.
has_key
(
'id'
):
oid
=
a
[
'id'
]
oid
=
p
pml
.
p
64
(
int
(
oid
))
oid
=
p64
(
int
(
oid
))
v
=
''
v
=
''
for
x
in
data
[
2
:]:
for
x
in
data
[
2
:]:
v
=
v
+
x
v
=
v
+
x
l
=
p
pml
.
p
64
(
len
(
v
))
l
=
p64
(
len
(
v
))
v
=
oid
+
l
+
v
v
=
oid
+
l
+
v
return
v
return
v
...
...
lib/python/OFS/dtml/importExport.dtml
View file @
082807aa
...
@@ -13,11 +13,9 @@ on the server.
...
@@ -13,11 +13,9 @@ on the server.
<br/>
<br/>
<br/>
<br/>
<b>Note:</b>
<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
ZEXP) and as XML. The ZEXP format is the officially supported export/import
format for moving data between <u>identicial</u> Zope installations (it is not a migration tool).
format for moving data between <u>identicial</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>
</p>
<form action="manage_exportObject" method="post">
<form action="manage_exportObject" method="post">
...
...
lib/python/OFS/tests/export.xml
0 → 100644
View file @
082807aa
This diff is collapsed.
Click to expand it.
lib/python/OFS/tests/test_XMLExportImport.py
View file @
082807aa
# -*- coding: iso8859-1 -*-
##############################################################################
##############################################################################
#
#
# Copyright (c) 2006 Zope Corporation and Contributors. All Rights Reserved.
# Copyright (c) 2006 Zope Corporation and Contributors. All Rights Reserved.
...
@@ -16,7 +17,15 @@ import tempfile
...
@@ -16,7 +17,15 @@ import tempfile
import
transaction
import
transaction
from
StringIO
import
StringIO
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
):
class
XMLExportImportTests
(
unittest
.
TestCase
):
...
@@ -112,6 +121,75 @@ class XMLExportImportTests(unittest.TestCase):
...
@@ -112,6 +121,75 @@ class XMLExportImportTests(unittest.TestCase):
# the block above.
# the block above.
os
.
remove
(
path
)
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
():
def
test_suite
():
return
unittest
.
TestSuite
((
return
unittest
.
TestSuite
((
unittest
.
makeSuite
(
XMLExportImportTests
),
unittest
.
makeSuite
(
XMLExportImportTests
),
...
...
lib/python/Shared/DC/xml/ppml.py
View file @
082807aa
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