[Erp5-report] r35825 nicolas - /erp5/trunk/products/ERP5SyncML/Conduit/ERP5Conduit.py

nobody at svn.erp5.org nobody at svn.erp5.org
Mon May 31 18:54:43 CEST 2010


Author: nicolas
Date: Mon May 31 18:54:41 2010
New Revision: 35825

URL: http://svn.erp5.org?rev=35825&view=rev
Log:
Various small improvement:
 * get portal_workflow from portal itself
 * use ElementTree API
 * coding style
 * remove support of CPS 

Modified:
    erp5/trunk/products/ERP5SyncML/Conduit/ERP5Conduit.py

Modified: erp5/trunk/products/ERP5SyncML/Conduit/ERP5Conduit.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5SyncML/Conduit/ERP5Conduit.py?rev=35825&r1=35824&r2=35825&view=diff
==============================================================================
--- erp5/trunk/products/ERP5SyncML/Conduit/ERP5Conduit.py [utf8] (original)
+++ erp5/trunk/products/ERP5SyncML/Conduit/ERP5Conduit.py [utf8] Mon May 31 18:54:41 2010
@@ -954,8 +954,8 @@
     """
     conflict_list = []
     # We want to add a workflow action
-    wf_tool = getToolByName(object,'portal_workflow')
-    wf_id = self.getAttribute(xml,'id')
+    wf_tool = getToolByName(object.getPortalObject(), 'portal_workflow')
+    wf_id = xml.get('id')
     if wf_id is None: # History added by xupdate
       wf_id = self.getHistoryIdFromSelect(xml)
       xml = xml[0]
@@ -963,22 +963,10 @@
     status = self.getStatusFromXml(xml)
     #LOG('addNode, status:',0,status)
     add_action = self.isWorkflowActionAddable(object=object,
-                                           status=status,wf_tool=wf_tool,
-                                           wf_id=wf_id,xml=xml)
+                                              status=status,wf_tool=wf_tool,
+                                              wf_id=wf_id,xml=xml)
     if add_action and not simulate:
-      wf_tool.setStatusOf(wf_id,object,status)
-
-    # Specific CPS, try to remove duplicate lines in portal_repository._histories
-    tool = getToolByName(self,'portal_repository',None)
-    if tool is not None:
-      if getattr(self, 'getDocid', None) is not None:
-        docid = self.getDocid()
-        history = tool.getHistory(docid)
-        new_history = ()
-        for history_line in history:
-          if history_line not in new_history:
-            new_history += (history_line,)
-        tool.setHistory(docid,new_history)
+      wf_tool.setStatusOf(wf_id, object, status)
 
     return conflict_list
 
@@ -990,9 +978,9 @@
     """
     # We want to add a local role
     roles = self.convertXmlValue(xml, data_type='tokens')
-    user = self.getAttribute(xml, 'id')
-    roles = list(roles) # Needed for CPS, or we have a CPS error
-    #LOG('local_role: ',0,'user: %s roles: %s' % (repr(user),repr(roles)))
+    user = xml.get('id')
+    #LOG('local_role: %s' % object.getPath(), INFO,
+                                          #'user:%r | roles:%r' % (user, roles))
     #user = roles[0]
     #roles = roles[1:]
     if xml.xpath('local-name()') == self.local_role_tag:




More information about the Erp5-report mailing list