Commit a9ad5344 authored by Ivan Tyagov's avatar Ivan Tyagov

REfactor and re-use code.

parent 18935a11
...@@ -2,19 +2,19 @@ ...@@ -2,19 +2,19 @@
This script will setup the default Wendelin's configuration as saved in erp5_wendelin_scalability_test business template. This script will setup the default Wendelin's configuration as saved in erp5_wendelin_scalability_test business template.
As this modifies your site care must be taken! As this modifies your site care must be taken!
""" """
from Products.ERP5Type.Log import log
portal = context.getPortalObject() portal = context.getPortalObject()
configurator = getattr(portal.business_configuration_module, "default_wendelin_configuration", None) configurator = getattr(portal.business_configuration_module, "default_wendelin_configuration", None)
if configurator == None: if configurator == None:
context.log("Could not find the scalability business configuration object. Be sure to have erp5_wendelin_scalability_test business template installed.") log("Could not find the scalability business configuration object. Be sure to have erp5_wendelin_scalability_test business template installed.")
return return
# install configurator if not intalled # install configurator if not intalled
installed_bt5_list = [x.getTitle() for x in context.portal_templates.getInstalledBusinessTemplateList()] if not portal.ERP5Site_isReady():
if "erp5_wendelin" not in installed_bt5_list:
# nothing installed, thus do it # nothing installed, thus do it
context.log("START auto-configuration for Wendelin's default configuration.") log("START auto-configuration for Wendelin's default configuration.")
context.ERP5Site_bootstrapScalabilityTest(user_quantity=0, setup_activity_tool=False, create_test_data=False, set_id_generator=False) context.ERP5Site_bootstrapScalabilityTest(user_quantity=0, setup_activity_tool=False, create_test_data=False, set_id_generator=False)
else: else:
context.log("All configured. Nothing to do.") log("All configured. Nothing to do.")
...@@ -2,8 +2,5 @@ ...@@ -2,8 +2,5 @@
The purpose of the script is to tell if configuration of a site was finished or not. The purpose of the script is to tell if configuration of a site was finished or not.
It is used from Deployment Tests. It is used from Deployment Tests.
""" """
installed_bt5_list = [x.getTitle() for x in context.portal_templates.getInstalledBusinessTemplateList()] return context.portal_templates.getInstalledBusinessTemplate("erp5_wendelin", strict=True) is not None
if "erp5_wendelin" in installed_bt5_list: 0
return 1
else:
return 0
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