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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tatuya Kamada
erp5
Commits
59a1ce15
Commit
59a1ce15
authored
Jul 19, 2016
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OOoDocument: handle preferred Cloudooo server URL
parent
c4a4ee2a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
8 deletions
+22
-8
product/ERP5OOo/Document/OOoDocument.py
product/ERP5OOo/Document/OOoDocument.py
+22
-8
No files found.
product/ERP5OOo/Document/OOoDocument.py
View file @
59a1ce15
...
@@ -43,7 +43,7 @@ from Products.ERP5.Document.Document import Document, \
...
@@ -43,7 +43,7 @@ from Products.ERP5.Document.Document import Document, \
VALID_IMAGE_FORMAT_LIST
,
ConversionError
,
NotConvertedError
VALID_IMAGE_FORMAT_LIST
,
ConversionError
,
NotConvertedError
from
Products.ERP5.Document.Image
import
getDefaultImageQuality
from
Products.ERP5.Document.Image
import
getDefaultImageQuality
from
Products.ERP5Type.Utils
import
fill_args_from_request
from
Products.ERP5Type.Utils
import
fill_args_from_request
from
zLOG
import
LOG
,
ERROR
from
zLOG
import
LOG
,
WARNING
,
ERROR
# Mixin Import
# Mixin Import
from
Products.ERP5.mixin.base_convertable
import
BaseConvertableFileMixin
from
Products.ERP5.mixin.base_convertable
import
BaseConvertableFileMixin
...
@@ -86,16 +86,30 @@ class OOoServerProxy(ServerProxy):
...
@@ -86,16 +86,30 @@ class OOoServerProxy(ServerProxy):
def
__init__
(
self
,
context
):
def
__init__
(
self
,
context
):
preference_tool
=
getToolByName
(
context
,
'portal_preferences'
)
preference_tool
=
getToolByName
(
context
,
'portal_preferences'
)
address
=
preference_tool
.
getPreferredOoodocServerAddress
()
uri
=
getattr
(
preference_tool
,
"getPreferredDocumentConversionServerUrl"
,
str
)()
port
=
preference_tool
.
getPreferredOoodocServerPortNumber
()
if
uri
in
(
''
,
None
):
if
address
in
(
''
,
None
)
or
port
in
(
''
,
None
)
:
address
=
preference_tool
.
getPreferredOoodocServerAddress
()
raise
ConversionError
(
'OOoDocument: cannot proceed with conversion:'
port
=
preference_tool
.
getPreferredOoodocServerPortNumber
()
' conversion server host and port is not defined in preferences'
)
if
address
in
(
''
,
None
)
or
port
in
(
''
,
None
)
:
raise
ConversionError
(
'OOoDocument: cannot proceed with conversion:'
' conversion server url is not defined in preferences'
)
LOG
(
'OOoDocument'
,
WARNING
,
'PreferredOoodocServer{Address,PortNumber}'
+
\
' are DEPRECATED please use PreferredDocumentServerUrl instead'
,
error
=
True
)
scheme
=
"http"
uri
=
'http://%s:%d'
%
(
address
,
port
)
else
:
if
uri
.
startswith
(
"http://"
):
scheme
=
"http"
elif
uri
.
startswith
(
"https://"
):
scheme
=
"https"
else
:
raise
ConversionError
(
'OOoDocument: cannot proceed with conversion:'
' preferred conversion server url is invalid'
)
uri
=
'http://%s:%d'
%
(
address
,
port
)
timeout
=
preference_tool
.
getPreferredOoodocServerTimeout
()
\
timeout
=
preference_tool
.
getPreferredOoodocServerTimeout
()
\
or
OOO_SERVER_PROXY_TIMEOUT
or
OOO_SERVER_PROXY_TIMEOUT
transport
=
TimeoutTransport
(
timeout
=
timeout
,
scheme
=
'http'
)
transport
=
TimeoutTransport
(
timeout
=
timeout
,
scheme
=
scheme
)
ServerProxy
.
__init__
(
self
,
uri
,
allow_none
=
True
,
transport
=
transport
)
ServerProxy
.
__init__
(
self
,
uri
,
allow_none
=
True
,
transport
=
transport
)
...
...
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