[ZODB-Dev] PersistentMapping glitches

Tim Peters tim at zope.com
Tue Aug 23 10:15:11 EDT 2005


[Victor Safronovich]
> 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.

As I mentioned in the Collector issue, you could also use pm.items() (where
pm is a PersistentMapping, or a UserDict, or a Python dict, or a BTree, ...,
anything that supports an items() method returning a sequence of 2-tuples).



More information about the ZODB-Dev mailing list