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): ...@@ -695,11 +695,9 @@ class ERP5Conduit(XMLSyncUtilsMixin):
Retrieve the portal type from an xml Retrieve the portal type from an xml
""" """
portal_type = None portal_type = None
for subnode in self.getAttributeNodeList(xml): attr_list = xml.xpath('.//@portal_type[1]')
if subnode.nodeName == 'portal_type': if attr_list:
portal_type = subnode.nodeValue portal_type = attr_list[0].value.encode('utf-8')
portal_type = self.convertXmlValue(portal_type)
return portal_type
return portal_type return portal_type
security.declareProtected(Permissions.AccessContentsInformation,'getPropertyType') security.declareProtected(Permissions.AccessContentsInformation,'getPropertyType')
...@@ -707,12 +705,11 @@ class ERP5Conduit(XMLSyncUtilsMixin): ...@@ -707,12 +705,11 @@ class ERP5Conduit(XMLSyncUtilsMixin):
""" """
Retrieve the portal type from an xml Retrieve the portal type from an xml
""" """
p_type = None # use getElementsByTagName !!!! XXX p_type = None
for subnode in self.getAttributeNodeList(xml): attr_list = xml.xpath('.//@type[1]')
if subnode.nodeName == 'type': if attr_list:
p_type = subnode.nodeValue p_type = attr_list[0].value.encode('utf-8')
p_type = self.convertXmlValue(p_type,data_type='string') p_type = self.convertXmlValue(p_type, data_type='string')
return p_type
return p_type return p_type
security.declareProtected(Permissions.AccessContentsInformation,'getXupdateObjectType') 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