[Neo-report] r1766 vincent - /trunk/neo/client/app.py

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Feb 16 11:18:18 CET 2010


Author: vincent
Date: Tue Feb 16 11:18:13 2010
New Revision: 1766

Log:
Move packet construction outside of loop as it uses only loop invariants.

Also, avoid using local variables when they are used just once.

Modified:
    trunk/neo/client/app.py

Modified: trunk/neo/client/app.py
==============================================================================
--- trunk/neo/client/app.py [iso-8859-1] (original)
+++ trunk/neo/client/app.py [iso-8859-1] Tue Feb 16 11:18:13 2010
@@ -572,14 +572,12 @@
         if transaction is not local_var.txn:
             raise StorageTransactionError(self, transaction)
         tid = local_var.tid
-        user = transaction.user
-        desc = transaction.description
-        ext = dumps(transaction._extension)
-        oid_list = self.local_var.data_dict.keys()
         # Store data on each node
         voted_counter = 0
-        cell_list = self._getCellListForTID(tid, writable=True)
-        for cell in cell_list:
+        p = Packets.AskStoreTransaction(tid, transaction.user,
+            transaction.description, dumps(transaction._extension),
+            local_var.data_dict.keys())
+        for cell in self._getCellListForTID(tid, writable=True):
             logging.debug("voting object %s %s" %(cell.getAddress(),
                 cell.getState()))
             conn = self.cp.getConnForCell(cell)
@@ -587,8 +585,6 @@
                 continue
 
             local_var.txn_voted = False
-            p = Packets.AskStoreTransaction(tid,
-                    user, desc, ext, oid_list)
             try:
                 self._askStorage(conn, p)
             except ConnectionClosed:





More information about the Neo-report mailing list