[Grok-dev] Containers with different object types and traversal

Roger Erens roger.erens at e-s-c.biz
Sat Mar 28 10:38:10 EDT 2009


on 27-3-2009 23:05 Steve Schmechel wrote:
> I will try to cover this topic in the tutorial I am writing.
> I want to post back what I ended up doing here, in case someone else finds this thread during a search.
> 
> The class holding the two containers ended up looking like this:
> 
> class Performance(grok.Container):
>     interface.implements(IPerformance)  #Only affects display of
>     location = u''                      #fields on forms.  Template
>     leader = u''                        #must handle containers.
>     def __init__(self):
>         super(Performance, self).__init__()  #See note below.
>         self['musicians'] = Musicians() #Inherits from grok.Container
>         self['songs'] = Songs()         #Inherits from grok.Container
> 
Hi Steve,

Another small question: I expect that there will be multiple instances 
of Perfomance, each with its own location and leader. Do you have a 
reason for not moving those variables into the __init__() method?

Thanks,

Roger


More information about the Grok-dev mailing list