Commit 7849eed6 authored by Bartek Górny's avatar Bartek Górny

code reorganisation so that we can get values

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@11522 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent bfc5af64
......@@ -71,14 +71,10 @@
<value> <string># get related object title list in a security-aware way (without throwing exception\n
# if I don\'t have permissions to access the object)\n
\n
cat_value_list=context.getPropertyList(category)\n
ob_list=context.Base_getRelatedObjectValueList(category)\n
title_list=[o.getTitle() for o in ob_list]\n
\n
def getTitleIfAvailable(cat_value):\n
ob=context.restrictedTraverse(cat_value,None)\n
return ob is not None and ob.getTitle() or \'\'\n
\n
title_list=[getTitleIfAvailable(c) for c in cat_value_list]\n
return [t for t in title_list if t!=\'\']\n
return filter(lambda t:t!=\'\',title_list)\n
</string> </value>
</item>
<item>
......@@ -130,14 +126,13 @@ return [t for t in title_list if t!=\'\']\n
<string>category</string>
<string>_getattr_</string>
<string>context</string>
<string>cat_value_list</string>
<string>getTitleIfAvailable</string>
<string>ob_list</string>
<string>append</string>
<string>$append0</string>
<string>_getiter_</string>
<string>c</string>
<string>o</string>
<string>title_list</string>
<string>t</string>
<string>filter</string>
</tuple>
</value>
</item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.PythonScripts.PythonScript</string>
<string>PythonScript</string>
</tuple>
<none/>
</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># get related object value list in a security-aware way (without throwing exception\n
# if I don\'t have permissions to access the object)\n
\n
cat_value_list=context.getPropertyList(category)\n
if cat_value_list is None:return []\n
\n
def getValueIfAvailable(cat_value):\n
ob=context.restrictedTraverse(cat_value,None)\n
return ob \n
\n
ob_list=[getValueIfAvailable(c) for c in cat_value_list]\n
return ob_list\n
return [o for o in ob_list if o is not None]\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>_owner</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>category</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>1</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>category</string>
<string>_getattr_</string>
<string>context</string>
<string>cat_value_list</string>
<string>None</string>
<string>getValueIfAvailable</string>
<string>append</string>
<string>$append0</string>
<string>_getiter_</string>
<string>c</string>
<string>ob_list</string>
<string>o</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>Base_getRelatedObjectValueList</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
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