Commit 32a8e080 authored by Jérome Perrin's avatar Jérome Perrin

generate an int index and reference. Rule is a bit different from...

generate an int index and reference. Rule is a bit different from Base_initIntIndexAndReference because int_index are increased by a step of 10. This could be made generic though

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@23104 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 3c01ba83
......@@ -112,7 +112,7 @@
</item>
<item>
<key> <string>init_script</string> </key>
<value> <string></string> </value>
<value> <string>Requirement_init</string> </value>
</item>
<item>
<key> <string>permission</string> </key>
......
<?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>parent = context.getParentValue()\n
portal_type = context.getPortalType()\n
\n
step = 10 # XXX configure this ?\n
index = 0\n
\n
siblings = [x for x in parent.contentValues(checked_permission=\'View\',\n
filter={"portal_type": portal_type}) if x.getIntIndex()]\n
\n
if len(siblings):\n
index = max([r.getIntIndex() for r in siblings])\n
\n
index = index + step\n
\n
if parent.getPortalType() == portal_type:\n
reference = "%s.%s" % (parent.getReference(), index)\n
else:\n
reference = str(index)\n
\n
context.edit(\n
int_index=index,\n
reference=reference,\n
)\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>parent</string>
<string>portal_type</string>
<string>step</string>
<string>index</string>
<string>append</string>
<string>$append0</string>
<string>_getiter_</string>
<string>x</string>
<string>siblings</string>
<string>len</string>
<string>max</string>
<string>r</string>
<string>reference</string>
<string>str</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>Requirement_init</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
551
\ No newline at end of file
552
\ 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