Commit 54126606 authored by Jérome Perrin's avatar Jérome Perrin

minor changes fixes


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@22403 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 69447ce8
......@@ -235,7 +235,7 @@ class WizardTool(BaseTool):
content_type_dict = None
if content_type:
content_type_value, content_type_dict = cgi.parse_header(content_type)
if content_type_value=='multipart/form-data':
if content_type_value == 'multipart/form-data':
fp = StringIO(user_input)
user_input_dict = cgi.parse_multipart(fp, content_type_dict)
else:
......@@ -258,7 +258,8 @@ class WizardTool(BaseTool):
user_and_password = self._getSubsribedUserAndPassword()
if (len(user_and_password)==2 and
user_and_password[0] and user_and_password[1]):
auth = 'Basic %s' % base64.encodestring('%s:%s' % user_and_password).strip()
auth = 'Basic %s' % base64.encodestring(
'%s:%s' % user_and_password).strip()
header_dict['Authorization'] = auth
if content_type:
......@@ -314,7 +315,7 @@ class WizardTool(BaseTool):
html = _generateErrorXML("""Cannot contact the server: %s.
Please check your network settings.""" %server_url)
zLOG.LOG('Wizard Tool socket error', zLOG.ERROR, message)
result_call.update({"command":"show",
result_call.update({"command": "show",
"data": html,
"next": None,
"previous": None})
......@@ -322,14 +323,14 @@ class WizardTool(BaseTool):
html = _generateErrorXML("""The server %s refused to reply.
Please contact erp5-dev@erp5.org""" % server_url)
zLOG.LOG('Wizard Tool xmlrpc protocol error', zLOG.ERROR, message)
result_call.update({"command":"show",
result_call.update({"command": "show",
"data": html,
"next": None,
"previous": None})
except xmlrpclib.Fault, message:
html = _generateErrorXML("Error/bug inside the server: %s." % server_url)
zLOG.LOG('Wizard Tool xmlrpc fault', zLOG.ERROR, message)
result_call.update({"command":"show",
result_call.update({"command": "show",
"data": html,
"next": None,
"previous": None})
......@@ -383,13 +384,14 @@ class WizardTool(BaseTool):
portal_workflow = getToolByName(self.getPortalObject(), 'portal_workflow')
business_template.install()
security.declareProtected(Permissions.ModifyPortalContent, 'installBT5FilesFromServer')
security.declareProtected(Permissions.ModifyPortalContent,
'installBT5FilesFromServer')
def installBT5FilesFromServer(self,
server_response,
execute_after_setup_script = True,
install_standard_bt5 = True,
install_customer_bt5 = True,
use_super_manager = True):
execute_after_setup_script=True,
install_standard_bt5=True,
install_customer_bt5=True,
use_super_manager=True):
""" Install or update BT5 files which we get from remote server. """
if use_super_manager:
# set current security manager to owner of site
......@@ -417,15 +419,18 @@ class WizardTool(BaseTool):
bt5_filedata = bt5_files[counter]
self._importBT5FileData(bt5_id, bt5_filedata)
LOG("Wizard", INFO,
"[OK] customized bt5 installation (XML-RPC) %s, %s bytes" %(bt5_id,len(bt5_filedata)))
"[OK] customized bt5 installation (XML-RPC) %s, %s bytes" %
(bt5_id, len(bt5_filedata)))
## ..
counter += 1
## can we execute after setup script that will finish installation on client side?
bt5_after_setup_script_id = server_response["server_buffer"].get("after_setup_script_id", None)
if bt5_after_setup_script_id is None and \
self.getExpressConfigurationPreference('preferred_express_configuration_status', False):
self.getExpressConfigurationPreference(
'preferred_express_configuration_status', False):
## we already have stored after setup script id
bt5_after_setup_script_id = self.getExpressConfigurationPreference('preferred_express_after_setup_script_id', None)
bt5_after_setup_script_id = self.getExpressConfigurationPreference(
'preferred_express_after_setup_script_id', None)
if execute_after_setup_script and bt5_after_setup_script_id is not None:
## Execute script provided (if) in customer specific business template.
......@@ -437,10 +442,10 @@ class WizardTool(BaseTool):
LOG("Wizard", INFO,"[OK] execution of afer setup script %s (for bt5 %s)\n%s"
%(after_script.getId(), bt5_customer_template_id, after_script_result))
## mark this ERP5 instance as configured
self.setExpressConfigurationPreference('preferred_express_configuration_status',
1)
self.setExpressConfigurationPreference('preferred_express_after_setup_script_id',
bt5_after_setup_script_id)
self.setExpressConfigurationPreference(
'preferred_express_configuration_status', 1)
self.setExpressConfigurationPreference(
'preferred_express_after_setup_script_id', bt5_after_setup_script_id)
# Make sure that the site status is reloaded.
portal.portal_caches.clearAllCache()
LOG("Wizard", INFO,
......@@ -473,10 +478,10 @@ class WizardTool(BaseTool):
## selection of working business configuration
if response.get('server_buffer', None) is not None:
client_id = response['server_buffer'].get('client_id', None)
self._setServerInfo(user_id = user_id,
password = password,
client_id = client_id)
return self.WizardTool_dialogForm(form_html = response["data"])
self._setServerInfo(user_id=user_id,
password=password,
client_id=client_id)
return self.WizardTool_dialogForm(form_html=response["data"])
elif command == "next":
self._setServerInfo(user_id=user_id, \
password=password, \
......@@ -501,8 +506,8 @@ class WizardTool(BaseTool):
command = response["command"]
html = response["data"]
if command == "show":
return self.WizardTool_dialogForm(previous = response['previous'], \
form_html = html, \
return self.WizardTool_dialogForm(previous=response['previous'],
form_html=html,
next = response['next'])
elif command == "update":
return self.next(REQUEST=REQUEST)
......@@ -519,15 +524,17 @@ class WizardTool(BaseTool):
command = response["command"]
html = response['data']
if command == "show":
return self.WizardTool_dialogForm(previous = response['previous'], \
form_html = html, \
next = response['next'])
return self.WizardTool_dialogForm(previous=response['previous'],
form_html=html,
next=response['next'])
elif command == "login":
REQUEST.set('portal_status_message', html)
return self.view(REQUEST=REQUEST)
security.declarePublic(Permissions.AccessContentsInformation, 'getInstallationStatusReportFromClient')
def getInstallationStatusReportFromClient(self, active_process_id=None, REQUEST=None):
security.declarePublic(Permissions.AccessContentsInformation,
'getInstallationStatusReportFromClient')
def getInstallationStatusReportFromClient(self,
active_process_id=None, REQUEST=None):
""" Query local ERP5 instance for installation status.
If installation is over the installation activities and reindexing
activities should not exists.
......
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