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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Carlos Ramos Carreño
erp5
Commits
4f423de4
Commit
4f423de4
authored
Apr 01, 2024
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
XMLExportImport: more support pickle protocol 3
🚧
( repair python2 )
parent
184b66c8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
9 deletions
+11
-9
product/ERP5Type/XMLExportImport/ppml.py
product/ERP5Type/XMLExportImport/ppml.py
+11
-9
No files found.
product/ERP5Type/XMLExportImport/ppml.py
View file @
4f423de4
...
...
@@ -30,7 +30,7 @@ import re
from
marshal
import
loads
as
mloads
from
.xyap
import
NoBlanks
from
.xyap
import
xyap
from
Products.ERP5Type.Utils
import
str2bytes
from
Products.ERP5Type.Utils
import
str2bytes
,
bytes2str
from
marshal
import
dumps
as
mdumps
#from zLOG import LOG
...
...
@@ -94,7 +94,9 @@ def convert(S):
### readable output.
try
:
if
not
isinstance
(
S
,
six
.
text_type
):
S
=
S
.
decode
(
'utf8'
)
decoded
=
S
.
decode
(
'utf8'
)
if
six
.
PY3
:
S
=
decoded
except
UnicodeDecodeError
:
return
'base64'
,
base64_encodebytes
(
S
)[:
-
1
]
else
:
...
...
@@ -185,7 +187,7 @@ class String(Scalar):
# be converted.
encoding
=
'base64'
v
=
base64_encodebytes
(
self
.
_v
)[:
-
1
]
self
.
_v
=
self
.
mapping
.
convertBase64
(
v
).
decode
(
)
self
.
_v
=
bytes2str
(
self
.
mapping
.
convertBase64
(
v
)
)
else
:
encoding
,
self
.
_v
=
convert
(
self
.
_v
)
self
.
encoding
=
encoding
...
...
@@ -675,8 +677,8 @@ class ToXMLUnpickler(Unpickler):
k
=
self
.
marker
()
args
=
Tuple
(
self
.
id_mapping
,
v
=
self
.
stack
[
k
+
1
:])
del
self
.
stack
[
k
:]
module
=
self
.
readline
()[:
-
1
].
decode
(
)
name
=
self
.
readline
()[:
-
1
].
decode
(
)
module
=
bytes2str
(
self
.
readline
()[:
-
1
]
)
name
=
bytes2str
(
self
.
readline
()[:
-
1
]
)
value
=
Object
(
Global
(
module
,
name
,
self
.
id_mapping
),
args
,
self
.
id_mapping
)
self
.
append
(
value
)
if
six
.
PY2
:
...
...
@@ -709,8 +711,8 @@ class ToXMLUnpickler(Unpickler):
dispatch
[
NEWOBJ
[
0
]]
=
load_newobj
def
load_global
(
self
):
module
=
self
.
readline
()[:
-
1
].
decode
(
)
name
=
self
.
readline
()[:
-
1
].
decode
(
)
module
=
bytes2str
(
self
.
readline
()[:
-
1
]
)
name
=
bytes2str
(
self
.
readline
()[:
-
1
]
)
self
.
append
(
Global
(
module
,
name
,
self
.
id_mapping
))
if
six
.
PY2
:
dispatch
[
GLOBAL
]
=
load_global
...
...
@@ -861,7 +863,7 @@ def save_string(self, tag, data):
try
:
v
.
decode
(
'utf-8'
)
# XXX maybe check with repr_re ?
op
=
BINUNICODE
op
=
BINUNICODE
if
six
.
PY3
else
BINSTRING
v
=
op
+
struct
.
pack
(
'<i'
,
l
)
+
v
return
save_put
(
self
,
v
,
a
)
except
UnicodeDecodeError
:
...
...
@@ -874,7 +876,7 @@ def save_string(self, tag, data):
v
.
decode
(
'ascii'
)
# XXX zope4py3 we could also create an unpickler with encoding utf-8 ?
except
UnicodeDecodeError
:
op
=
BINUNICODE
op
=
BINUNICODE
if
six
.
PY3
else
BINSTRING
v
=
op
+
struct
.
pack
(
'<i'
,
l
)
+
v
return
save_put
(
self
,
v
,
a
)
...
...
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