[CMF-checkins] SVN: CMF/trunk/CMFCore/exportimport/typeinfo.py - made sure each Action is only added once

Yvo Schubbe y.2006_ at wcm-solutions.de
Wed Jan 25 13:11:16 EST 2006


Log message for revision 41443:
  - made sure each Action is only added once

Changed:
  U   CMF/trunk/CMFCore/exportimport/typeinfo.py

-=-
Modified: CMF/trunk/CMFCore/exportimport/typeinfo.py
===================================================================
--- CMF/trunk/CMFCore/exportimport/typeinfo.py	2006-01-25 18:00:25 UTC (rev 41442)
+++ CMF/trunk/CMFCore/exportimport/typeinfo.py	2006-01-25 18:11:16 UTC (rev 41443)
@@ -131,11 +131,11 @@
         for child in node.childNodes:
             if child.nodeName != 'action':
                 continue
-            title = child.getAttribute('title')
-            id = child.getAttribute('action_id')
-            category = child.getAttribute('category')
-            condition = child.getAttribute('condition_expr')
-            action = child.getAttribute('url_expr')
+            title = str(child.getAttribute('title'))
+            id = str(child.getAttribute('action_id'))
+            category = str(child.getAttribute('category'))
+            condition = str(child.getAttribute('condition_expr'))
+            action = str(child.getAttribute('url_expr'))
             visible = self._convertToBoolean(child.getAttribute('visible'))
             permissions = []
             for sub in child.childNodes:
@@ -147,8 +147,15 @@
                 if not permission:
                     permission = self._getNodeText(sub)
                 permissions.append(permission)
-            self.context.addAction(id, title, action, condition,
-                                   tuple(permissions), category, visible)
+            action_obj = self.context.getActionObject(category+'/'+id)
+            if action_obj is None:
+                self.context.addAction(id, title, action, condition,
+                                       tuple(permissions), category, visible)
+            else:
+                action_obj.edit(title=title, action=action,
+                                condition=condition,
+                                permissions=tuple(permissions),
+                                visible=visible)
 
     def _initOldstyleProperties(self, node):
         if not node.hasAttribute('title'):



More information about the CMF-checkins mailing list