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

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Oct 9 10:16:01 CEST 2008


Author: nicolas
Date: Thu Oct  9 10:15:52 2008
New Revision: 24114

URL: http://svn.erp5.org?rev=24114&view=rev
Log:
Avoid looping on all attriubutes

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=24114&r1=24113&r2=24114&view=diff
==============================================================================
--- erp5/trunk/products/ERP5SyncML/Conduit/ERP5Conduit.py (original)
+++ erp5/trunk/products/ERP5SyncML/Conduit/ERP5Conduit.py Thu Oct  9 10:15:52 2008
@@ -695,11 +695,9 @@
     Retrieve the portal type from an xml
     """
     portal_type = None
-    for subnode in self.getAttributeNodeList(xml):
-      if subnode.nodeName == 'portal_type':
-        portal_type = subnode.nodeValue
-        portal_type = self.convertXmlValue(portal_type)
-        return portal_type
+    attr_list = xml.xpath('.//@portal_type[1]')
+    if attr_list:
+      portal_type = attr_list[0].value.encode('utf-8')
     return portal_type
 
   security.declareProtected(Permissions.AccessContentsInformation,'getPropertyType')
@@ -707,12 +705,11 @@
     """
     Retrieve the portal type from an xml
     """
-    p_type = None # use getElementsByTagName !!!! XXX
-    for subnode in self.getAttributeNodeList(xml):
-      if subnode.nodeName == 'type':
-        p_type = subnode.nodeValue
-        p_type = self.convertXmlValue(p_type,data_type='string')
-        return p_type
+    p_type = None
+    attr_list = xml.xpath('.//@type[1]')
+    if attr_list:
+      p_type = attr_list[0].value.encode('utf-8')
+      p_type = self.convertXmlValue(p_type, data_type='string')
     return p_type
 
   security.declareProtected(Permissions.AccessContentsInformation,'getXupdateObjectType')




More information about the Erp5-report mailing list