Commit 559b8718 authored by Nicolas Delaby's avatar Nicolas Delaby

Avoid looping on all attriubutes

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@24114 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 26409a25
......@@ -695,11 +695,9 @@ class ERP5Conduit(XMLSyncUtilsMixin):
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 @@ class ERP5Conduit(XMLSyncUtilsMixin):
"""
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')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment