[Zope] ZODB.POSException.ConflictError (in custommade product)

Gitte Wange gitte at mmmanager.org
Sun Oct 26 17:14:39 EST 2003


At 18:34 26-10-2003, Dieter Maurer wrote:
>Gitte Wange wrote at 2003-10-26 11:25 +0100:
>  > At 11:03 26-10-2003, Dieter Maurer wrote:
>  > >Gitte Wange wrote at 2003-10-25 13:39 +0200:
>  > >  > I have created a small tool for CMF to count how many times a 
> specific
>  > >  > object has been viewed.
>  > >  > ...
>  > >  > Now from time to time we see the following error:
>  > >  > ZODB.POSException.ConflictError
>  > >
>  > >
>  > >When you put counters in the ZODB, you should use
>  > >"BTrees.Length" instances. They are small persistent objects with
>  > >conflict resolution (no ZODB write conflicts) and "independence"
>  > >(no ZODB read conflicts).
>  >
>  > Arh ...
>  > At this moment I just have a dictionary with URL as key and count as 
> value.
>  > count is a simple integer.
>  > So instead I should save value as an instance of BTrees.Length() ?
>  > Or just I make something else than a dictionary ?
>
>If your counter is maintained in the ZODB, the counter should
>be a "BTrees.Length" instance. Otherwise, you can use whatever
>data structure seems best for you.

Sorry Dieter if I'm slow on this but I just don't get it ...
At this moment I have a dictionary looking like this:
views = {'http://mypage.com/frontpage': 10, 'http://mypage.com/article2': 3}
This get's saved into ZODB and - as I understand - causes the ConflictErrors ?

Instead I should use some sort of BTrees.Length object ... and then my 
question is:
Should the dictionary look like this instead:
views = {'http://mypage.com/frontpage': BTrees.Length(10), 
'http://mypage.com/article2': BTrees.Length(3)}
??
Or is it the entire dictionary that should be some kind of BTrees.Length() ??

Greetings,
Gitte Wange 




More information about the Zope mailing list