Commit 51c01cf1 authored by Jérome Perrin's avatar Jérome Perrin

normalize Item_get*Value and Item_get*Title scripts, all now use...

normalize Item_get*Value and Item_get*Title scripts, all now use getCurrentTrackingList (until the expected behaviour is properly defined)
Item_getCurrentSiteTitle no longer accepts with_title=0 to return the site value. callers have been updated

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@27100 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 199edab2
......@@ -71,7 +71,7 @@ if selection_uid_list:\n
else:\n
object_list = stool.callSelectionFor(selection_name)\n
\n
source_section_list = [ item.Item_getCurrentOwnerTitle(with_title=0) for item in object_list ]\n
source_section_list = [ item.Item_getCurrentOwnerValue() for item in object_list ]\n
\n
property_dict = {\'title\':title,\n
\'stop_date\' : stop_date,\n
......@@ -99,7 +99,7 @@ for ss in source_section_list:\n
\n
\n
for item in object_list:\n
source_section = item.Item_getCurrentOwnerTitle(with_title=0)\n
source_section = item.Item_getCurrentOwnerValue()\n
if source_section is not None:\n
if source_section.getUid() is not None:\n
pl_value = pl_dict[str(source_section.getUid())]\n
......
......@@ -56,7 +56,7 @@
<value> <string># Check data validity\n
from Products.ERP5Type.Message import translateString\n
source = context.Item_getCurrentSiteValue()\n
source_section = context.Item_getCurrentOwnerTitle(with_title=0)\n
source_section = context.Item_getCurrentOwnerValue()\n
\n
property_dict = {\'title\':title, \n
\'stop_date\' : stop_date,\n
......
......@@ -53,17 +53,10 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>from DateTime import DateTime\n
\n
date = DateTime()\n
last_affectation = context.portal_simulation.getCurrentTrackingList(item=context.getRelativeUrl(), at_date=date)\n
\n
if len(last_affectation) == 0:\n
return None\n
owner = context.portal_catalog.getObject(last_affectation[0].section_uid)\n
if with_title:\n
return owner.getTitle()\n
return owner\n
<value> <string>current_owner = context.Item_getCurrentOwnerValue()\n
if current_owner is not None:\n
return current_owner.getTitle()\n
return None\n
</string> </value>
</item>
<item>
......@@ -74,7 +67,7 @@ return owner\n
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>with_title = 1</string> </value>
<value> <string></string> </value>
</item>
<item>
<key> <string>errors</string> </key>
......@@ -94,22 +87,16 @@ return owner\n
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>1</int> </value>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>with_title</string>
<string>DateTime</string>
<string>date</string>
<string>_getattr_</string>
<string>context</string>
<string>last_affectation</string>
<string>len</string>
<string>current_owner</string>
<string>None</string>
<string>_getitem_</string>
<string>owner</string>
</tuple>
</value>
</item>
......@@ -121,9 +108,7 @@ return owner\n
<item>
<key> <string>func_defaults</string> </key>
<value>
<tuple>
<int>1</int>
</tuple>
<none/>
</value>
</item>
<item>
......
<?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>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>from DateTime import DateTime\n
\n
date = DateTime()\n
last_affectation_list = context.portal_simulation.getCurrentTrackingList(item=context.getRelativeUrl(), at_date=date)\n
\n
if len(last_affectation_list) == 0:\n
return None\n
\n
if last_affectation_list[0].section_uid is not None:\n
return context.portal_catalog.getObject(last_affectation_list[0].section_uid)\n
\n
return None\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></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>DateTime</string>
<string>date</string>
<string>_getattr_</string>
<string>context</string>
<string>last_affectation_list</string>
<string>len</string>
<string>None</string>
<string>_getitem_</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>Item_getCurrentOwnerValue</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -53,8 +53,9 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>if context.Item_getCurrentSiteValue() not in (\'\',None):\n
return context.Item_getCurrentSiteValue().getTitle()\n
<value> <string>current_site = context.Item_getCurrentSiteValue()\n
if current_site is not None:\n
return current_site.getTitle()\n
return None\n
</string> </value>
</item>
......@@ -94,6 +95,7 @@ return None\n
<tuple>
<string>_getattr_</string>
<string>context</string>
<string>current_site</string>
<string>None</string>
</tuple>
</value>
......
......@@ -57,13 +57,14 @@
\n
date = DateTime()\n
last_affectation_list = context.portal_simulation.getCurrentTrackingList(item=context.getRelativeUrl(), at_date=date)\n
#context.log(\'last_affectation_list\',len(last_affectation_list))\n
\n
if len(last_affectation_list) == 0:\n
return None\n
\n
if last_affectation_list[0].node_uid is not None:\n
site = context.portal_catalog.getObject(last_affectation_list[0].node_uid)\n
#context.log(\'site\',site)\n
return site\n
\n
return None\n
</string> </value>
</item>
......
......@@ -53,9 +53,10 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>if context.Item_getResourceValue() is not None:\n
return context.Item_getResourceValue().getTitle()\n
return \'\'\n
<value> <string>resource = context.Item_getResourceValue()\n
if resource is not None:\n
return resource.getTitle()\n
return None\n
</string> </value>
</item>
<item>
......@@ -94,6 +95,7 @@ return \'\'\n
<tuple>
<string>_getattr_</string>
<string>context</string>
<string>resource</string>
<string>None</string>
</tuple>
</value>
......
......@@ -58,15 +58,15 @@
#kw[\'at_date\'] = DateTime()\n
kw[\'item\'] = context.getRelativeUrl()\n
\n
last_affectation_list = context.portal_simulation.getTrackingList(**kw)\n
last_affectation_list = context.portal_simulation.getCurrentTrackingList(**kw)\n
\n
if kw.get(\'src__\',0):\n
return last_affectation_list\n
\n
if len(last_affectation_list):\n
last_affectation = last_affectation_list[0]\n
if last_affectation.resource_uid is not None:\n
resource_value = context.portal_catalog.getObject(last_affectation.resource_uid)\n
\n
return resource_value\n
\n
return None\n
......
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