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
6c3a3561
Commit
6c3a3561
authored
Mar 23, 2023
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PortalTransforms: py3 WIP
🚧
parent
934533eb
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 @
6c3a3561
...
...
@@ -35,7 +35,8 @@ class commandtransform:
os
.
mkdir
(
tmpdir
)
filename
=
kwargs
.
get
(
"filename"
,
''
)
fullname
=
join
(
tmpdir
,
basename
(
filename
))
filedest
=
open
(
fullname
,
"wb"
).
write
(
data
)
with
open
(
fullname
,
"wb"
)
as
f
:
f
.
write
(
data
)
return
tmpdir
,
fullname
def
subObjects
(
self
,
tmpdir
):
...
...
@@ -51,7 +52,8 @@ class commandtransform:
def
fixImages
(
self
,
path
,
images
,
objects
):
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
):
shutil
.
rmtree
(
tmpdir
)
...
...
@@ -99,7 +101,7 @@ class popentransform:
cin
,
couterr
=
os
.
popen4
(
command
,
'b'
)
if
self
.
useStdin
:
cin
.
write
(
str
(
data
))
cin
.
write
(
bytes
(
data
))
status
=
cin
.
close
()
...
...
product/PortalTransforms/libtransforms/imagemagick_transform.py
View file @
6c3a3561
...
...
@@ -36,9 +36,7 @@ class ImageMagickTransforms:
stderr
=
subprocess
.
PIPE
,
close_fds
=
True
)
try
:
# XXX: The only portable way is to pass what stdin.write can accept,
# which is a string for PIPE.
image
,
err
=
p
.
communicate
(
str
(
orig
))
image
,
err
=
p
.
communicate
(
bytes
(
orig
))
finally
:
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