Commit a2f41f6f authored by Sebastien Robin's avatar Sebastien Robin

- add --update_only business template, this allows to update

  only some parts of the business templates, this is really
  usefull when you are doing changes only on a few business
  templates in combination with the load option


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@24858 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 3864a5e1
...@@ -317,7 +317,19 @@ class ERP5TypeTestCase(PortalTestCase): ...@@ -317,7 +317,19 @@ class ERP5TypeTestCase(PortalTestCase):
update_business_templates = os.environ.get('update_business_templates') is not None update_business_templates = os.environ.get('update_business_templates') is not None
erp5_load_data_fs = os.environ.get('erp5_load_data_fs') is not None erp5_load_data_fs = os.environ.get('erp5_load_data_fs') is not None
if update_business_templates and erp5_load_data_fs: if update_business_templates and erp5_load_data_fs:
update_only = os.environ.get('update_only', None)
template_list = (erp5_catalog_storage, 'erp5_core', 'erp5_xhtml_style') + tuple(template_list) template_list = (erp5_catalog_storage, 'erp5_core', 'erp5_xhtml_style') + tuple(template_list)
# Update only specified business templates, regular expression
# can be used.
if update_only is not None:
update_only_list = update_only.split(',')
matching_template_list = []
# First parse the template list in order to keep same order
for business_template in template_list:
for expression in update_only_list:
if re.search(expression, business_template):
matching_template_list.append(business_template)
template_list = matching_template_list
new_template_list = [] new_template_list = []
for template in template_list: for template in template_list:
id = template.split('/')[-1] id = template.split('/')[-1]
...@@ -686,6 +698,7 @@ class ERP5TypeTestCase(PortalTestCase): ...@@ -686,6 +698,7 @@ class ERP5TypeTestCase(PortalTestCase):
ZopeTestCase._print('(imported in %.3fs) ' % (time.time() - start)) ZopeTestCase._print('(imported in %.3fs) ' % (time.time() - start))
install_kw = None install_kw = None
if get_install_kw: if get_install_kw:
install_kw = {}
listbox_object_list = BusinessTemplate_getModifiedObject.__of__(bt)() listbox_object_list = BusinessTemplate_getModifiedObject.__of__(bt)()
for listbox_line in listbox_object_list: for listbox_line in listbox_object_list:
install_kw[listbox_line.object_id] = listbox_line.choice_item_list[0][1] install_kw[listbox_line.object_id] = listbox_line.choice_item_list[0][1]
......
...@@ -64,6 +64,13 @@ Options: ...@@ -64,6 +64,13 @@ Options:
Update all business templates prior to runing Update all business templates prior to runing
tests. This only has a meaning when doing tests. This only has a meaning when doing
upgratability checks, in conjunction with --load. upgratability checks, in conjunction with --load.
--update_only can be use to restrict the list of
templates to update.
--update_only=STRING
Specify the list of business template to update if
you don't want to update them all. You can give a list
delimited with commans (e.g. erp5_core,erp5_xhtml_style).
This can be regular expressions.
""" """
def getUnitTestFile(): def getUnitTestFile():
...@@ -359,6 +366,7 @@ def main(): ...@@ -359,6 +366,7 @@ def main():
"load", "load",
"email_from_address=", "email_from_address=",
"run_only=", "run_only=",
"update_only=",
"update_business_templates"] ) "update_business_templates"] )
except getopt.GetoptError, msg: except getopt.GetoptError, msg:
usage(sys.stderr, msg) usage(sys.stderr, msg)
...@@ -417,6 +425,8 @@ def main(): ...@@ -417,6 +425,8 @@ def main():
os.environ["erp5_catalog_storage"] = arg os.environ["erp5_catalog_storage"] = arg
elif opt == "--run_only": elif opt == "--run_only":
os.environ["run_only"] = arg os.environ["run_only"] = arg
elif opt == "--update_only":
os.environ["update_only"] = arg
elif opt == "--update_business_templates": elif opt == "--update_business_templates":
os.environ["update_business_templates"] = "1" os.environ["update_business_templates"] = "1"
......
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