[Zope] Re: CMFBTreeFolder Behavior
David Pratt
fairwinds at eastlink.ca
Mon Feb 28 14:19:57 EST 2005
Many thanks Jens for this advice. It is much appreciated.
Regards,
David
On Monday, February 28, 2005, at 12:55 PM, Jens Vagelpohl wrote:
>
> On Feb 28, 2005, at 17:15, David Pratt wrote:
>> When images come into the uploads folder, I am resizing each into 3
>> sizes using PIL and moving this data into an external file type to
>> store file on the filesystem and discarding the original file. I
>> have this working except images are not processed immediately when
>> they come into uploads folder - so I was looking to cronning to see
>> if anything is in the uploads folder each 15 or 30 min.
>
> The behavior you see is simple to explain. Your problem is that you
> are mutating the list of items as you go through it - always a bad
> idea. Try something like this:
>
> ids = list(folder.objectIds()) # This creates a *copy* of all IDs
>
> for id in ids:
> ob = folder._getOb(id)
> <do stuff with ob>
>
> jens
>
> _______________________________________________
> Zope maillist - Zope at zope.org
> http://mail.zope.org/mailman/listinfo/zope
> ** No cross posts or HTML encoding! **
> (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce
> http://mail.zope.org/mailman/listinfo/zope-dev )
>
More information about the Zope
mailing list