From 17914de679f4b65687ed844a88fe555d59e48d9a Mon Sep 17 00:00:00 2001
From: Arnaud Fontaine <arnaud.fontaine@nexedi.com>
Date: Thu, 1 Mar 2012 11:21:04 +0900
Subject: [PATCH] During preinstall of Filesystem DocumentTemplateItem, do not
 add the prefix twice.

This fixes filesystem Document-related tests in testBusinessTemplate.
---
 product/ERP5/Document/BusinessTemplate.py | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/product/ERP5/Document/BusinessTemplate.py b/product/ERP5/Document/BusinessTemplate.py
index 5116240edc..bc2313d28b 100644
--- a/product/ERP5/Document/BusinessTemplate.py
+++ b/product/ERP5/Document/BusinessTemplate.py
@@ -3541,10 +3541,12 @@ class FilesystemToZodbTemplateItem(FilesystemDocumentTemplateItem,
       if method_name == 'preinstall':
         old_result = result.copy()
         for k, v in old_result.iteritems():
-          if not k.startswith(self._tool_id + '/'):
+          # Magical way to have unique path (without duplicating the prefix
+          # neither) in case of not yet migrated property sheets available on
+          # preinstall list
+          if not (k.startswith(self._tool_id + '/') or
+                  k.startswith(self.getTemplateTypeName())):
             result.pop(k)
-            # Magical way to have unique path in case of not yet migrated property
-            # sheets available on preinstall list
             k = self._getKey(k)
           result[k] = v
       return result
-- 
2.30.9