From 29c517b86247a99f6da5a1ee9906ec3e2492fffc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Tue, 29 Jul 2008 10:24:18 +0000
Subject: [PATCH] the log added in
 https://svn.erp5.org/?view=rev&revision=22250 was really to verbose. Instead
 verify if the permission name is valid and don't try to install it if not
 valid.

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

diff --git a/product/ERP5/Document/BusinessTemplate.py b/product/ERP5/Document/BusinessTemplate.py
index 09e6102275..0b1b450a00 100644
--- a/product/ERP5/Document/BusinessTemplate.py
+++ b/product/ERP5/Document/BusinessTemplate.py
@@ -2604,6 +2604,8 @@ class ModuleTemplateItem(BaseTemplateItem):
     else:
       items = self._archive
 
+    valid_permissions = dict.fromkeys([x[0] for x in
+                                       context.ac_inherited_permissions(all=1)])
     for id in items.keys():
       if update_dict.has_key(id) or force:
         if not force:
@@ -2620,13 +2622,8 @@ class ModuleTemplateItem(BaseTemplateItem):
         module.setTitle(str(mapping['title']))
         for name, role_list in list(mapping['permission_list']):
           acquire = (type(role_list) == type([]))
-          try:
+          if name in valid_permissions:
             module.manage_permission(name, roles=role_list, acquire=acquire)
-          except ValueError:
-            # Ignore a permission not present in this system.
-            LOG('ERP5', PROBLEM,
-                'Unable to update module permission "%s" with roles %s' % (
-                  name, role_list), error=sys.exc_info())
 
   def _importFile(self, file_name, file):
     dict = {}
-- 
2.30.9