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
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
Ivan Tyagov
cloudooo
Commits
43f8ba25
Commit
43f8ba25
authored
Oct 25, 2011
by
Nicolas Delaby
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
continue cleaning of parameters handling
parent
a86e7d5c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
18 deletions
+9
-18
cloudooo/handler/ooo/helper/unoconverter.py
cloudooo/handler/ooo/helper/unoconverter.py
+9
-18
No files found.
cloudooo/handler/ooo/helper/unoconverter.py
View file @
43f8ba25
...
@@ -71,7 +71,7 @@ class UnoConverter(object):
...
@@ -71,7 +71,7 @@ class UnoConverter(object):
"""A module to easily work with OpenOffice.org."""
"""A module to easily work with OpenOffice.org."""
def
__init__
(
self
,
hostname
,
port
,
document_url
,
source_format
,
uno_path
,
def
__init__
(
self
,
hostname
,
port
,
document_url
,
source_format
,
uno_path
,
office_binary_path
,
refresh
=
None
,
):
office_binary_path
,
refresh
):
""" """
""" """
self
.
hostname
=
hostname
self
.
hostname
=
hostname
self
.
port
=
port
self
.
port
=
port
...
@@ -270,6 +270,8 @@ def main():
...
@@ -270,6 +270,8 @@ def main():
except
ImportError
:
except
ImportError
:
import
simplejson
as
json
import
simplejson
as
json
refresh
=
None
refresh
=
None
hostname
=
port
=
document_url
=
office_binary_path
=
uno_path
=
\
destination_format
=
source_format
=
refresh
=
metadata
=
mimemapper
=
None
for
opt
,
arg
in
iter
(
opt_list
):
for
opt
,
arg
in
iter
(
opt_list
):
if
opt
in
(
'-h'
,
'--help'
):
if
opt
in
(
'-h'
,
'--help'
):
help
()
help
()
...
@@ -280,10 +282,8 @@ def main():
...
@@ -280,10 +282,8 @@ def main():
elif
opt
==
'--document_url'
:
elif
opt
==
'--document_url'
:
document_url
=
arg
document_url
=
arg
elif
opt
==
'--office_binary_path'
:
elif
opt
==
'--office_binary_path'
:
environ
[
'office_binary_path'
]
=
arg
office_binary_path
=
arg
office_binary_path
=
arg
elif
opt
==
'--uno_path'
:
elif
opt
==
'--uno_path'
:
environ
[
'uno_path'
]
=
arg
uno_path
=
arg
uno_path
=
arg
elif
opt
==
'--destination_format'
:
elif
opt
==
'--destination_format'
:
destination_format
=
arg
destination_format
=
arg
...
@@ -297,23 +297,13 @@ def main():
...
@@ -297,23 +297,13 @@ def main():
elif
opt
==
'--mimemapper'
:
elif
opt
==
'--mimemapper'
:
mimemapper
=
json
.
loads
(
arg
)
mimemapper
=
json
.
loads
(
arg
)
kw
=
{}
if
"uno_path"
in
locals
():
kw
[
'uno_path'
]
=
uno_path
if
"office_binary_path"
in
locals
():
unoconverter
=
UnoConverter
(
hostname
,
port
,
document_url
,
source_format
,
kw
[
'office_binary_path'
]
=
office_binary_path
uno_path
,
office_binary_path
,
refresh
)
if
'source_format'
in
locals
():
kw
[
'source_format'
]
=
source_format
if
refresh
:
kw
[
'refresh'
]
=
refresh
unoconverter
=
UnoConverter
(
hostname
,
port
,
document_url
,
**
kw
)
if
"--convert"
in
param_list
and
not
'--getmetadata'
in
param_list
\
if
"--convert"
in
param_list
and
not
'--getmetadata'
in
param_list
\
and
'destination_format'
not
in
locals
()
:
and
not
destination_format
:
output
=
unoconverter
.
convert
()
output
=
unoconverter
.
convert
()
elif
'--convert'
in
param_list
and
'destination_format'
in
locals
()
:
elif
'--convert'
in
param_list
and
destination_format
:
output
=
unoconverter
.
convert
(
destination_format
)
output
=
unoconverter
.
convert
(
destination_format
)
elif
'--getmetadata'
in
param_list
and
not
'--convert'
in
param_list
:
elif
'--getmetadata'
in
param_list
and
not
'--convert'
in
param_list
:
metadata_dict
=
unoconverter
.
getMetadata
()
metadata_dict
=
unoconverter
.
getMetadata
()
...
@@ -321,7 +311,8 @@ def main():
...
@@ -321,7 +311,8 @@ def main():
elif
'--getmetadata'
in
param_list
and
'--convert'
in
param_list
:
elif
'--getmetadata'
in
param_list
and
'--convert'
in
param_list
:
document_url
=
unoconverter
.
convert
()
document_url
=
unoconverter
.
convert
()
# Instanciate new UnoConverter instance with new url
# Instanciate new UnoConverter instance with new url
unoconverter
=
UnoConverter
(
hostname
,
port
,
document_url
,
**
kw
)
unoconverter
=
UnoConverter
(
hostname
,
port
,
document_url
,
source_format
,
uno_path
,
office_binary_path
,
refresh
)
metadata_dict
=
unoconverter
.
getMetadata
()
metadata_dict
=
unoconverter
.
getMetadata
()
metadata_dict
[
'document_url'
]
=
document_url
metadata_dict
[
'document_url'
]
=
document_url
output
=
encodestring
(
json
.
dumps
(
metadata_dict
))
output
=
encodestring
(
json
.
dumps
(
metadata_dict
))
...
...
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