[Zodb-checkins] SVN: ZODB/trunk/ FileIterator.next(): the code for
reading the user, description,
Tim Peters
tim.one at comcast.net
Thu Aug 19 16:55:16 EDT 2004
Log message for revision 27186:
FileIterator.next(): the code for reading the user, description,
and extension fields from a transaction was fatally confused,
usually reading them out of the object pickle by mistake. This
caused several tools to display binary gibberish.
Changed:
U ZODB/trunk/NEWS.txt
U ZODB/trunk/src/ZODB/FileStorage/FileStorage.py
-=-
Modified: ZODB/trunk/NEWS.txt
===================================================================
--- ZODB/trunk/NEWS.txt 2004-08-19 13:54:03 UTC (rev 27185)
+++ ZODB/trunk/NEWS.txt 2004-08-19 20:55:15 UTC (rev 27186)
@@ -5,6 +5,10 @@
Tools
-----
+FileStorage.FileIterator was confused about how to read a transaction's
+user and description fields, which caused several tools to display
+binary gibberish for these values.
+
ZODB.utils.oid_repr() changed to add a leading "0x", and to strip leading
zeroes. This is used, e.g., in the detail of a POSKeyError exception, to
identify the missing oid. Before, the output was ambiguous. For example,
Modified: ZODB/trunk/src/ZODB/FileStorage/FileStorage.py
===================================================================
--- ZODB/trunk/src/ZODB/FileStorage/FileStorage.py 2004-08-19 13:54:03 UTC (rev 27185)
+++ ZODB/trunk/src/ZODB/FileStorage/FileStorage.py 2004-08-19 20:55:15 UTC (rev 27186)
@@ -1897,16 +1897,14 @@
if h.status != "u":
pos = tpos + h.headerlen()
- user = self._file.read(h.ulen)
- description = self._file.read(h.dlen)
e = {}
if h.elen:
try:
- e = loads(self._file.read(h.elen))
+ e = loads(h.ext)
except:
pass
- result = RecordIterator(h.tid, h.status, user, description,
+ result = RecordIterator(h.tid, h.status, h.user, h.descr,
e, pos, tend, self._file, tpos)
# Read the (intentionally redundant) transaction length
@@ -1966,16 +1964,20 @@
# it go to the original data like BDBFullStorage?
prev_txn = self.getTxnFromData(h.oid, h.back)
- r = Record(h.oid, h.tid, h.version, data, prev_txn)
-
+ r = Record(h.oid, h.tid, h.version, data, prev_txn, pos)
return r
raise IndexError, index
class Record(BaseStorage.DataRecord):
"""An abstract database record."""
- def __init__(self, *args):
- self.oid, self.tid, self.version, self.data, self.data_txn = args
+ def __init__(self, oid, tid, version, data, prev, pos):
+ self.oid = oid
+ self.tid = tid
+ self.version = version
+ self.data = data
+ self.data_txn = prev
+ self.pos = pos
class UndoSearch:
More information about the Zodb-checkins
mailing list