From 15cb7870588421a42efffcb42039f3d9770ba3a0 Mon Sep 17 00:00:00 2001
From: Benjamin Blanc <benjamin.blanc@tiolive.com>
Date: Mon, 29 Jul 2013 09:47:47 +0000
Subject: [PATCH] erp5_scalability_data: Add script to clone 1000 scalability
 users

---
 .../custom/clone_scalability_user.xml         | 81 +++++++++++++++++++
 bt5/erp5_scalability_data/bt/revision         |  2 +-
 .../bt/template_keep_path_list                |  1 +
 .../bt/template_path_list                     |  1 +
 4 files changed, 84 insertions(+), 1 deletion(-)
 create mode 100644 bt5/erp5_scalability_data/PathTemplateItem/portal_skins/custom/clone_scalability_user.xml

diff --git a/bt5/erp5_scalability_data/PathTemplateItem/portal_skins/custom/clone_scalability_user.xml b/bt5/erp5_scalability_data/PathTemplateItem/portal_skins/custom/clone_scalability_user.xml
new file mode 100644
index 0000000000..e9d2d4b023
--- /dev/null
+++ b/bt5/erp5_scalability_data/PathTemplateItem/portal_skins/custom/clone_scalability_user.xml
@@ -0,0 +1,81 @@
+<?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
+module = context.person_module\n
+my_user = module.scalability_user\n
+\n
+for i in xrange(0,1000):\n
+  new_user = my_user.Base_createCloneDocument(batch_mode=1)\n
+  name = \'scalability_user_%d\' %i\n
+  new_user.setId(name)\n
+  new_user.setTitle(name)\n
+  new_user.setReference(name)\n
+  # new_user.setSubordinationValue(some_organisation_document)\n
+  new_user.validate()\n
+  assignment = new_user.objectValues(portal_type=\'Assignment\')[0]\n
+  assignment.open()\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>clone_scalability_user</string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_scalability_data/bt/revision b/bt5/erp5_scalability_data/bt/revision
index c7930257df..301160a930 100644
--- a/bt5/erp5_scalability_data/bt/revision
+++ b/bt5/erp5_scalability_data/bt/revision
@@ -1 +1 @@
-7
\ No newline at end of file
+8
\ 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 615a0785ce..87b9edee4b 100644
--- a/bt5/erp5_scalability_data/bt/template_keep_path_list
+++ b/bt5/erp5_scalability_data/bt/template_keep_path_list
@@ -1,3 +1,4 @@
+portal_skins/custom/clone_scalability_user
 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 f333c72343..0a837682e4 100644
--- a/bt5/erp5_scalability_data/bt/template_path_list
+++ b/bt5/erp5_scalability_data/bt/template_path_list
@@ -8,6 +8,7 @@ person_module/john_rock
 person_module/john_rock/*
 person_module/scalability_user
 person_module/scalability_user/*
+portal_skins/custom/clone_scalability_user
 product_module/blue_led
 product_module/blue_led/*
 product_module/green_led
-- 
2.30.9