From 1490b05ed64bfd8c3315a17d3a0bc3a1df58d196 Mon Sep 17 00:00:00 2001
From: Benjamin Blanc <benjamin.blanc@tiolive.com>
Date: Tue, 6 Aug 2013 14:01:19 +0200
Subject: [PATCH] erp5_scalability_data: put forcing usage of random id in a
 dedicated script

---
 .../portal_skins/custom/init_scalability.xml  |  6 --
 .../custom/use_random_id_scalability.xml      | 75 +++++++++++++++++++
 bt5/erp5_scalability_data/bt/revision         |  2 +-
 .../bt/template_keep_path_list                |  1 +
 .../bt/template_path_list                     |  1 +
 5 files changed, 78 insertions(+), 7 deletions(-)
 create mode 100644 bt5/erp5_scalability_data/PathTemplateItem/portal_skins/custom/use_random_id_scalability.xml

diff --git a/bt5/erp5_scalability_data/PathTemplateItem/portal_skins/custom/init_scalability.xml b/bt5/erp5_scalability_data/PathTemplateItem/portal_skins/custom/init_scalability.xml
index a4ac5e82fa..db917d07b4 100644
--- a/bt5/erp5_scalability_data/PathTemplateItem/portal_skins/custom/init_scalability.xml
+++ b/bt5/erp5_scalability_data/PathTemplateItem/portal_skins/custom/init_scalability.xml
@@ -81,12 +81,6 @@ portal_type.searchFolder(title=\'Person\')[0].updateRoleMapping()\n
 portal_type.searchFolder(title=\'Product\')[0].updateRoleMapping()\n
 portal_type.searchFolder(title=\'Organisation\')[0].updateRoleMapping()\n
 portal_type.searchFolder(title=\'Sale Trade Condition\')[0].updateRoleMapping()\n
-\n
-# Set id gen\n
-portal.portal_simulation.setIdGenerator("_generatePerDayId")\n
-portal.web_page_module.setIdGenerator("_generatePerDayId")\n
-portal.sale_order_module.setIdGenerator("_generatePerDayId")\n
-portal.person_module.setIdGenerator("_generatePerDayId")\n
 </string> </value>
         </item>
         <item>
diff --git a/bt5/erp5_scalability_data/PathTemplateItem/portal_skins/custom/use_random_id_scalability.xml b/bt5/erp5_scalability_data/PathTemplateItem/portal_skins/custom/use_random_id_scalability.xml
new file mode 100644
index 0000000000..f52e5e1666
--- /dev/null
+++ b/bt5/erp5_scalability_data/PathTemplateItem/portal_skins/custom/use_random_id_scalability.xml
@@ -0,0 +1,75 @@
+<?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>portal = context.getPortalObject()\n
+\n
+# Set id generator\n
+portal.portal_simulation.setIdGenerator("_generatePerDayId")\n
+portal.web_page_module.setIdGenerator("_generatePerDayId")\n
+portal.sale_order_module.setIdGenerator("_generatePerDayId")\n
+portal.person_module.setIdGenerator("_generatePerDayId")\n
+\n
+return 1\n
+</string> </value>
+        </item>
+        <item>
+            <key> <string>_params</string> </key>
+            <value> <string></string> </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>use_random_id_scalability</string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_scalability_data/bt/revision b/bt5/erp5_scalability_data/bt/revision
index 8e2afd3427..25bf17fc5a 100644
--- a/bt5/erp5_scalability_data/bt/revision
+++ b/bt5/erp5_scalability_data/bt/revision
@@ -1 +1 @@
-17
\ No newline at end of file
+18
\ No newline at end of file
diff --git a/bt5/erp5_scalability_data/bt/template_keep_path_list b/bt5/erp5_scalability_data/bt/template_keep_path_list
index ffc6502b78..44acf761a7 100644
--- a/bt5/erp5_scalability_data/bt/template_keep_path_list
+++ b/bt5/erp5_scalability_data/bt/template_keep_path_list
@@ -2,6 +2,7 @@ portal_preferences/scalability_preference
 portal_skins/custom/init_scalability
 portal_skins/custom/update_roles_scalability
 portal_skins/custom/apply_load_balancing_scalability
+portal_skins/custom/use_random_id_scalability
 organisation_module/idexen
 organisation_module/idexen/**
 person_module/scalability_user
diff --git a/bt5/erp5_scalability_data/bt/template_path_list b/bt5/erp5_scalability_data/bt/template_path_list
index 13d0c3886a..efd6c0241f 100644
--- a/bt5/erp5_scalability_data/bt/template_path_list
+++ b/bt5/erp5_scalability_data/bt/template_path_list
@@ -12,6 +12,7 @@ portal_preferences/scalability_preference
 portal_skins/custom/apply_load_balancing_scalability
 portal_skins/custom/init_scalability
 portal_skins/custom/update_roles_scalability
+portal_skins/custom/use_random_id_scalability
 product_module/blue_led
 product_module/blue_led/*
 product_module/green_led
-- 
2.30.9