[Zope3-dev] Re: Creating initial services

Guido van Rossum guido@python.org
Thu, 12 Dec 2002 16:01:30 -0500


> Guido van Rossum wrote:
> > [me]
> > 
> >>>I'd like to write the code for setting up initial services. 
> >>>
> > 
> > [Jim]
> > 
> >>OK
> >>
> > 
> >>>I found a spot in SiteDefinition.py where a new site is
> >>>initialized (_initDB()), and I think I could add some code to
> >>>create an event service and an object hub.
> >>>
> > 
> > I've done this now, in a hardcoded way.  When you start with an empty
> > Data.fs, an Events service and an ObjectHub service are created and
> > activated in the root folder.  It feels like an improvement already.
> > And it should be easy to add other services as the need arises.
> 
> Another one to do while it's fresh in your mind :)
> if the error reporting service.

Done.  I also turned on copying tracebacks to zlog by default -- this
seems handy.

> >>I'm not very happy with the StartUp package. In part, this is
> >>because I want to separate system setup from process setup. This is
> >>important when you want to access a system from Python code without
> >>running any servers. I've started to do this. For example, a while
> >>ago, I created Zope.App._app to collect a number of facilities for
> >>configuring Zope, opening and setting up the database, and getting
> >>to root objects and debugging facilities from a Python prompt. These
> >>are exposed in Zope.App.config and Zope.App.Application.
> >>
> >>I'd like additional root object setup to be put in Zope.App._app.database
> >>and I'd like Zope.App.Startup.SiteDefinition.SiteDefinition._initDB
> >>to be refactored to use Zope.App._app.database.
> >>
> > 
> > OK, will do.
> 
> Thanks.

I did this as follows: I put the bootstrap code in a new module
(Zope.App.bootstrap) and call that from _InitDB as well as from
_app.py.

I note that the code in _app.py is undocumented and its purpose isn't
very clear.  You are probably the only person who uses it (apart from
config(), which is used from z3.py). :-(

> >>>But it occurs to me that we should probably do this from a
> >>>suitable zcml file.
> >>>
> >>I think that would be a good todo. I don't think we need to do this
> >>right away though.
> >>
> > 
> > Sure.  I also hear that the SiteDefinition should return a list of
> > directives instead of executing directives as it goes -- would that be
> > a good exercise?
> 
> I'd like to switch this part of the configuration to use zconfig,
> rather than zcml, so cleaning this up is probably not worth the
> bother at this point.

OK.

--Guido van Rossum (home page: http://www.python.org/~guido/)