[Grok-dev] Deleting Container items

Tim Cook timothywayne.cook at gmail.com
Fri Mar 6 07:06:08 EST 2009


Okay, what is wrong with this code?

I have a grok.Container named 'ar'

I want to be able to completely empty it at certain times.

When I execute the following code it deletes exactly half of the
contents.  For example if I have 4 items it deletes 2.  If I execute it
again it deletes 1.  Finally on the 3rd execution it deletes the last
one.


class Emptyar(grok.View):
    grok.context(oship)
    
    def render(self):
        atnames=self.context['ar'].keys()

        for x in atnames:
            del self.context['ar'][x]


I even tried self.context['ar'].__delattr__(x) and had exactly (not
surprising I suppose) the same effect.

Thanks,
Tim




-- 
Timothy Cook, MSc
Health Informatics Research & Development Services
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook 
Skype ID == timothy.cook 
**************************************************************
*You may get my Public GPG key from  popular keyservers or   *
*from this link http://timothywayne.cook.googlepages.com/home*
**************************************************************
-------------- 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/52edbb88/attachment-0001.bin 


More information about the Grok-dev mailing list