[Grok-dev] About the grok.name() annotation

Fernando Correa Neto fcdoth at gmail.com
Fri Jul 13 16:37:15 EDT 2007


On 7/13/07, Darryl Cousins <darryl at darrylcousins.net.nz> wrote:
> Hi,
> On Fri, 2007-07-13 at 20:53 +0200, Sebastian Ware wrote:
> > My two pennies...
> >
> > I got the grok.name('view_name') concept quite fast. I am not saying
> > I think calling it "name" was exceptionally perfect, but I use it and
> > it wasn't too difficult for me to understand the idea that grok.name
> > = "what I call it in the URL". It would have been easier if perhaps
> > it would have been called grok.url_name().
> grok.name is also used in other grokkers (e.g. AdapterGrokker) and
> refers the the name by which an component is looked up. I've also reused
> grok.name for grokkers of my own making following the convention of
> naming the looking up. Without this convention the grok namespace would
> become bloated with:
> grok.url_name
> grok.adapter_name
> grok.catalog_name
> etc, etc

Yeah, that makes sense. Since grok.View is a multi-adapter it is also
looked up by name.
I didn't realize grok.name was the convention for  <browser:page
name=....> zcml thing.
Wondering how to explain views as multiadapters for newcomers.
Somebody in the #grok just asked:

<nathany> brandon_rhodes: do you know how to tell grok that you want a
view to have a particular URL name?
 <nathany> ie, FooIndex should be accessible @ "index"
 <nathany> ?

It's better then enforce in the tutorial and say: If you want your
view to be accessed in the URL by /foo, then put grok.name('foo')
inside your view class.


More information about the Grok-dev mailing list