From 8b5f9b2515a66659e213b2a40881570e5ae75a12 Mon Sep 17 00:00:00 2001
From: Vincent Pelletier <vincent@nexedi.com>
Date: Tue, 26 Feb 2008 18:20:06 +0000
Subject: [PATCH] Ignore serialization_tag when its value is None. Add a test.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@19534 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/CMFActivity/ActivityTool.py          | 3 +++
 product/CMFActivity/tests/testCMFActivity.py | 5 +++++
 2 files changed, 8 insertions(+)

diff --git a/product/CMFActivity/ActivityTool.py b/product/CMFActivity/ActivityTool.py
index 6f861748f8..7e74b9681f 100644
--- a/product/CMFActivity/ActivityTool.py
+++ b/product/CMFActivity/ActivityTool.py
@@ -121,6 +121,9 @@ class Message:
     else:
       self.active_process = active_process.getPhysicalPath()
       self.active_process_uid = active_process.getUid()
+    if activity_kw.get('serialization_tag', False) is None:
+      # Remove serialization_tag if it's None.
+      del activity_kw['serialization_tag']
     self.activity_kw = activity_kw
     self.method_id = method_id
     self.args = args
diff --git a/product/CMFActivity/tests/testCMFActivity.py b/product/CMFActivity/tests/testCMFActivity.py
index 2bfda1a60d..e034e55294 100644
--- a/product/CMFActivity/tests/testCMFActivity.py
+++ b/product/CMFActivity/tests/testCMFActivity.py
@@ -2796,6 +2796,11 @@ class TestCMFActivity(ERP5TypeTestCase):
     self.tic()
     result = activity_tool.getMessageList()
     self.assertEqual(len(result), 0)
+    # Check that giving a None value to serialization_tag does not confuse
+    # CMFActivity
+    organisation.activate(activity=activity, serialization_tag=None).getTitle()
+    self.tic()
+    self.assertEqual(len(activity_tool.getMessageList()), 0)
 
   def test_106_checkSerializationTagSQLDict(self, quiet=0, run=run_all_test):
     if not run: return
-- 
2.30.9