Commit dca4fd2e authored by Xiaowu Zhang's avatar Xiaowu Zhang

erp5_promise: conversion server url is in list format

parent cb2b84b5
from Products.CMFActivity.ActiveResult import ActiveResult from Products.CMFActivity.ActiveResult import ActiveResult
import json
portal = context.getPortalObject() portal = context.getPortalObject()
portal_preferences = portal.portal_preferences portal_preferences = portal.portal_preferences
promise_url = portal.getPromiseParameter('external_service', 'cloudooo_url') promise_url_list_string = portal.getPromiseParameter('external_service', 'cloudooo_url_list')
promise_url_list = json.loads(promise_url_list_string.replace('\'', '\"'))
if promise_url is None: if promise_url_list is None:
return return
url = portal_preferences.getPreferredDocumentConversionServerUrl() url_list = portal_preferences.getPreferredDocumentConversionServerUrlList()
active_result = ActiveResult() active_result = ActiveResult()
if promise_url != url: if promise_url_list != url_list:
severity = 1 severity = 1
summary = "Conversion Server not configured as expected" summary = "Conversion Server not configured as expected"
detail = "Expect %s\nGot %s" % (promise_url, url) detail = "Expect %s\nGot %s" % (promise_url_list, url_list)
else: else:
severity = 0 severity = 0
summary = "Nothing to do." summary = "Nothing to do."
......
import json
portal = context.getPortalObject() portal = context.getPortalObject()
portal_preferences = portal.portal_preferences portal_preferences = portal.portal_preferences
promise_url = portal.getPromiseParameter('external_service', 'cloudooo_url') promise_url_list_string = portal.getPromiseParameter('external_service', 'cloudooo_url_list')
promise_url_list = json.loads(promise_url_list_string.replace('\'', '\"'))
system_preference = portal_preferences.getActiveSystemPreference() system_preference = portal_preferences.getActiveSystemPreference()
if system_preference is None: if system_preference is None:
...@@ -10,5 +13,5 @@ if system_preference is None: ...@@ -10,5 +13,5 @@ if system_preference is None:
system_preference.enable() system_preference.enable()
system_preference.edit( system_preference.edit(
preferred_document_conversion_server_url=promise_url, preferred_document_conversion_server_url_list=promise_url_list
) )
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment