Hi
I faced the similar problem
Traversal fails as inherited class from OOBTree doesn't persist __name__,
__parent__. Similarly you can't have other attributes also as they will not
be persisted. Classes inheriting from PersistentMapping don't have this
problem and you can have other attributes also in them apart from key/value
stored in mapping.
I have defined my class to circumvent the problem ( may be for other
attributes similar approach can be taken up)
class ItemContainer(OOBTree.BTree):
def __init__(self,name,parent):
super(ItemContainer,self).__init__()
self.__name__=name
self.__parent__=parent
def additem(self,item):
self[item.__name__] = item
item.__parent__=self
@property
def __name__(self):
return self["name"]
@__name__.setter
def __name__(self, value):
self["name"] = value
@property
def __parent__(self):
return self["parent"]
@__parent__.setter
def __parent__(self, value):
self["parent"] = value
Please let me know if there is a problem in this approach.
Thanks,
Anurag
On Tuesday, December 24, 2013 3:09:45 PM UTC+5:30, Gerhard Schmidt wrote:
>
> Hi
>
> i'm building a web application based on pyramid and traversal in a ZODB.
> So far it's working fine with Container derived from Persitent Mapping. But
> some containers will get many children so i'm trying to use a BTree based
> Container. So far no success.
>
> I've tried
>
> from BTrees.OOBTree import BTree
> from persistent import Persistent
>
> class container(BTree, Persistent)
>
> I'ts working but changes don't geht stored in the zodb.
>
> I there a example how to do this out there or can someone get mit a Hint
> what im missing.
>
> Regards
> Estartu
>
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/d/optout.