[ZODB-Dev] How can I append Persistent mechanism to OrderedDict class ?

Stéphane Klein stephane at harobed.org
Fri Sep 16 03:07:15 EST 2011


Le 30/01/2011 12:12, Vincent Pelletier a écrit :
> Le dimanche 30 janvier 2011 09:52:32, Stéphane Klein a écrit :
>> How can I append Persistent mechanism to this OrderedDict class ?
>
> You should probably read the code for PersistentMapping[1] and adapt it to
> OrderedDict's API.
>
> [1]
> http://svn.zope.org/ZODB/trunk/src/persistent/mapping.py?rev=113734&view=markup
>

Hi,

I'll try that :

     from collections import OrderedDict
     from persistent import Persistent

     class PersistentOrderedDict(OrderedDict, Persistent):
         pass

but I've this error :

     TypeError: Error when calling the metaclass bases
         multiple bases have instance lay-out conflict

Then, I can't do like "persistent.mapping.PersistentMapping"

     class PersistentMapping(UserDict.IterableUserDict, 
persistent.Persistent)"

I need to create
PersistentOrderedDict that need to be a "proxy" class over OrderedDict, 
and a child on Persistent ?

Regards,
Stephane

-- 
Stéphane Klein <stephane at harobed.org>
blog: http://stephane-klein.info
Twitter: http://twitter.com/klein_stephane
pro: http://www.is-webdesign.com



More information about the ZODB-Dev mailing list