Commit d5dffe4b authored by Łukasz Nowak's avatar Łukasz Nowak

Simplify.

Do what user said and *exactly* what he said.
parent 7ed7d9d6
...@@ -68,24 +68,32 @@ bt5_counter = 0\n ...@@ -68,24 +68,32 @@ bt5_counter = 0\n
available_bt5_list = portal_templates.getRepositoryBusinessTemplateList(newest_only=True)\n available_bt5_list = portal_templates.getRepositoryBusinessTemplateList(newest_only=True)\n
available_bt5_id_list = [x.title for x in available_bt5_list]\n available_bt5_id_list = [x.title for x in available_bt5_list]\n
required_bt5_id_list = signature.get(\'required_bt5_id_list\', [])\n required_bt5_id_list = signature.get(\'required_bt5_id_list\', [])\n
\n
upgradable_bt5_id_list = signature.get(\'upgradable_bt5_id_list\', [])\n upgradable_bt5_id_list = signature.get(\'upgradable_bt5_id_list\', [])\n
if len(upgradable_bt5_id_list) == 0:\n if len(upgradable_bt5_id_list) > 0:\n
# by default, we try to upgrade all installed business templates.\n raise NotImplementedError\n
upgradable_bt5_id_list = portal_templates.getInstalledBusinessTemplateTitleList()\n \n
reinstallable_bt5_id_list = signature.get(\'reinstallable_bt5_id_list\', signature.get(\'reinstalable_bt5_id_list\', []))\n reinstallable_bt5_id_list = signature.get(\'reinstallable_bt5_id_list\', signature.get(\'reinstalable_bt5_id_list\', []))\n
if len(reinstallable_bt5_id_list) > 0:\n
raise NotImplementedError\n
\n
before_triggered_bt5_id_dict = signature.get(\'before_triggered_bt5_id_dict\', {})\n before_triggered_bt5_id_dict = signature.get(\'before_triggered_bt5_id_dict\', {})\n
after_triggered_bt5_id_dict = signature.get(\'after_triggered_bt5_id_dict\', {})\n after_triggered_bt5_id_dict = signature.get(\'after_triggered_bt5_id_dict\', {})\n
update_catalog_bt5_id_list = signature.get(\'update_catalog_bt5_id_list\', [])\n update_catalog_bt5_id_list = signature.get(\'update_catalog_bt5_id_list\', [])\n
if len(update_catalog_bt5_id_list) > 0:\n
raise NotImplementedError\n
\n
missing_id_list = [q for q in required_bt5_id_list if q not in available_bt5_id_list]\n
if len(missing_id_list) > 0:\n
script.log(\'Missing Business Templates: %s\' % (\', \'.join(missing_id_list),))\n
return message_list\n
\n \n
bt5_id_list = dict([(x, True) for x in list(required_bt5_id_list) + \\\n bt5_id_list = required_bt5_id_list\n
list(upgradable_bt5_id_list) + \\\n
list(reinstallable_bt5_id_list) \\\n
if x in available_bt5_id_list]).keys()\n
\n \n
# sort by dependencies\n bt5_list = []\n
bt5_list = [portal_templates.decodeRepositoryBusinessTemplateUid(x.uid) for x in \\\n for bt5_id in bt5_id_list:\n
available_bt5_list if x.title in bt5_id_list]\n available_bt5 = [q for q in available_bt5_list if q.title == bt5_id][0]\n
bt5_list = portal_templates.sortBusinessTemplateList(bt5_list)\n bt5_list.append(portal_templates.decodeRepositoryBusinessTemplateUid(available_bt5.uid))\n
\n \n
installed_bt5_title_list = [o.getTitle() for o in portal_templates.getInstalledBusinessTemplateList()]\n installed_bt5_title_list = [o.getTitle() for o in portal_templates.getInstalledBusinessTemplateList()]\n
\n \n
......
28 29
\ No newline at end of file \ No newline at end of file
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