[Zope3-Users] Re: worldcookery "Christmas Dinner"

Gary Poster gary at zope.com
Mon Oct 3 09:27:02 EDT 2005


On Oct 3, 2005, at 2:32 AM, Joel Moxley wrote:

> I apologize for my replying to self, but I was re-reading Stephan's
> and then Philipp's book and realized that one portion of my email has
> been answered.  Thus, I'm hoping to clarify my question to the list.
>
> Looking at the messageboard content class, I then did a grep on
> Philipp's worldcookery examples directory for btree -- sure enough,
> the last chapter before Expert level (14, aptly titled "Containers"),
> addresses RecipeFolders (what I had called RecipeContainers).  It must
> have been late when I read that chapter because it did not reach to
> proper location in my memory :)
>
> Bottom line, I will re-summarize my original question below with this
> information in mind:
>
> * RecipeFolder Views.  In a RecipeFolder page template file, how would
> you view both parameters on the parent RecipeFolder as well as
> specific child Recipes within the container?

Folders have a dict API.  If you are talking about a view of your  
recipe folder, then, for instance, you could do a .values() call on  
the recipe folder (maybe "tal:repeat recipe context/values" in the  
template or "for recipe in self.context.values():" in the view class)  
and then for each recipe render what you want.

If you wanted to pick and choose, hardcoded within a template, you  
could specify a recipe by name (a la "context/key_of_recipe" in the  
template or "self.context['key_of_recipe']" in the view class).  If  
you want to do something trickier, just do it in the view class,  
using the dict API.

> * RecipeFolder Controllers.  How would you access an external python
> method for compiling statistics on this container and then update the
> view?

You would typically do that in your view class, where it's just an  
import away.  Does that make sense?  If not, maybe more details (from  
you, about what you need) are in order.  Since you have done your  
homework on the books, I'm guessing view classes make sense, but if  
not, ask away. :-)

Gary


More information about the Zope3-users mailing list