[ZODB-Dev] simple newbie BTrees.Length question
Bakhtiar A Hamid
kdie at kedai.com.my
Mon Jan 19 09:39:38 EST 2004
hi
in my journey to understand zope product coding, i intend to use
BTrees.Length to store some objects. after googling, there's little info
about BTrees, apart from ajung's wiki and some links to this list.
i'm interested in BTrees.Length so that i can get the automatic conflict
resolution for my products. say i have these:
Type "copyright", "credits" or "license" for more information.
>>> from BTrees.Length import Length
>>> class Counter:
... def __init__(self):
... self.count=Length()
... def storeCount(self, c):
... self.count=c
... def getCount(self):
... return self.count
...
>>> x=Counter()
>>> x.storeCount(1)
>>> x.getCount()
1
>>> x.storeCount(2)
>>> x.getCount()
2
>>> x.storeCount([1,2,3,4])
>>> x.getCount()
[1, 2, 3, 4]
it is true that Counter class has conflict resolution, since self.count is
a BTrees.Length
when i storeCount, do i just do it that way and zodb will
do the rest? should i care? what happens if i store a list? and change
the list again?
i'm sorry if these questions are inappropriate.
thanks
trying-to-understand-btrees
More information about the ZODB-Dev
mailing list