[Grok-dev] Re: Trying to wrap my head around GROK
Martijn Faassen
faassen at startifact.com
Tue Apr 1 08:22:15 EDT 2008
want_to_grok_grok wrote:
> Found the information I was looking for, it leeds to more questions
> but I want to leave a written trace of this, so here's my
> understanding of things :
> When grokproject creates the skeleton for the app It build one
> container to which we can attach any other container by a dict-like
> structure : "self['contacts'] = Contacts()" ( I was trying the
> self.contacts form and it wasn't yielding proper results). Now to have
> the container behave like a "folder" one has to create an index view
> for it and it's associated template file, while setting the
> "grok.context(Contact)" and "grok.name('index')".
>
> Now this works, but I hope it's the proper grok way.
Yes, that sounds like the proper way. You create a view for the
container that shows what's in the folder and offer manipulation options
should they be needed. You do this by adding views, for instance an
index view.
Note that both grok.context() and grok.name() can be left off if there's
only a single possible context (your container) in the module, and if
the name you want is the lowercase of the class name (imagine you named
your class "Index").
Regards,
Martijn
More information about the Grok-dev
mailing list