Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cloudooo
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
cloudooo
Commits
e0068547
Commit
e0068547
authored
Feb 16, 2017
by
Boris Kocherov
2
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):
os
.
mkdir
(
output_dir
)
output_file_name
=
os
.
path
.
join
(
output_dir
,
"body.txt"
)
config_file
=
open
(
config_file_name
,
"w"
)
config
=
{
# 'm_sKey': 'from',
'm_sFileFrom'
:
input_file_name
,
'm_nFormatFrom'
:
in_format
,
'm_sFileTo'
:
output_file_name
,
'm_nFormatTo'
:
out_format
,
# 'm_bPaid': 'true',
# 'm_bEmbeddedFonts': 'false',
# 'm_bFromChanges': 'false',
# 'm_sFontDir': '/usr/share/fonts',
# 'm_sThemeDir': '/var/www/onlyoffice/documentserver/FileConverterService/presentationthemes',
}
root
=
ElementTree
.
Element
(
'root'
)
for
key
,
value
in
config
.
items
():
ElementTree
.
SubElement
(
root
,
key
).
text
=
value
ElementTree
.
ElementTree
(
root
).
write
(
config_file
,
encoding
=
'utf-8'
,
xml_declaration
=
True
,
default_namespace
=
None
,
method
=
"xml"
)
config_file
.
close
()
with
open
(
config_file_name
,
"w"
)
as
config_file
:
config
=
{
# 'm_sKey': 'from',
'm_sFileFrom'
:
input_file_name
,
'm_nFormatFrom'
:
in_format
,
'm_sFileTo'
:
output_file_name
,
'm_nFormatTo'
:
out_format
,
# 'm_bPaid': 'true',
# 'm_bEmbeddedFonts': 'false',
# 'm_bFromChanges': 'false',
# 'm_sFontDir': '/usr/share/fonts',
# 'm_sThemeDir': '/var/www/onlyoffice/documentserver/FileConverterService/presentationthemes',
}
root
=
ElementTree
.
Element
(
'root'
)
for
key
,
value
in
config
.
items
():
ElementTree
.
SubElement
(
root
,
key
).
text
=
value
ElementTree
.
ElementTree
(
root
).
write
(
config_file
,
encoding
=
'utf-8'
,
xml_declaration
=
True
,
default_namespace
=
None
,
method
=
"xml"
)
# run convertion binary
p
=
Popen
(
...
...
Boris Kocherov
@bk
mentioned in commit
bbef982b
·
Feb 06, 2018
mentioned in commit
bbef982b
mentioned in commit bbef982bdb3a6210fe2c37e3d5c19bac6ab0b25b
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