[ZODB-Dev] PersistentMapping glitches

Victor Safronovich vsafronovich at naumen.ru
Tue Aug 23 03:44:49 EDT 2005


Hello Tim Peters,

Monday, August 22, 2005, 8:44:08 PM, you wrote:

>>>> from BTrees.OOBTree import OOBTree 
>>>> b = OOBTree()
>>>> b.update(pm)
TP> Traceback (most recent call last):
TP>   File "<stdin>", line 1, in ?
TP>   File "C:\python23\lib\UserDict.py", line 19, in __getitem__
TP>     def __getitem__(self, key): return self.data[key]
TP> KeyError: 0

Some  workaround for me(the Collector 1873 poster) was to use data attribute of
the UserDict instances.
>>> from ZODB.PersistentMapping import PersistentMapping
>>> from BTrees.OOBTree import OOBTree
>>> r = OOBTree()
>>> r.update( PersistentMapping({1:1}).data)
>>> dict(r)
{1: 1}

i am using isinstance(obj, UserDict) condition now.

-- 
Best regards,
 Victor Safronovich
 NauMen.NauDoc.SoftwareDeveloper  http://www.naumen.ru



More information about the ZODB-Dev mailing list