[Grok-dev] What is an application?

Christian Theune ct at gocept.com
Mon Mar 12 03:45:41 EDT 2007


Hi,

that's right. Initially we had an application be a container but found
that it doesn't have to be. As we can't make it a container by default
and let you change it, we decided to make it just a model and you can
make it a container if you like.

The way Darryl described is correct.

Christian

Am Montag, den 12.03.2007, 10:42 +1300 schrieb Darryl Cousins:
> 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
> screen.
> 
> 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):
> 	pass
> 
> If the site need not be a 'root' application object we can just use:
> 
> class MySiteIsAContainer(grok.Site, grok.Container):
> 	pass
> 
> Hope this helps. Corrections grokkers?
> 
> Regards,
> Darryl
> 
> > ____________________
> > Grok-dev mailing list
> > Grok-dev at zope.org
> > http://mail.zope.org/mailman/listinfo/grok-dev
> 
> _______________________________________________
> Grok-dev mailing list
> Grok-dev at zope.org
> http://mail.zope.org/mailman/listinfo/grok-dev
-- 
gocept gmbh & co. kg - forsterstraße 29 - 06112 halle/saale - germany
www.gocept.com - ct at gocept.com - phone +49 345 122 9889 7 -
fax +49 345 122 9889 1 - zope and plone consulting and development
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Dies ist ein digital signierter Nachrichtenteil
Url : http://mail.zope.org/pipermail/grok-dev/attachments/20070312/b2228299/attachment.bin


More information about the Grok-dev mailing list