Commit 2058f8cb authored by Lucas Carvalho's avatar Lucas Carvalho

sometimes, the relation is not set on the context so the solution is to guess...

sometimes, the relation is not set on the context so the solution is to guess the accessor name from the field.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@31651 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 14d26fba
...@@ -64,11 +64,12 @@ portal_type = map(lambda x:x[0],field.get_value(\'portal_type\'))\n ...@@ -64,11 +64,12 @@ portal_type = map(lambda x:x[0],field.get_value(\'portal_type\'))\n
kw = {}\n kw = {}\n
for k, v in field.get_value(\'parameter_list\') :\n for k, v in field.get_value(\'parameter_list\') :\n
kw[k] = v\n kw[k] = v\n
jump_reference_list = context.getAcquiredValueList(base_category, portal_type=portal_type, filter=kw)\n accessor_name = \'get%sValueList\' % \'\'.join([part.capitalize() for part in base_category.split(\'_\')])\n
jump_reference_list = getattr(context, accessor_name)(portal_type=portal_type, filter=kw)\n
\n \n
if len(jump_reference_list)==1:\n if len(jump_reference_list)==1:\n
jump_reference = jump_reference_list[0]\n jump_reference = jump_reference_list[0]\n
return request[ \'RESPONSE\' ].redirect( \'%s/view\' % jump_reference.absolute_url() )\n return jump_reference.Base_redirect(\'view\')\n
else:\n else:\n
selection_uid_list = map(lambda x:x.getUid(),jump_reference_list)\n selection_uid_list = map(lambda x:x.getUid(),jump_reference_list)\n
kw = {\'uid\': selection_uid_list}\n kw = {\'uid\': selection_uid_list}\n
...@@ -132,6 +133,10 @@ else:\n ...@@ -132,6 +133,10 @@ else:\n
<string>k</string> <string>k</string>
<string>v</string> <string>v</string>
<string>_write_</string> <string>_write_</string>
<string>append</string>
<string>$append0</string>
<string>part</string>
<string>accessor_name</string>
<string>jump_reference_list</string> <string>jump_reference_list</string>
<string>len</string> <string>len</string>
<string>_getitem_</string> <string>_getitem_</string>
......
1422 1424
\ 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