[Grok-dev] Deleting Container items

Tim Cook timothywayne.cook at gmail.com
Fri Mar 6 07:52:03 EST 2009


On Fri, 2009-03-06 at 07:08 -0500, Chris McDonough wrote:
> I assume grok.Container uses a BTree to hold its subobjects.  

It does.

> You shouldn't
> mutate a BTree while you iterate over its keys and values.  

Ahhhhh! another BTree lesson.

> So this might work
> instead:
> 
>          atnames=list(self.context['ar'].keys())
>          for x in atnames:
>              del self.context['ar'][x]

That did the trick.

Thanks,
Tim


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://mail.zope.org/pipermail/grok-dev/attachments/20090306/7700d556/attachment.bin 


More information about the Grok-dev mailing list