From b97a091e6c2614d873be27aee8049ab7be92b561 Mon Sep 17 00:00:00 2001
From: Sebastien Robin <seb@nexedi.com>
Date: Mon, 12 Jul 2004 14:03:55 +0000
Subject: [PATCH] correct bug with empty list of permissions

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@1146 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5SyncML/Conduit/ERP5Conduit.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/product/ERP5SyncML/Conduit/ERP5Conduit.py b/product/ERP5SyncML/Conduit/ERP5Conduit.py
index ab8ffe8f2c..3bfd449a75 100755
--- a/product/ERP5SyncML/Conduit/ERP5Conduit.py
+++ b/product/ERP5SyncML/Conduit/ERP5Conduit.py
@@ -1040,13 +1040,17 @@ class ERP5Conduit(XMLSyncUtilsMixin):
     """      
     conflict_list = []      
     # We want to add a local role
-    roles = self.convertXmlValue(xml.childNodes[0].data,data_type='tokens')
+    LOG('addLocalPermissionNode, xml',0,xml)
+    if len(xml.childNodes)>0:
+      roles = self.convertXmlValue(xml.childNodes[0].data,data_type='tokens')
+    else:
+      roles = None
     permission = self.getAttribute(xml,'id')
-    roles = list(roles) # Needed for CPS, or we have a CPS error
     LOG('local_role: ',0,'permission: %s roles: %s' % (repr(permission),repr(roles)))
     #user = roles[0]
     #roles = roles[1:]
     if xml.nodeName.find(self.local_permission_tag)>=0:
+      roles = list(roles) # Needed for CPS, or we have a CPS error
       object.manage_setLocalPermissions(permission,roles)
     return conflict_list
 
-- 
2.30.9