From 394da7bae1d8bf3ada7fec7845d87be25f56ef0d Mon Sep 17 00:00:00 2001
From: Arnaud Fontaine <arnaud.fontaine@nexedi.com>
Date: Fri, 22 Aug 2014 15:09:56 +0200
Subject: [PATCH] Portal Types Classes: Fix race condition on reset with
 Workflod Methods.

Sometimes, after saving a Component, Interaction Workflows Methods were not
created, thus reset could not be done later on.
---
 product/ERP5Type/dynamic/portal_type_class.py | 24 +++++++++----------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/product/ERP5Type/dynamic/portal_type_class.py b/product/ERP5Type/dynamic/portal_type_class.py
index 8e9861a328..57d9d1924f 100644
--- a/product/ERP5Type/dynamic/portal_type_class.py
+++ b/product/ERP5Type/dynamic/portal_type_class.py
@@ -382,15 +382,15 @@ def synchronizeDynamicModules(context, force=False):
       import traceback; traceback.print_exc()
       raise
 
-  # It's okay for classes to keep references to old methods - maybe.
-  # but we absolutely positively need to clear the workflow chains
-  # stored in WorkflowMethod objects: our generation of workflow
-  # methods adds/registers/wraps existing methods, but does not
-  # remove old chains. Do it now.
-  resetRegisteredWorkflowMethod()
-
-  # Some method generations are based on portal methods, and portal
-  # methods cache results. So it is safer to invalidate the cache.
-  cache_tool = getattr(portal, 'portal_caches', None)
-  if cache_tool is not None:
-    cache_tool.clearCache()
+    # It's okay for classes to keep references to old methods - maybe.
+    # but we absolutely positively need to clear the workflow chains
+    # stored in WorkflowMethod objects: our generation of workflow
+    # methods adds/registers/wraps existing methods, but does not
+    # remove old chains. Do it now.
+    resetRegisteredWorkflowMethod()
+
+    # Some method generations are based on portal methods, and portal
+    # methods cache results. So it is safer to invalidate the cache.
+    cache_tool = getattr(portal, 'portal_caches', None)
+    if cache_tool is not None:
+      cache_tool.clearCache()
-- 
2.30.9