diff --git a/product/ERP5/Document/BusinessTemplate.py b/product/ERP5/Document/BusinessTemplate.py index 19b22f40c3da046509572b99eaf45e1f81ed00bf..a0c7149a269257781fee9adf6dc2dded9ef1a174 100644 --- a/product/ERP5/Document/BusinessTemplate.py +++ b/product/ERP5/Document/BusinessTemplate.py @@ -5761,12 +5761,12 @@ Business Template is a set of definitions, such as skins, portal types and categ setattr(self, 'template_portal_type_base_category', ()) return - security.declareProtected(Permissions.ModifyPortalContent, - 'migrateAllComponentFromFilesystem') - def migrateAllComponentFromFilesystem(self, - version_priority, - erase_existing=False, - **kw): + security.declareProtected(Permissions.ManagePortal, + 'migrateSourceCodeFromFilesystem') + def migrateSourceCodeFromFilesystem(self, + version_priority, + erase_existing=False, + **kw): component_tool = self.getPortalObject().portal_components failed_import_dict = {} @@ -5802,19 +5802,7 @@ Business Template is a set of definitions, such as skins, portal types and categ self.setTemplateExtensionIdList(extension_id_list) - if failed_import_dict: - failed_import_formatted_list = [] - for name, error in failed_import_dict.iteritems(): - failed_import_formatted_list.append("%s (%s)" % (name, error)) - - message = "The following component could not be imported: %s" % \ - ', '.join(failed_import_formatted_list) - else: - message = "All components were successfully imported " \ - "from filesystem to ZODB." - - return self.Base_redirect('view', - keep_items={'portal_status_message': message}) + return failed_import_dict # Block acquisition on all _item_name_list properties by setting # a default class value to None diff --git a/product/ERP5/bootstrap/erp5_core/ActionTemplateItem/portal_types/Business%20Template/migrate_component_from_filesystem.xml b/product/ERP5/bootstrap/erp5_core/ActionTemplateItem/portal_types/Business%20Template/migrate_component_from_filesystem.xml index 9c4c83ac7f1b9561b21d573f0556c5dbc8c8e356..485c91b84bf039687900deba6b1030e0b2bf422f 100644 --- a/product/ERP5/bootstrap/erp5_core/ActionTemplateItem/portal_types/Business%20Template/migrate_component_from_filesystem.xml +++ b/product/ERP5/bootstrap/erp5_core/ActionTemplateItem/portal_types/Business%20Template/migrate_component_from_filesystem.xml @@ -77,7 +77,7 @@ <dictionary> <item> <key> <string>text</string> </key> - <value> <string>string:${object_url}/BusinessTemplate_viewMigrateAllComponentFromFilesystemDialog</string> </value> + <value> <string>string:${object_url}/BusinessTemplate_viewMigrateSourceCodeFromFilesystemDialog</string> </value> </item> </dictionary> </pickle> diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BusinessTemplate_migrateSourceCodeFromFilesystem.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BusinessTemplate_migrateSourceCodeFromFilesystem.xml new file mode 100644 index 0000000000000000000000000000000000000000..3bcc6668e68b990bfc7862e764ed233821c2f216 --- /dev/null +++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BusinessTemplate_migrateSourceCodeFromFilesystem.xml @@ -0,0 +1,79 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>Script_magic</string> </key> + <value> <int>3</int> </value> + </item> + <item> + <key> <string>_bind_names</string> </key> + <value> + <object> + <klass> + <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> + </klass> + <tuple/> + <state> + <dictionary> + <item> + <key> <string>_asgns</string> </key> + <value> + <dictionary> + <item> + <key> <string>name_container</string> </key> + <value> <string>container</string> </value> + </item> + <item> + <key> <string>name_context</string> </key> + <value> <string>context</string> </value> + </item> + <item> + <key> <string>name_m_self</string> </key> + <value> <string>script</string> </value> + </item> + <item> + <key> <string>name_subpath</string> </key> + <value> <string>traverse_subpath</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>_body</string> </key> + <value> <string>failed_import_dict = context.migrateSourceCodeFromFilesystem(version_priority, erase_existing, **kw)\n +\n +if failed_import_dict:\n + failed_import_formatted_list = []\n + for name, error in failed_import_dict.iteritems():\n + failed_import_formatted_list.append("%s (%s)" % (name, error))\n +\n + message = "The following component could not be imported: %s" % \', \'.join(failed_import_formatted_list)\n +else:\n + message = "All components were successfully imported from filesystem to ZODB."\n +\n +return context.Base_redirect(\'view\',\n + keep_items={\'portal_status_message\': message})\n +</string> </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string>version_priority, erase_existing=False, **kw</string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>BusinessTemplate_migrateSourceCodeFromFilesystem</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BusinessTemplate_viewMigrateAllComponentFromFilesystemDialog.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BusinessTemplate_viewMigrateSourceCodeFromFilesystemDialog.xml similarity index 93% rename from product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BusinessTemplate_viewMigrateAllComponentFromFilesystemDialog.xml rename to product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BusinessTemplate_viewMigrateSourceCodeFromFilesystemDialog.xml index 19d6c83a456b8f18f899804abe211e06a127d704..c090a6bcefaa5340a0bf69d9473766bf4580c04c 100644 --- a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BusinessTemplate_viewMigrateAllComponentFromFilesystemDialog.xml +++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BusinessTemplate_viewMigrateSourceCodeFromFilesystemDialog.xml @@ -35,7 +35,7 @@ </item> <item> <key> <string>action</string> </key> - <value> <string>migrateAllComponentFromFilesystem</string> </value> + <value> <string>BusinessTemplate_migrateSourceCodeFromFilesystem</string> </value> </item> <item> <key> <string>description</string> </key> @@ -111,7 +111,7 @@ </item> <item> <key> <string>id</string> </key> - <value> <string>BusinessTemplate_viewMigrateAllComponentFromFilesystemDialog</string> </value> + <value> <string>BusinessTemplate_viewMigrateSourceCodeFromFilesystemDialog</string> </value> </item> <item> <key> <string>method</string> </key> @@ -119,7 +119,7 @@ </item> <item> <key> <string>name</string> </key> - <value> <string>BusinessTemplate_viewMigrateAllComponentFromFilesystem</string> </value> + <value> <string>BusinessTemplate_viewMigrateSourceCodeFromFilesystem</string> </value> </item> <item> <key> <string>pt</string> </key> diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BusinessTemplate_viewMigrateAllComponentFromFilesystemDialog/listbox.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BusinessTemplate_viewMigrateSourceCodeFromFilesystemDialog/listbox.xml similarity index 100% rename from product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BusinessTemplate_viewMigrateAllComponentFromFilesystemDialog/listbox.xml rename to product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BusinessTemplate_viewMigrateSourceCodeFromFilesystemDialog/listbox.xml diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BusinessTemplate_viewMigrateAllComponentFromFilesystemDialog/my_erase_existing.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BusinessTemplate_viewMigrateSourceCodeFromFilesystemDialog/my_erase_existing.xml similarity index 100% rename from product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BusinessTemplate_viewMigrateAllComponentFromFilesystemDialog/my_erase_existing.xml rename to product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BusinessTemplate_viewMigrateSourceCodeFromFilesystemDialog/my_erase_existing.xml diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BusinessTemplate_viewMigrateAllComponentFromFilesystemDialog/my_version_priority.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BusinessTemplate_viewMigrateSourceCodeFromFilesystemDialog/my_version_priority.xml similarity index 100% rename from product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BusinessTemplate_viewMigrateAllComponentFromFilesystemDialog/my_version_priority.xml rename to product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BusinessTemplate_viewMigrateSourceCodeFromFilesystemDialog/my_version_priority.xml diff --git a/product/ERP5/bootstrap/erp5_core/bt/change_log b/product/ERP5/bootstrap/erp5_core/bt/change_log index 3209e669a720957ed5bc662f6aa331f56de2ec99..92d0750cdaeb7856693e882f8860cebeb921d546 100644 --- a/product/ERP5/bootstrap/erp5_core/bt/change_log +++ b/product/ERP5/bootstrap/erp5_core/bt/change_log @@ -1,3 +1,7 @@ +2012-02-25 arnaud.fontaine +* Add a Python script which performs the redirect rather than doing it in BusinessTemplate class. +* Rename *MigrateAllComponentFromFilesystem to *MigrateSourceCodeFromFilesystem. + 2012-02-25 arnaud.fontaine * Rename Component modified transition to modify as per naming conventions. diff --git a/product/ERP5/bootstrap/erp5_core/bt/revision b/product/ERP5/bootstrap/erp5_core/bt/revision index e010b882072b0457e509d8e48f5d8e4be374252b..9f02e3a811d28e12e75d10d806ba0fc2c580e1bb 100644 --- a/product/ERP5/bootstrap/erp5_core/bt/revision +++ b/product/ERP5/bootstrap/erp5_core/bt/revision @@ -1 +1 @@ -41010 \ No newline at end of file +41011 \ No newline at end of file