[Neo-report] r2082 gregory - in /trunk/neo: master/transactions.py storage/transactions.py

nobody at svn.erp5.org nobody at svn.erp5.org
Fri May 7 11:13:39 CEST 2010


Author: gregory
Date: Fri May  7 11:13:37 2010
New Revision: 2082

Log:
Implement __repr__ on Transaction.

Modified:
    trunk/neo/master/transactions.py
    trunk/neo/storage/transactions.py

Modified: trunk/neo/master/transactions.py
==============================================================================
--- trunk/neo/master/transactions.py [iso-8859-1] (original)
+++ trunk/neo/master/transactions.py [iso-8859-1] Fri May  7 11:13:37 2010
@@ -17,6 +17,7 @@
 
 from time import time, gmtime
 from struct import pack, unpack
+from neo.util import dump
 from neo import logging
 from neo import protocol
 
@@ -32,6 +33,14 @@
         self._msg_id = None
         # uuid dict hold flag to known who has locked the transaction
         self._uuid_dict = {}
+
+    def __repr__(self):
+        return "<%s(node=%r, tid=%r, oids=%r, uuids=%r) at %x>" % (
+                self._node,
+                dump(self._tid),
+                [dump(x) for x in self._oid_list],
+                [dump(x) for x in self._uuid_dict],
+        )
 
     def getNode(self):
         """

Modified: trunk/neo/storage/transactions.py
==============================================================================
--- trunk/neo/storage/transactions.py [iso-8859-1] (original)
+++ trunk/neo/storage/transactions.py [iso-8859-1] Fri May  7 11:13:37 2010
@@ -50,6 +50,15 @@
         self._object_dict = {}
         self._transaction = None
         self._locked = False
+
+    def __repr__(self):
+        return "<%s(tid=%r, uuid=%r, locked=%r)> at %x" % (
+            self.__class__.__name__,
+            dump(self._tid),
+            dump(self._uuid),
+            self.isLocked(),
+            id(self),
+        )
 
     def getTID(self):
         return self._tid





More information about the Neo-report mailing list