[ZODB-Dev] ZODB4 and DemoStorage

Marius Gedminas mgedmin@codeworks.lt
Wed, 9 Apr 2003 11:32:39 +0300


On Tue, Apr 08, 2003 at 06:51:52PM +0300, Marius Gedminas wrote:
> 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.
[...]
>     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.

I think I found the cause.  Transaction metadata consists of three
things: user, description and ext.  First two are (or can be) Unicode
strings (both principal IDs and locations in Zope 3 are Unicode
strings), the third one is a pickle.  They are all concatenated into a
single Unicode string in BDBFullStorage._dobegin and split in _doundolog
and _nexttxn.  That's how ext becomes a unicode object instead of an
empty string.

Any ideas on fixing this?  I suppose user and description should be
converted to plain strings (in UTF-8) and then later converted back to
unicode, but I am not sure where exactly.

Marius Gedminas
-- 
Codeworks is available for Zope consulting -- http://www.codeworks.lt/