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