[Zope3-Users] Deleting subobjects works "half" only

Frank Burkhardt fbo2 at gmx.net
Fri May 19 08:12:00 EDT 2006


Hi,

On Fri, May 19, 2006 at 07:56:24AM -0400, Stephan Richter wrote:
> On Friday 19 May 2006 07:47, Frank Burkhardt wrote:
> > Unfortunately, the view removes just half the objects - independently of
> > how much objects are left inside the container.
> 
> That is the correct behavior. BTrees change their internal data structure with 
> every change, such as deletion of an item, and thus the keys() method is not 
> guaranteed to iterate over all items. Use one of the following instead:
> 
> for entry in tuple(tree.keys())
> 
> for entry in tree.iterkeys()

Thank you Stephan, you saved my day :-)

Best,

Frank


More information about the Zope3-users mailing list