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

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Oct 8 17:59:28 CEST 2008


Author: nicolas
Date: Wed Oct  8 17:59:28 2008
New Revision: 24106

URL: http://svn.erp5.org?rev=24106&view=rev
Log:
Small optimisation

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=24106&r1=24105&r2=24106&view=diff
==============================================================================
--- erp5/trunk/products/ERP5SyncML/Conduit/ERP5Conduit.py (original)
+++ erp5/trunk/products/ERP5SyncML/Conduit/ERP5Conduit.py Wed Oct  8 17:59:28 2008
@@ -746,7 +746,7 @@
       return
     # Retrieve the list of users with a role and delete default roles
     if reset_local_roles:
-      user_role_list = map(lambda x:x[0], object.get_local_roles())
+      user_role_list = [x[0] for x in object.get_local_roles()]
       object.manage_delLocalRoles(user_role_list)
     if getattr(object, 'workflow_history', None) is not None and reset_workflow:
       object.workflow_history = PersistentMapping()
@@ -821,8 +821,8 @@
       result += xml.attributes.values()[0].nodeValue
       for subnode in self.getElementNodeList(xml):  #getElementNodeList
         if subnode.nodeName == 'xupdate:attribute':
-          result += ' ' + subnode.attributes.values()[0].nodeValue + '='
-          result += '"' + subnode.childNodes[0].nodeValue + '"'
+          result += ' %s=' % subnode.attributes.values()[0].nodeValue
+          result += '"%s"' % subnode.childNodes[0].nodeValue
       result += '>'
       # Then dumps the xml and remove what we does'nt want
       #xml_string = StringIO()
@@ -836,7 +836,7 @@
       maxi = max(xml_string.find('>')+1,\
                  xml_string.rfind('</xupdate:attribute>')+len('</xupdate:attribute>'))
       result += xml_string[maxi:xml_string.find('</xupdate:element>')]
-      result += '</' + xml.attributes.values()[0].nodeValue + '>'
+      result += '</%s>' % xml.attributes.values()[0].nodeValue
       return self.convertToXml(result.encode('utf-8'))
     if xml.nodeName in (self.XUPDATE_UPDATE+self.XUPDATE_DEL):
       result = u'<'
@@ -862,7 +862,7 @@
       xml_string = unicode(xml_string,encoding='utf-8')
       maxi = xml_string.find('>')+1
       result += xml_string[maxi:xml_string.find('</%s>' % xml.nodeName)]
-      result += '</' + property + '>'
+      result += '</%s>' % (property)
       #LOG('getElementFromXupdate, result:',0,repr(result))
       return self.convertToXml(result)
     return xml
@@ -896,7 +896,7 @@
         data = ''
       return data
     #data = data.replace('\n','')
-    if type(data) is type(u"a"):
+    if isinstance(data, unicode):
       data = data.encode(self.getEncoding())
     if data == 'None':
       return None




More information about the Erp5-report mailing list