From 03f096699c348454c6ed06b4c4a112d3aed1f552 Mon Sep 17 00:00:00 2001
From: Nicolas Delaby <nicolas@nexedi.com>
Date: Tue, 9 Aug 2011 10:34:17 +0200
Subject: [PATCH] Consider attach_document_to_context value as a user input
 value

If attach_document_to_context is True, then context will be a follow up of created document.
Consider this assumption as a user input value to enhance metadata discovery process
---
 .../erp5_ingestion/Base_contribute.xml           | 16 +++++++++-------
 bt5/erp5_ingestion/bt/revision                   |  2 +-
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion/Base_contribute.xml b/bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion/Base_contribute.xml
index 47e82b7d08..ed2494f248 100644
--- a/bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion/Base_contribute.xml
+++ b/bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion/Base_contribute.xml
@@ -86,6 +86,14 @@ if classification not in MARKER:\n
 if follow_up_list:\n
   document_kw[\'follow_up_list\'] = follow_up_list\n
 \n
+if attach_document_to_context:\n
+  # attach document to current context using follow_up\n
+  follow_up_list = document_kw.setdefault(\'follow_up_list\', [])\n
+  if context_url not in follow_up_list:\n
+    # attach to context only if not already attached\n
+    follow_up_list.append(context_url)\n
+  document_kw[\'follow_up_list\'] = follow_up_list\n
+\n
 document_kw.update({\'discover_metadata\': not synchronous_metadata_discovery})\n
 if url is not None:\n
   # we contribute and URL, this happens entirely asynchronous\n
@@ -128,13 +136,7 @@ for key in property_id_list:\n
   value = form.get(key, kw.get(key, None))\n
   if value not in MARKER:\n
     document_edit_kw[key] = value\n
-if attach_document_to_context:\n
-  # attach document to current context using follow_up\n
-  follow_up_list = document.getFollowUpList()\n
-  if context_url not in follow_up_list:\n
-    # attach to context only if not already attached\n
-    follow_up_list.append(context_url)\n
-    document.setFollowUpList(follow_up_list)\n
+\n
 # edit document   \n
 if document_edit_kw is not {}:\n
   document.edit(**document_edit_kw)\n
diff --git a/bt5/erp5_ingestion/bt/revision b/bt5/erp5_ingestion/bt/revision
index 0973804c41..eafdfb06c5 100644
--- a/bt5/erp5_ingestion/bt/revision
+++ b/bt5/erp5_ingestion/bt/revision
@@ -1 +1 @@
-137
\ No newline at end of file
+138
\ No newline at end of file
-- 
GitLab