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
Labels
Merge Requests
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Jérome Perrin
erp5
Commits
7fc2511a
Commit
7fc2511a
authored
Mar 23, 2023
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PortalTransforms: py3 WIP
🚧
parent
e62f138d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
product/PortalTransforms/libtransforms/commandtransform.py
product/PortalTransforms/libtransforms/commandtransform.py
+5
-3
product/PortalTransforms/libtransforms/imagemagick_transform.py
...t/PortalTransforms/libtransforms/imagemagick_transform.py
+1
-3
No files found.
product/PortalTransforms/libtransforms/commandtransform.py
View file @
7fc2511a
...
@@ -35,7 +35,8 @@ class commandtransform:
...
@@ -35,7 +35,8 @@ class commandtransform:
os
.
mkdir
(
tmpdir
)
os
.
mkdir
(
tmpdir
)
filename
=
kwargs
.
get
(
"filename"
,
''
)
filename
=
kwargs
.
get
(
"filename"
,
''
)
fullname
=
join
(
tmpdir
,
basename
(
filename
))
fullname
=
join
(
tmpdir
,
basename
(
filename
))
filedest
=
open
(
fullname
,
"wb"
).
write
(
data
)
with
open
(
fullname
,
"wb"
)
as
f
:
f
.
write
(
data
)
return
tmpdir
,
fullname
return
tmpdir
,
fullname
def
subObjects
(
self
,
tmpdir
):
def
subObjects
(
self
,
tmpdir
):
...
@@ -51,7 +52,8 @@ class commandtransform:
...
@@ -51,7 +52,8 @@ class commandtransform:
def
fixImages
(
self
,
path
,
images
,
objects
):
def
fixImages
(
self
,
path
,
images
,
objects
):
for
image
in
images
:
for
image
in
images
:
objects
[
image
]
=
open
(
join
(
path
,
image
),
'rb'
).
read
()
with
open
(
join
(
path
,
image
),
'rb'
)
as
f
:
objects
[
image
]
=
f
.
read
()
def
cleanDir
(
self
,
tmpdir
):
def
cleanDir
(
self
,
tmpdir
):
shutil
.
rmtree
(
tmpdir
)
shutil
.
rmtree
(
tmpdir
)
...
@@ -99,7 +101,7 @@ class popentransform:
...
@@ -99,7 +101,7 @@ class popentransform:
cin
,
couterr
=
os
.
popen4
(
command
,
'b'
)
cin
,
couterr
=
os
.
popen4
(
command
,
'b'
)
if
self
.
useStdin
:
if
self
.
useStdin
:
cin
.
write
(
str
(
data
))
cin
.
write
(
bytes
(
data
))
status
=
cin
.
close
()
status
=
cin
.
close
()
...
...
product/PortalTransforms/libtransforms/imagemagick_transform.py
View file @
7fc2511a
...
@@ -36,9 +36,7 @@ class ImageMagickTransforms:
...
@@ -36,9 +36,7 @@ class ImageMagickTransforms:
stderr
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
close_fds
=
True
)
close_fds
=
True
)
try
:
try
:
# XXX: The only portable way is to pass what stdin.write can accept,
image
,
err
=
p
.
communicate
(
bytes
(
orig
))
# which is a string for PIPE.
image
,
err
=
p
.
communicate
(
str
(
orig
))
finally
:
finally
:
del
p
del
p
...
...
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