Commit 1f4715f1 authored by Arnaud Fontaine's avatar Arnaud Fontaine

Add a Python script for migration to avoid performing the redirect into BusinessTemplate class.

Also, Rename *MigrateAllComponentFromFilesystem to *MigrateSourceCodeFromFilesystem.
parent 56d14e01
...@@ -5761,12 +5761,12 @@ Business Template is a set of definitions, such as skins, portal types and categ ...@@ -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', ()) setattr(self, 'template_portal_type_base_category', ())
return return
security.declareProtected(Permissions.ModifyPortalContent, security.declareProtected(Permissions.ManagePortal,
'migrateAllComponentFromFilesystem') 'migrateSourceCodeFromFilesystem')
def migrateAllComponentFromFilesystem(self, def migrateSourceCodeFromFilesystem(self,
version_priority, version_priority,
erase_existing=False, erase_existing=False,
**kw): **kw):
component_tool = self.getPortalObject().portal_components component_tool = self.getPortalObject().portal_components
failed_import_dict = {} failed_import_dict = {}
...@@ -5802,19 +5802,7 @@ Business Template is a set of definitions, such as skins, portal types and categ ...@@ -5802,19 +5802,7 @@ Business Template is a set of definitions, such as skins, portal types and categ
self.setTemplateExtensionIdList(extension_id_list) self.setTemplateExtensionIdList(extension_id_list)
if failed_import_dict: return 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})
# Block acquisition on all _item_name_list properties by setting # Block acquisition on all _item_name_list properties by setting
# a default class value to None # a default class value to None
......
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>string:${object_url}/BusinessTemplate_viewMigrateAllComponentFromFilesystemDialog</string> </value> <value> <string>string:${object_url}/BusinessTemplate_viewMigrateSourceCodeFromFilesystemDialog</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
<?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>
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
</item> </item>
<item> <item>
<key> <string>action</string> </key> <key> <string>action</string> </key>
<value> <string>migrateAllComponentFromFilesystem</string> </value> <value> <string>BusinessTemplate_migrateSourceCodeFromFilesystem</string> </value>
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
...@@ -111,7 +111,7 @@ ...@@ -111,7 +111,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>BusinessTemplate_viewMigrateAllComponentFromFilesystemDialog</string> </value> <value> <string>BusinessTemplate_viewMigrateSourceCodeFromFilesystemDialog</string> </value>
</item> </item>
<item> <item>
<key> <string>method</string> </key> <key> <string>method</string> </key>
...@@ -119,7 +119,7 @@ ...@@ -119,7 +119,7 @@
</item> </item>
<item> <item>
<key> <string>name</string> </key> <key> <string>name</string> </key>
<value> <string>BusinessTemplate_viewMigrateAllComponentFromFilesystem</string> </value> <value> <string>BusinessTemplate_viewMigrateSourceCodeFromFilesystem</string> </value>
</item> </item>
<item> <item>
<key> <string>pt</string> </key> <key> <string>pt</string> </key>
......
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 2012-02-25 arnaud.fontaine
* Rename Component modified transition to modify as per naming conventions. * Rename Component modified transition to modify as per naming conventions.
......
41010 41011
\ 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