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
2ad06905
Commit
2ad06905
authored
May 16, 2019
by
Boris Kocherov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rework
@yusei
patch
a5157949
parent
cedd433c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
13 deletions
+17
-13
cloudooo/handler/ooo/helper/helper_util.py
cloudooo/handler/ooo/helper/helper_util.py
+1
-9
cloudooo/handler/ooo/helper/openoffice_tester.py
cloudooo/handler/ooo/helper/openoffice_tester.py
+16
-4
No files found.
cloudooo/handler/ooo/helper/helper_util.py
View file @
2ad06905
import
sys
import
os
import
time
def
getServiceManager
(
host
,
port
,
uno_path
,
office_binary_path
):
"""Get the ServiceManager from the running OpenOffice.org.
...
...
@@ -21,13 +20,6 @@ def getServiceManager(host, port, uno_path, office_binary_path):
uno_context
)
# Connect to the running OpenOffice.org and get its
# context.
# Retry 10 times if needed.
for
i
in
range
(
10
):
try
:
uno_connection
=
resolver
.
resolve
(
"uno:socket,host=%s,port=%s;urp;StarOffice.ComponentContext"
%
(
host
,
port
))
break
except
:
# I don't know how to import com.sun.star.connection.NoConnectException
time
.
sleep
(
1
)
uno_connection
=
resolver
.
resolve
(
"uno:socket,host=%s,port=%s,tcpNoDelay=1;urp;StarOffice.ComponentContext"
%
(
host
,
port
))
# Get the ServiceManager object
return
uno_connection
.
ServiceManager
cloudooo/handler/ooo/helper/openoffice_tester.py
View file @
2ad06905
...
...
@@ -2,14 +2,26 @@
import
sys
import
helper_util
from
getopt
import
getopt
,
GetoptError
import
time
import
uno
NoConnectException
=
uno
.
getClass
(
"com.sun.star.connection.NoConnectException"
)
def
test_openoffice
(
hostname
,
port
):
# increase count if NoConnectException raised
count
=
10
try
:
for
i
in
range
(
count
-
1
):
try
:
helper_util
.
getServiceManager
(
hostname
,
port
)
break
except
NoConnectException
:
if
i
==
count
-
2
:
helper_util
.
getServiceManager
(
hostname
,
port
)
time
.
sleep
(
1
)
return
True
except
Exception
,
err
:
print
err
except
:
import
traceback
sys
.
stderr
.
write
(
traceback
.
format_exc
())
return
False
...
...
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