Commit 7700f199 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

* accessing field_{my|your}_* directly is bad especially for list type field....

* accessing field_{my|your}_* directly is bad especially for list type field. we should use REQUEST.form instead.
* fix a bug in setFollowUpList part.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@38281 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 5d6f97e6
...@@ -2,10 +2,7 @@ ...@@ -2,10 +2,7 @@
<ZopeData> <ZopeData>
<record id="1" aka="AAAAAAAAAAE="> <record id="1" aka="AAAAAAAAAAE=">
<pickle> <pickle>
<tuple> <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<tuple/>
</tuple>
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
...@@ -117,21 +114,22 @@ if synchronous_metadata_discovery:\n ...@@ -117,21 +114,22 @@ if synchronous_metadata_discovery:\n
is_existing_document_updated = (merged_document!=document)\n is_existing_document_updated = (merged_document!=document)\n
document = merged_document\n document = merged_document\n
# introspect document and find editable properties\n # introspect document and find editable properties\n
# then use kw and try to get values in two available modes: the\n # then use form or kw and try to get values in two available modes: the\n
# script coulbe be called: from ERP5 From or directly from Python script\n # script coulbe be called: from ERP5 From or directly from Python script\n
document_edit_kw = {}\n document_edit_kw = {}\n
property_id_list = document.propertyIds()\n property_id_list = document.propertyIds()\n
form = context.REQUEST.form\n
for key in property_id_list:\n for key in property_id_list:\n
value = kw.get(key, kw.get(\'field_your_%s\' %key, kw.get(\'field_my_%s\' %key, None)))\n value = form.get(key, kw.get(key, None))\n
if value not in MARKER:\n if value not in MARKER:\n
document_edit_kw[key] = value\n document_edit_kw[key] = value\n
if attach_document_to_context:\n if attach_document_to_context:\n
# attach document to current context using follow_up\n # attach document to current context using follow_up\n
follow_up_list = document.getFollowUpValueList()\n follow_up_list = document.getFollowUpList()\n
if context not in follow_up_list:\n if context.getRelativeUrl() not in follow_up_list:\n
# attach to context only if not already attached\n # attach to context only if not already attached\n
follow_up_list.append(context)\n follow_up_list.append(context)\n
document.setFollowUpValueList([x.getRelativeUrl() for x in follow_up_list])\n document.setFollowUpList(follow_up_list)\n
# edit document \n # edit document \n
if document_edit_kw is not {}:\n if document_edit_kw is not {}:\n
document.edit(**document_edit_kw)\n document.edit(**document_edit_kw)\n
...@@ -234,12 +232,10 @@ return document\n ...@@ -234,12 +232,10 @@ return document\n
<string>merged_document</string> <string>merged_document</string>
<string>document_edit_kw</string> <string>document_edit_kw</string>
<string>property_id_list</string> <string>property_id_list</string>
<string>form</string>
<string>_getiter_</string> <string>_getiter_</string>
<string>key</string> <string>key</string>
<string>value</string> <string>value</string>
<string>append</string>
<string>$append0</string>
<string>x</string>
<string>document_portal_type</string> <string>document_portal_type</string>
<string>message</string> <string>message</string>
</tuple> </tuple>
......
106 107
\ 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