From 381f7aadf1508838bec37c8fd59fb356d322ca7b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Aur=C3=A9lien=20Calonne?= <aurel@nexedi.com>
Date: Tue, 12 Dec 2006 11:05:08 +0000
Subject: [PATCH] fix uninstall of portal type roles

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@11686 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/Document/BusinessTemplate.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/product/ERP5/Document/BusinessTemplate.py b/product/ERP5/Document/BusinessTemplate.py
index 85de782147..fbeba6756c 100644
--- a/product/ERP5/Document/BusinessTemplate.py
+++ b/product/ERP5/Document/BusinessTemplate.py
@@ -2167,7 +2167,12 @@ class PortalTypeRolesTemplateItem(BaseTemplateItem):
 
   def uninstall(self, context, **kw):
     p = context.getPortalObject()
-    for roles_path in self._objects.keys():
+    object_path = kw.get('object_path', None)
+    if object_path is not None:
+      keys = [object_path]
+    else:
+      keys = self._objects.keys()
+    for roles_path in keys:
       path = 'portal_types/%s' % roles_path.split('/', 1)[1]
       obj = p.unrestrictedTraverse(path)
       setattr(obj, '_roles', [])
-- 
2.30.9