Commit 503f551b authored by Grégory Wisniewski's avatar Grégory Wisniewski

Implement __repr__ on Transaction.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2082 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 1c7e499d
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
from time import time, gmtime from time import time, gmtime
from struct import pack, unpack from struct import pack, unpack
from neo.util import dump
from neo import logging from neo import logging
from neo import protocol from neo import protocol
...@@ -33,6 +34,14 @@ class Transaction(object): ...@@ -33,6 +34,14 @@ class Transaction(object):
# uuid dict hold flag to known who has locked the transaction # uuid dict hold flag to known who has locked the transaction
self._uuid_dict = {} 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): def getNode(self):
""" """
Return the node that had began the transaction Return the node that had began the transaction
......
...@@ -51,6 +51,15 @@ class Transaction(object): ...@@ -51,6 +51,15 @@ class Transaction(object):
self._transaction = None self._transaction = None
self._locked = False 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): def getTID(self):
return self._tid return self._tid
......
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