[ZODB-Dev] George Bailey'd objects cause failure in
FileStorage._loadBack
Magnus Lycka
magnus@thinkware.se
Thu, 31 Oct 2002 15:40:41 +0100
At 11:37 2002-10-31 +0000, Toby Dickenson wrote:
>Can you post a simple way to reproduce this?
Sure. It would be great if someoone took a look
at this before I post a bug report, in case I did
something wrong...
---------------------------
# georgebaileytest.py
import ZODB, ZODB.FileStorage, Persistence, pprint
storage = ZODB.FileStorage.FileStorage('test.fs')
db = ZODB.DB(storage)
connection = db.open()
root = connection.root()
class MyTest(Persistence.Persistent):
def __init__(self, value):
self.value = value
george = MyTest('Bailey')
root['to be unborn'] = george
get_transaction().commit()
print "Root", root
print "george", george
print "george.value", george.value
pprint.pprint (db.undoLog())
id = db.undoLog()[0]['id']
print id
db.undo(id)
get_transaction().commit()
connection.sync()
print "Root", root
print "george", george
print "george.value", george.value
--------------------------------------
I get:
X:\xxx>python georgebaileytest.py
Root {'to be unborn': <MyTest instance at 008796D0>}
george <MyTest instance at 008796D0>
george.value Bailey
[{'description': '',
'id': 'A0iIjJjEm6M=',
'time': 1036074995.8049998,
'user_name': ''},
{'description': 'initial database creation',
'id': 'A0iIjJjEm6I=',
'time': 1036074995.8049998,
'user_name': ''}]
A0iIjJjEm6M=
Root {}
george <MyTest instance at 008796D0>
george.value
Traceback (most recent call last):
File "georgebaileytest.py", line 34, in ?
print "george.value", george.value
File "G:\Python22\Lib\site-packages\ZODB\Connection.py", line 522, in
setstate
p, serial = self._storage.load(oid, self._version)
File "G:\Python22\Lib\site-packages\ZODB\FileStorage.py", line 619, in load
return self._load(oid, version, self._index, self._file)
File "G:\Python22\Lib\site-packages\ZODB\FileStorage.py", line 605, in _load
return _loadBack(file, oid, pnv)
File "G:\Python22\Lib\site-packages\ZODB\FileStorage.py", line 2098, in
_loadB
ack
doid, serial, prev, tloc, vlen, plen = unpack(">8s8s8s8sH8s", h)
struct.error: unpack str size does not match format
--
Magnus Lycka, Thinkware AB
Alvans vag 99, SE-907 50 UMEA, SWEDEN
phone: int+46 70 582 80 65, fax: int+46 70 612 80 65
http://www.thinkware.se/ mailto:magnus@thinkware.se