From 811f67c172774520400129709df1b2620b6c92c6 Mon Sep 17 00:00:00 2001 From: Alexandre Boeglin <alex@nexedi.com> Date: Fri, 11 Apr 2008 14:27:23 +0000 Subject: [PATCH] Add back a init script for resources, based on PDM preferences. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@20451 20353a03-c40f-0410-a6d1-a30d3c3de9de --- .../portal_types/Component.xml | 2 +- .../portal_types/Product.xml | 2 +- .../portal_types/Service.xml | 2 +- .../portal_skins/erp5_pdm/Resource_init.xml | 158 ++++++++++++++++++ bt5/erp5_pdm/bt/revision | 2 +- 5 files changed, 162 insertions(+), 4 deletions(-) create mode 100644 bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Resource_init.xml diff --git a/bt5/erp5_pdm/PortalTypeTemplateItem/portal_types/Component.xml b/bt5/erp5_pdm/PortalTypeTemplateItem/portal_types/Component.xml index 7aa6e5cea9..39ca4fbaf1 100644 --- a/bt5/erp5_pdm/PortalTypeTemplateItem/portal_types/Component.xml +++ b/bt5/erp5_pdm/PortalTypeTemplateItem/portal_types/Component.xml @@ -105,7 +105,7 @@ </item> <item> <key> <string>init_script</string> </key> - <value> <string></string> </value> + <value> <string>Resource_init</string> </value> </item> <item> <key> <string>permission</string> </key> diff --git a/bt5/erp5_pdm/PortalTypeTemplateItem/portal_types/Product.xml b/bt5/erp5_pdm/PortalTypeTemplateItem/portal_types/Product.xml index cc21d4a4c9..26e2c35ad2 100644 --- a/bt5/erp5_pdm/PortalTypeTemplateItem/portal_types/Product.xml +++ b/bt5/erp5_pdm/PortalTypeTemplateItem/portal_types/Product.xml @@ -115,7 +115,7 @@ </item> <item> <key> <string>init_script</string> </key> - <value> <string></string> </value> + <value> <string>Resource_init</string> </value> </item> <item> <key> <string>permission</string> </key> diff --git a/bt5/erp5_pdm/PortalTypeTemplateItem/portal_types/Service.xml b/bt5/erp5_pdm/PortalTypeTemplateItem/portal_types/Service.xml index c398fe37ae..1dfb150a32 100644 --- a/bt5/erp5_pdm/PortalTypeTemplateItem/portal_types/Service.xml +++ b/bt5/erp5_pdm/PortalTypeTemplateItem/portal_types/Service.xml @@ -95,7 +95,7 @@ </item> <item> <key> <string>init_script</string> </key> - <value> <string></string> </value> + <value> <string>Resource_init</string> </value> </item> <item> <key> <string>permission</string> </key> diff --git a/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Resource_init.xml b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Resource_init.xml new file mode 100644 index 0000000000..cb1b2cce31 --- /dev/null +++ b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Resource_init.xml @@ -0,0 +1,158 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <tuple> + <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> + <tuple/> + </tuple> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>Python_magic</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>Script_magic</string> </key> + <value> <int>3</int> </value> + </item> + <item> + <key> <string>__ac_local_roles__</string> </key> + <value> + <none/> + </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>portal_type = context.getPortalType().lower().replace(\' \', \'_\')\n +\n +base = context.portal_preferences.getPreference(\'preferred_%s_variation_base_category_list\' % portal_type)\n +optional = context.portal_preferences.getPreference(\'preferred_%s_optional_variation_base_category_list\' % portal_type)\n +individual = context.portal_preferences.getPreference(\'preferred_%s_individual_variation_base_category\' % portal_type)\n +\n +if individual:\n + context.edit(variation_base_category_list=base,\n + optional_variation_base_category_list=optional,\n + individual_variation_base_category=individual)\n +else:\n + context.edit(variation_base_category_list=base,\n + optional_variation_optional_base_category_list=optional)\n +</string> </value> + </item> + <item> + <key> <string>_code</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_filepath</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string>*args, **kw</string> </value> + </item> + <item> + <key> <string>errors</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>func_code</string> </key> + <value> + <object> + <klass> + <global name="FuncCode" module="Shared.DC.Scripts.Signature"/> + </klass> + <tuple/> + <state> + <dictionary> + <item> + <key> <string>co_argcount</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>co_varnames</string> </key> + <value> + <tuple> + <string>args</string> + <string>kw</string> + <string>_getattr_</string> + <string>context</string> + <string>portal_type</string> + <string>base</string> + <string>optional</string> + <string>individual</string> + </tuple> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>func_defaults</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>Resource_init</string> </value> + </item> + <item> + <key> <string>warnings</string> </key> + <value> + <tuple/> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_pdm/bt/revision b/bt5/erp5_pdm/bt/revision index a46c9d2265..69226f7293 100644 --- a/bt5/erp5_pdm/bt/revision +++ b/bt5/erp5_pdm/bt/revision @@ -1 +1 @@ -91 \ No newline at end of file +92 \ No newline at end of file -- 2.30.9