[Zope] context of a for loop

Fearless Froggie fearless_froggie@yahoo.com
Wed, 5 Mar 2003 17:12:49 -0800 (PST)


When you are going through a for loop, are you in the
context of that for loop variable? Can you drop out of
that for loop context and into the context of the


If I loop through a list of id's with a for loop and
do something to each of these objects, I get a "You
are not allowed to access editMetadata in this
context". Here's the code (here I'm just changing the
title of each of my items in my list 'id' to 'bob'): 

for item in id:
   item_object = getattr(context, item)

But if I do these changes directly, it works fine:

item_object = getattr(context, id[0])

So I'm guessing that the for loops puts me into
another context. How do I get into the context of the
object I want to edit? I've tried
"context.item_object.editMetadata(title='bob')" and
"container.item_object.editMetadata(title='bob')", but
they didn't work either.

My script in all these cases is my custom skins

Many thanks for any ideas on this. (And thank you once
again for all the great ideas I've received for my
past emails :)


Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more