From f7a1118972cb71a69ae9baf7ea5b7a7afcb8fe64 Mon Sep 17 00:00:00 2001
From: Nicolas Delaby <nicolas@nexedi.com>
Date: Fri, 14 May 2010 09:02:26 +0000
Subject: [PATCH] * small refactoring  to just call edit only once * replace
 text_format by content_type

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@35321 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../portal_skins/erp5_forge/BugLine_init.xml      | 15 ++++++++++-----
 bt5/erp5_forge/bt/revision                        |  2 +-
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_forge/BugLine_init.xml b/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_forge/BugLine_init.xml
index b611fc18c8..b1a2c7bf29 100644
--- a/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_forge/BugLine_init.xml
+++ b/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_forge/BugLine_init.xml
@@ -54,16 +54,17 @@
         <item>
             <key> <string>_body</string> </key>
             <value> <string># Set preferred text format\n
-context.edit(text_format = context.portal_preferences.getPreferredTextFormat())\n
-context.setStartDate(DateTime())\n
+portal = context.getPortalObject()\n
+edit_kw = {\'content_type\': portal.portal_preferences.getPreferredTextFormat(),\n
+           \'start_date\': DateTime(),\n
+           \'destination_value_list\': context.BugLine_getRecipientValueList()}\n
 \n
 # Define a Reporter as Source Trade\n
 person =  context.Bug_getUserPersonValue()\n
 if person is not None:\n
-  context.setSourceValue(person)\n
+  edit_kw[\'source_value\'] = person\n
 \n
-# Define Recipents\n
-context.setDestinationValueList(context.BugLine_getRecipientValueList())\n
+context.edit(**edit_kw)\n
 </string> </value>
         </item>
         <item>
@@ -104,9 +105,13 @@ context.setDestinationValueList(context.BugLine_getRecipientValueList())\n
                             <string>kw</string>
                             <string>_getattr_</string>
                             <string>context</string>
+                            <string>portal</string>
                             <string>DateTime</string>
+                            <string>edit_kw</string>
                             <string>person</string>
                             <string>None</string>
+                            <string>_write_</string>
+                            <string>_apply_</string>
                           </tuple>
                         </value>
                     </item>
diff --git a/bt5/erp5_forge/bt/revision b/bt5/erp5_forge/bt/revision
index bccc87b80e..5ae48373ad 100644
--- a/bt5/erp5_forge/bt/revision
+++ b/bt5/erp5_forge/bt/revision
@@ -1 +1 @@
-581
\ No newline at end of file
+585
\ No newline at end of file
-- 
2.30.9