[Erp5-report] r32725 nicolas.dumazet - /erp5/trunk/products/ERP5Type/XMLMatrix.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Feb 18 09:20:35 CET 2010


Author: nicolas.dumazet
Date: Thu Feb 18 09:20:28 2010
New Revision: 32725

URL: http://svn.erp5.org?rev=32725&view=rev
Log:
"_".join(item_list) is faster and more pythonic than several str += "_%" % item

Modified:
    erp5/trunk/products/ERP5Type/XMLMatrix.py

Modified: erp5/trunk/products/ERP5Type/XMLMatrix.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/XMLMatrix.py?rev=32725&r1=32724&r2=32725&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/XMLMatrix.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/XMLMatrix.py [utf8] Thu Feb 18 09:20:28 2010
@@ -490,16 +490,19 @@
       if getattr(aq_base(self), 'index', None) is None:
         return None
       base_id = kwd.get('base_id', "cell")
-      cell_id = base_id
-      if not self.index.has_key(cell_id):
+      if not self.index.has_key(base_id):
         return None
+
+      cell_id_list = [base_id]
 
       base_item = self.index[base_id]
       for i, my_id in enumerate(kw):
         try:
-          cell_id += '_%s' % base_item[i][my_id]
+          cell_id_list.append(base_item[i][my_id])
         except KeyError:
           raise KeyError, 'Invalid key: %s' % str(kw)
+
+      cell_id = "_".join(cell_id_list)
 
       cell = self.get(cell_id)
       if cell is not None:




More information about the Erp5-report mailing list