[Grok-dev] Re: letting Grok take over the site

Leonardo Rochael Almeida leorochael at gmail.com
Mon Sep 17 12:40:07 EDT 2007

I think we can go a long way torwards matching users expectations by
doing something a little less involved than replacing the root of our
ZODB and of ZPublisher with a grok app. Taking another page from
Plone, we could have a server component that, instead of serving the
ZPublisher root, serves, say "/App" or "/Application" as the server
root and, if said object not there yet, creates it according to a
certain specification.

Thinking in terms of ZConfig, I picture this as something like:

   # valid keys are "address", "force-connection-close", "factory",
"name" and "skin"
   address 8080
   # force-connection-close on
   name App
   factory MyGrokApp.app.Herd
   skin herdskin

When accessed, it would check if the root of the site has a "App"
object. If not, it'll create one with the provided factory and put it
on the root with the "App" name.
Then it would serve this object as if it was accessed like /App/++skin++herdskin

Notice that there isn't actually anything grok specific about this,
and we could probably develop this as a generic package for Z3.

If the need arises to "delete" this object, this could be done through
a "management" server which would actually be the original "root" http
server, or it could be done through "zopectl debug" (or whatever is
today's equivalent).

This also neatly allows one to reuse the same server setup for
different apps, should one really want it to.

Cheers, Leo

On 9/17/07, Philipp von Weitershausen <philipp at weitershausen.de> wrote:
> Brandon Craig Rhodes wrote:
> > [...]
> >
> > There should be a simple way to create a Grok app that "owns the whole
> > Zope instance" that it runs inside.  People to whom I've shown Grok
> > are confused that, having written my app, I don't just get to access
> > it at the root "/" URL of my web site.  They don't understand why I
> > should have to then enter a GUI and instantiate my app.
> Yup. I would actually like it if Zope would take a particular
> grok.Application class and use it to make the root object of my ZODB. So
> that when I first start my Zope application, I get an instance of my
> application instead of the root folder.
> This will have some problems, though:
> * You're bound to make persistent changes to your application class
> which means you'll have to be able to evolve or delete it somehow. This
> is possible to accomplish, but it'll require some surgery.
> * We'll need a way to tell Zope which application to use if you have
> several installed. It also bears the question whether we should allow
> several applications to be instantiated in one ZODB, just like we do now.
> > [...]

More information about the Grok-dev mailing list