Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
cloudooo
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
nexedi
cloudooo
Commits
e0068547
Commit
e0068547
authored
Feb 16, 2017
by
Boris Kocherov
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x2t: use with block for open file
parent
2e8fd048
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
19 deletions
+17
-19
cloudooo/handler/x2t/handler.py
cloudooo/handler/x2t/handler.py
+17
-19
No files found.
cloudooo/handler/x2t/handler.py
View file @
e0068547
...
@@ -168,25 +168,23 @@ class Handler(object):
...
@@ -168,25 +168,23 @@ class Handler(object):
os
.
mkdir
(
output_dir
)
os
.
mkdir
(
output_dir
)
output_file_name
=
os
.
path
.
join
(
output_dir
,
"body.txt"
)
output_file_name
=
os
.
path
.
join
(
output_dir
,
"body.txt"
)
config_file
=
open
(
config_file_name
,
"w"
)
with
open
(
config_file_name
,
"w"
)
as
config_file
:
config
=
{
config
=
{
# 'm_sKey': 'from',
# 'm_sKey': 'from',
'm_sFileFrom'
:
input_file_name
,
'm_sFileFrom'
:
input_file_name
,
'm_nFormatFrom'
:
in_format
,
'm_nFormatFrom'
:
in_format
,
'm_sFileTo'
:
output_file_name
,
'm_sFileTo'
:
output_file_name
,
'm_nFormatTo'
:
out_format
,
'm_nFormatTo'
:
out_format
,
# 'm_bPaid': 'true',
# 'm_bPaid': 'true',
# 'm_bEmbeddedFonts': 'false',
# 'm_bEmbeddedFonts': 'false',
# 'm_bFromChanges': 'false',
# 'm_bFromChanges': 'false',
# 'm_sFontDir': '/usr/share/fonts',
# 'm_sFontDir': '/usr/share/fonts',
# 'm_sThemeDir': '/var/www/onlyoffice/documentserver/FileConverterService/presentationthemes',
# 'm_sThemeDir': '/var/www/onlyoffice/documentserver/FileConverterService/presentationthemes',
}
}
root
=
ElementTree
.
Element
(
'root'
)
root
=
ElementTree
.
Element
(
'root'
)
for
key
,
value
in
config
.
items
():
for
key
,
value
in
config
.
items
():
ElementTree
.
SubElement
(
root
,
key
).
text
=
value
ElementTree
.
SubElement
(
root
,
key
).
text
=
value
ElementTree
.
ElementTree
(
root
).
write
(
config_file
,
encoding
=
'utf-8'
,
xml_declaration
=
True
,
default_namespace
=
None
,
method
=
"xml"
)
ElementTree
.
ElementTree
(
root
).
write
(
config_file
,
encoding
=
'utf-8'
,
xml_declaration
=
True
,
default_namespace
=
None
,
method
=
"xml"
)
config_file
.
close
()
# run convertion binary
# run convertion binary
p
=
Popen
(
p
=
Popen
(
...
...
Boris Kocherov
@bk
mentioned in commit
405454a8
·
Feb 26, 2018
mentioned in commit
405454a8
mentioned in commit 405454a8c5e357f3cc3988a37667f3cc039dff93
Toggle commit list
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