Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
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
Eugene Shen
erp5
Commits
12e2ec98
Commit
12e2ec98
authored
Jun 24, 2016
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ERP5Type: code clean-up
parent
dee51dcb
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
36 deletions
+4
-36
product/ERP5Type/XMLExportImport.py
product/ERP5Type/XMLExportImport.py
+3
-4
product/ERP5Type/patches/XMLExportImport.py
product/ERP5Type/patches/XMLExportImport.py
+1
-32
No files found.
product/ERP5Type/XMLExportImport.py
View file @
12e2ec98
...
@@ -56,10 +56,9 @@ class OrderedPickler(Pickler):
...
@@ -56,10 +56,9 @@ class OrderedPickler(Pickler):
else
:
# proto 0 -- can't use EMPTY_DICT
else
:
# proto 0 -- can't use EMPTY_DICT
write
(
MARK
+
DICT
)
write
(
MARK
+
DICT
)
self
.
memoize
(
obj
)
self
.
memoize
(
obj
)
key_list
=
obj
.
keys
()
item_list
=
obj
.
items
()
key_list
.
sort
()
# Order keys
item_list
.
sort
()
obj_items
=
map
(
lambda
x
:
(
x
,
obj
[
x
]),
key_list
)
# XXX Make it lazy in the future
self
.
_batch_setitems
(
iter
(
item_list
))
self
.
_batch_setitems
(
obj_items
)
dispatch
[
DictionaryType
]
=
save_dict
dispatch
[
DictionaryType
]
=
save_dict
if
not
PyStringMap
is
None
:
if
not
PyStringMap
is
None
:
...
...
product/ERP5Type/patches/XMLExportImport.py
View file @
12e2ec98
...
@@ -20,44 +20,13 @@ from base64 import encodestring
...
@@ -20,44 +20,13 @@ 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
from
ZODB.ExportImport
import
TemporaryFile
from
pickle
import
Pickler
,
EMPTY_DICT
,
MARK
,
DICT
from
cPickle
import
loads
,
dumps
from
types
import
TupleType
from
types
import
TupleType
from
types
import
StringType
from
types
import
DictionaryType
from
OFS
import
ObjectManager
,
XMLExportImport
from
OFS
import
ObjectManager
,
XMLExportImport
from
..XMLExportImport
import
OrderedPickler
from
logging
import
getLogger
from
logging
import
getLogger
log
=
getLogger
(
__name__
)
log
=
getLogger
(
__name__
)
# Jython has PyStringMap; it's a dict subclass with string keys
try
:
from
org.python.core
import
PyStringMap
except
ImportError
:
PyStringMap
=
None
# Ordered pickles
class
OrderedPickler
(
Pickler
):
dispatch
=
Pickler
.
dispatch
.
copy
()
def
save_dict
(
self
,
obj
):
write
=
self
.
write
if
self
.
bin
:
write
(
EMPTY_DICT
)
else
:
# proto 0 -- can't use EMPTY_DICT
write
(
MARK
+
DICT
)
self
.
memoize
(
obj
)
item_list
=
obj
.
items
()
# New version by JPS for sorting
item_list
.
sort
(
key
=
lambda
x
:
x
[
0
])
# New version by JPS for sorting
self
.
_batch_setitems
(
item_list
.
__iter__
())
dispatch
[
DictionaryType
]
=
save_dict
if
not
PyStringMap
is
None
:
dispatch
[
PyStringMap
]
=
save_dict
def
reorderPickle
(
jar
,
p
):
def
reorderPickle
(
jar
,
p
):
try
:
try
:
from
ZODB._compat
import
Unpickler
,
Pickler
from
ZODB._compat
import
Unpickler
,
Pickler
...
...
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