[Erp5-report] r30132 - /erp5/trunk/products/ERP5SyncML/Conduit/ERP5DocumentConduit.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Oct 29 18:03:56 CET 2009


Author: nicolas
Date: Thu Oct 29 18:03:53 2009
New Revision: 30132

URL: http://svn.erp5.org?rev=30132&view=rev
Log:
The select attribute already provide xpath expression, so do not try to recompute it.


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

Modified: erp5/trunk/products/ERP5SyncML/Conduit/ERP5DocumentConduit.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5SyncML/Conduit/ERP5DocumentConduit.py?rev=30132&r1=30131&r2=30132&view=diff
==============================================================================
--- erp5/trunk/products/ERP5SyncML/Conduit/ERP5DocumentConduit.py [utf8] (original)
+++ erp5/trunk/products/ERP5SyncML/Conduit/ERP5DocumentConduit.py [utf8] Thu Oct 29 18:03:53 2009
@@ -96,18 +96,17 @@
           xml = data_change[prop_id]
         else:
           xml = xml_previous.xpath(path_prop_id)[0]
-        num = prop_list[2].split('[')[1].rstrip(']')
+        request = prop_list[-1]
         if subnode.xpath('name()') in self.XUPDATE_DEL:
-          request = 'block_data[@num = $num]'
-          xml.remove(xml.xpath(request, num=num)[0]) 
-          data_change[prop_id] = xml
+          node_to_remove_list = xml.xpath(request)
+          if node_to_remove_list:
+            xml.remove(xml.xpath(request)[0]) 
+            data_change[prop_id] = xml
           xml_xupdate.remove(subnode)
         elif subnode.xpath('name()') in self.XUPDATE_UPDATE:
           #retrieve element in previous_xml
-          request = 'block_data[@num = $num]'
-          element = xml.xpath(request, num=num)[0]
-          if element is not None:
-           element.text = subnode.text
+          element = xml.xpath(request)[0]
+          element.text = subnode.text
           data_change[prop_id] = xml
           xml_xupdate.remove(subnode)
       elif subnode.xpath('name()') in self.XUPDATE_INSERT_OR_ADD:
@@ -138,7 +137,7 @@
               xml_xupdate.remove(subnode)
 
     #apply modification
-    if len(data_change) != 0:
+    if len(data_change):
       args = {}
       for key in data_change.keys():
         node = data_change[key]




More information about the Erp5-report mailing list