Commit 46f072dd authored by Jérome Perrin's avatar Jérome Perrin

FooModule_createObjects:

- create document in the context folder (compatible with current use)
- allow to specify the portal_type of created objects

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17707 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 08710957
...@@ -3,11 +3,8 @@ ...@@ -3,11 +3,8 @@
<record id="1" aka="AAAAAAAAAAE="> <record id="1" aka="AAAAAAAAAAE=">
<pickle> <pickle>
<tuple> <tuple>
<tuple> <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<string>Products.PythonScripts.PythonScript</string> <tuple/>
<string>PythonScript</string>
</tuple>
<none/>
</tuple> </tuple>
</pickle> </pickle>
<pickle> <pickle>
...@@ -69,13 +66,12 @@ ...@@ -69,13 +66,12 @@
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>from DateTime import DateTime\n <value> <string>from DateTime import DateTime\n
folder = context.foo_module\n
category_list = (\'a\', \'b\', \'a/a1\', \'a/a2\')\n category_list = (\'a\', \'b\', \'a/a1\', \'a/a2\')\n
\n \n
for i in range(start, start + num):\n for i in range(start, start + num):\n
category = category_list[i % len(category_list)]\n category = category_list[i % len(category_list)]\n
foo = folder.newContent(id = str(i), title = \'Title %d\' % i, quantity = 10.0 - float(i),\n foo = context.newContent(id = str(i), title = \'Title %d\' % i, quantity = 10.0 - float(i),\n
foo_category = category)\n foo_category = category, portal_type=portal_type)\n
if set_dates:\n if set_dates:\n
foo.setStartDate(DateTime(i, i, i))\n foo.setStartDate(DateTime(i, i, i))\n
return \'Created Successfully.\'\n return \'Created Successfully.\'\n
...@@ -101,7 +97,7 @@ return \'Created Successfully.\'\n ...@@ -101,7 +97,7 @@ return \'Created Successfully.\'\n
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>start=0, num=10, set_dates=0</string> </value> <value> <string>start=0, num=10, set_dates=0, portal_type=\'Foo\'</string> </value>
</item> </item>
<item> <item>
<key> <string>errors</string> </key> <key> <string>errors</string> </key>
...@@ -121,7 +117,7 @@ return \'Created Successfully.\'\n ...@@ -121,7 +117,7 @@ return \'Created Successfully.\'\n
<dictionary> <dictionary>
<item> <item>
<key> <string>co_argcount</string> </key> <key> <string>co_argcount</string> </key>
<value> <int>3</int> </value> <value> <int>4</int> </value>
</item> </item>
<item> <item>
<key> <string>co_varnames</string> </key> <key> <string>co_varnames</string> </key>
...@@ -130,10 +126,8 @@ return \'Created Successfully.\'\n ...@@ -130,10 +126,8 @@ return \'Created Successfully.\'\n
<string>start</string> <string>start</string>
<string>num</string> <string>num</string>
<string>set_dates</string> <string>set_dates</string>
<string>portal_type</string>
<string>DateTime</string> <string>DateTime</string>
<string>_getattr_</string>
<string>context</string>
<string>folder</string>
<string>category_list</string> <string>category_list</string>
<string>_getiter_</string> <string>_getiter_</string>
<string>range</string> <string>range</string>
...@@ -141,6 +135,8 @@ return \'Created Successfully.\'\n ...@@ -141,6 +135,8 @@ return \'Created Successfully.\'\n
<string>_getitem_</string> <string>_getitem_</string>
<string>len</string> <string>len</string>
<string>category</string> <string>category</string>
<string>_getattr_</string>
<string>context</string>
<string>str</string> <string>str</string>
<string>float</string> <string>float</string>
<string>foo</string> <string>foo</string>
...@@ -159,6 +155,7 @@ return \'Created Successfully.\'\n ...@@ -159,6 +155,7 @@ return \'Created Successfully.\'\n
<int>0</int> <int>0</int>
<int>10</int> <int>10</int>
<int>0</int> <int>0</int>
<string>Foo</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
272 273
\ 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