[Zope-Checkins] CVS: Packages/ZODB - POSException.py:1.20.4.4 utils.py:1.17.4.3

Tim Peters tim.one at comcast.net
Sat Sep 4 00:09:54 EDT 2004


Update of /cvs-repository/Packages/ZODB
In directory cvs.zope.org:/tmp/cvs-serv7051/ZODB

Modified Files:
      Tag: Zope-2_7-branch
	POSException.py utils.py 
Log Message:
Collector #1488 (TemporaryStorage -- going backward in time).

This confusion was really due to that the detail on a ConflictError
exception didn't make sense.


=== Packages/ZODB/POSException.py 1.20.4.3 => 1.20.4.4 ===
--- Packages/ZODB/POSException.py:1.20.4.3	Fri Aug 27 15:03:42 2004
+++ Packages/ZODB/POSException.py	Sat Sep  4 00:09:54 2004
@@ -16,7 +16,8 @@
 $Id$"""
 
 from types import StringType, DictType
-from ZODB.utils import oid_repr, serial_repr
+
+from ZODB.utils import oid_repr, readable_tid_repr
 
 def _fmt_undo(oid, reason):
     s = reason and (": %s" % reason) or ""
@@ -49,8 +50,8 @@
       serials : (string, string)
         a pair of 8-byte packed strings; these are the serial numbers
         related to conflict.  The first is the revision of object that
-        is in conflict, the second is the revision of that the current
-        transaction read when it started.
+        is in conflict, the currently committed serial.  The second is
+        the revision the current transaction read when it started.
 
     The caller should pass either object or oid as a keyword argument,
     but not both of them.  If object is passed, it should be a
@@ -84,8 +85,11 @@
         if self.class_name:
             extras.append("class %s" % self.class_name)
         if self.serials:
-            extras.append("serial was %s, now %s" %
-                          tuple(map(serial_repr, self.serials)))
+            current, old = self.serials
+            extras.append("serial this txn started with %s" %
+                          readable_tid_repr(old))
+            extras.append("serial currently committed %s" %
+                          readable_tid_repr(current))
         if extras:
             return "%s (%s)" % (self.message, ", ".join(extras))
         else:
@@ -229,4 +233,4 @@
       still joined to a transaction (for example, a transaction is in
       progress, with uncommitted modifications in the connection).
     """
- 
\ No newline at end of file
+


=== Packages/ZODB/utils.py 1.17.4.2 => 1.17.4.3 ===
--- Packages/ZODB/utils.py:1.17.4.2	Tue Aug 17 15:23:47 2004
+++ Packages/ZODB/utils.py	Sat Sep  4 00:09:54 2004
@@ -12,8 +12,8 @@
 #
 ##############################################################################
 
-import sys
-import TimeStamp, time
+import sys, time
+from ZODB import TimeStamp
 
 from struct import pack, unpack
 from types import StringType
@@ -89,7 +89,6 @@
         return ts.laterThan(old)
     return ts
 
-
 def oid_repr(oid):
     if isinstance(oid, StringType) and len(oid) == 8:
         # Convert to hex and strip leading zeroes.
@@ -104,3 +103,13 @@
         return repr(oid)
 
 serial_repr = oid_repr
+tid_repr = oid_repr
+
+# For example, produce
+#     '0x03441422948b4399 2002-04-14 20:50:34.815000'
+# for 8-byte string tid '\x03D\x14"\x94\x8bC\x99'.
+def readable_tid_repr(tid):
+    result = tid_repr(tid)
+    if isinstance(tid, StringType) and len(tid) == 8:
+        result = "%s %s" % (result, TimeStamp.TimeStamp(tid))
+    return result



More information about the Zope-Checkins mailing list