[Grok-dev] What is an application?

Darryl Cousins darryl at darrylcousins.net.nz
Sun Mar 11 17:42:48 EDT 2007

Hi Tim,

An answer from a new grokker.

On Sun, 2007-03-11 at 16:28 +0100, Tim Terlegård wrote:
> Hi folks,
> I just created something very simple with grok. A question was raised.
> What is an application in the grok world? My initial thought was that
> it must be the site, the root container. I guess it is a site, but it
> doesn't seem to be a container. I can't do a view like:
>     class CreateSomething(grok.View):
>         grok.context(grok.Application)
>         def update(self):
> 	    container = IWriteContainer(self.context)
>             container['someid'] = Folder()
> I tried changing app.py so my app inherited from grok.Container instead of
> grok.Model, then it worked much better. I checked the grok source code
> and grok.Application inherits from Site. In pure zope3 I can adapt a
> site to IFolder or IWriteContainer, but in grok I can't. Isn't a site
> the same thing in pure zope3 and grok?
> Tim

The way I see it:

Application: yes, is a site but also marks the content as a grok
application for the grok registry. ie is addable in the grok admin

Site: Not a container as you found, but is initiated with a site manager
container (++etc++) - where local utilities are placed by convention.

To make a site a container:

class MySiteIsAContainer(grok.Application, grok.Container):

If the site need not be a 'root' application object we can just use:

class MySiteIsAContainer(grok.Site, grok.Container):

Hope this helps. Corrections grokkers?


> ____________________
> Grok-dev mailing list
> Grok-dev at zope.org
> http://mail.zope.org/mailman/listinfo/grok-dev

More information about the Grok-dev mailing list