[ZODB-Dev] ZODB4 and DemoStorage
Marius Gedminas
mgedmin@codeworks.lt
Tue, 8 Apr 2003 18:51:52 +0300
On Tue, Apr 08, 2003 at 10:37:44AM -0400, Barry Warsaw wrote:
> MappingStorage is more like a MemoryMinimalStorage; neither supports
> undo or versions. MemoryFullStorage as its name implies, supports the
> full storage interface.
OK. I do not need undo/versions at the moment, but a full functional
testing framework should definitely support them.
> > I have some reservations about it. Closing the DB also closes the
> > storage,
>
> Looking at the code, that's all db.close() does!
>
> > and I am not sure you just pass the same storage to a new DB
> > instance as if nothing had happened.
>
> Well, what if you just threw away the DB object without closing it? I'm
> not 100% sure this is kosher, but it would be interesting to try. :)
It seems to work both with and without db.close().
I have a set of 20 functional tests for our Zope 3 product, and I'm
trying to migrate that to DemoStorage (previously the tests just
recreated the root folder and essential services in setUp). I see one
interesting failure, which occurs both with db.close and without.
Here's the traceback:
[...snip...]
File "/home/users/mg/Zope3/src/zope/app/publication/zopepublication.py", line 163, in afterCall
get_transaction().commit()
File "/home/users/mg/Zope3/src/transaction/txn.py", line 62, in commit
self._manager.commit(self)
File "/home/users/mg/Zope3/src/transaction/manager.py", line 29, in commit
r.prepare(txn)
File "/home/users/mg/Zope3/src/zodb/connection.py", line 307, in prepare
self._objcommit(obj, txn)
File "/home/users/mg/Zope3/src/zodb/connection.py", line 450, in _objcommit
self._commit_store(writer, o, transaction)
File "/home/users/mg/Zope3/src/zodb/connection.py", line 477, in _commit_store
transaction)
File "/home/users/mg/Zope3/src/zodb/storage/demo.py", line 147, in store
datarec = self._datarec(superself, oid, version)
File "/home/users/mg/Zope3/src/zodb/storage/demo.py", line 72, in _datarec
txnrec = it.next()
File "/home/users/mg/Zope3/src/zodb/storage/bdbfull.py", line 1679, in __getitem__
return self.next()
File "/home/users/mg/Zope3/src/zodb/storage/bdbfull.py", line 1716, in next
it = _RecordsIterator(self._storage, tid, packedp, user, desc, ext)
File "/home/users/mg/Zope3/src/zodb/storage/bdbfull.py", line 1765, in __init__
self._extension = pickle.loads(ext)
TypeError: loads() argument 1 must be string, not unicode
ext is u'' there for some reason. I'll try to investigate.
Marius Gedminas
--
Codeworks is available for Zope consulting -- http://www.codeworks.lt/